commit | 7cf126dbb14b9a1177efc7996367e9a13407bdf0 | [log] [tgz] |
---|---|---|
author | Primiano Tucci <primiano@google.com> | Tue Oct 24 21:58:06 2023 +0100 |
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | Tue Feb 27 14:20:11 2024 +0000 |
tree | 718394b40b40b76718b22f2f66ed1ae1853926a7 | |
parent | 5d7efef2982b8a84755e0d1d96cb611d06652136 [diff] |
traced: make CloneReadOnly() copy only used portion of the buffer Before this change CloneReadOnly() would memcpy the whole buffer when cloning. This has two side-effects: 1. Causes a read-only page-fault on the original buffer. This is typically not a huge deal because both Linux and Window will map all that memory to the zero-page until a RW fault happens. 2. The cloned buffer will be filled with zeros up to the declared size. This can cause memory spikes. The memory spikes wouldn't be a huge deal normally, because we expect the buffer to be eventually fully used. However, recently we introduced edge use cases where we declare extremely large (~500MB) buffers and expect to use them only in the case of a bugreport (But not fully). In this case the memory spike is undesirable. Bug: 307542353 Bug: 296227911 Test: perfetto_unittests --gtest_filter=TraceBufferTest.* (cherry picked from commit 88060ce0324ec8dec6a1f9a9084033b4b7049a29) (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:133f99fc7a967313509db6ddbb9c86400f5c18a0) Merged-In: Ie53ee2b854cf2da488d115623dbdcf959fbacade Change-Id: Ie53ee2b854cf2da488d115623dbdcf959fbacade
Perfetto is a production-grade open-source stack for performance instrumentation and trace analysis. It offers services and libraries and for recording system-level and app-level traces, native + java heap profiling, a library for analyzing traces using SQL and a web-based UI to visualize and explore multi-GB traces.
See https://perfetto.dev/docs or the /docs/ directory for documentation.