Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Heap Profiling with MemoryInfra | 1 # Heap Profiling with MemoryInfra |
| 2 | 2 |
| 3 As of Chrome 48, MemoryInfra supports heap profiling. The core principle is | 3 As of Chrome 48, MemoryInfra supports heap profiling. The core principle is |
| 4 a solution that JustWorks™ on all platforms without patching or rebuilding, | 4 a solution that JustWorks™ on all platforms without patching or rebuilding, |
| 5 integrated with the chrome://tracing ecosystem. | 5 integrated with the chrome://tracing ecosystem. |
| 6 | 6 |
| 7 [TOC] | 7 [TOC] |
| 8 | 8 |
| 9 ## How to Use | 9 ## How to Use |
| 10 | 10 |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 31 | 31 |
| 32 [memory-infra]: README.md | 32 [memory-infra]: README.md |
| 33 [m-purple]: https://storage.googleapis.com/chromium-docs.appspot.com/d7bd f4d16204c293688be2e5a0bcb2bf463dbbc3 | 33 [m-purple]: https://storage.googleapis.com/chromium-docs.appspot.com/d7bd f4d16204c293688be2e5a0bcb2bf463dbbc3 |
| 34 [cells-heap-dump]: https://storage.googleapis.com/chromium-docs.appspot.com/a24d 80d6a08da088e2e9c8b2b64daa215be4dacb | 34 [cells-heap-dump]: https://storage.googleapis.com/chromium-docs.appspot.com/a24d 80d6a08da088e2e9c8b2b64daa215be4dacb |
| 35 | 35 |
| 36 ### Native stack traces | 36 ### Native stack traces |
| 37 | 37 |
| 38 By default heap profiling collects pseudo allocation traces, which are based | 38 By default heap profiling collects pseudo allocation traces, which are based |
| 39 on trace events. I.e. frames in allocation traces correspond to trace events | 39 on trace events. I.e. frames in allocation traces correspond to trace events |
| 40 that were active at the time of allocations, and are not real function names. | 40 that were active at the time of allocations, and are not real function names. |
| 41 However, you can build a special Linux / Android build that will collect | 41 It's also possible to use heap profiling with native, symbolized stack traces. |
| 42 real C/C++ stack traces. | 42 |
| 43 #### Native stack traces (macOS/Windows) | |
| 44 | |
| 45 1. Navigate to chrome://flags, and set "enable-heap-profiling" to Enabled | |
| 46 (native mode). | |
| 47 | |
| 48 2. Use the [TraceOnTap][extension-link] extension to grab a trace. | |
| 49 | |
| 50 3. Run the following script to symbolize the trace. | |
| 51 | |
| 52 third_party/catapult/tracing/bin/symbolize_trace <trace file> | |
| 53 | |
| 54 4. Load the trace file in `chrome://tracing`. Locate a purple ![M][m-purple] | |
| 55 dot, and continue from step *3* from the instructions above. Native stack | |
| 56 traces will be shown in the _Heap Details_ pane. | |
| 57 | |
| 58 [extension-link]: https://cs.chromium.org/chromium/src/third_party/catapult/expe rimental/trace_on_tap/?q=traceontap+package:%5Echromium$&dr=CSs | |
| 59 | |
| 60 #### Native stack traces (Android/Linux) | |
| 61 | |
| 62 On Linux / Android, you need to build Chromium with special flags to use native | |
|
awong
2017/06/22 21:25:48
You don't need this on Linux... That just turns on
erikchen
2017/06/22 21:35:40
ah, but we don't have symbolization for Linux...Up
| |
| 63 heap profiling. | |
| 43 | 64 |
| 44 1. Build with the following GN flags: | 65 1. Build with the following GN flags: |
| 45 | 66 |
| 46 Linux | 67 Linux |
| 47 | 68 |
| 48 enable_profiling = true | 69 enable_profiling = true |
| 49 | 70 |
| 50 | 71 |
| 51 Android | 72 Android |
| 52 | 73 |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 159 memory allocated by PartitionAlloc alone, the total renderer memory increase was | 180 memory allocated by PartitionAlloc alone, the total renderer memory increase was |
| 160 around 72 MiB.) | 181 around 72 MiB.) |
| 161 | 182 |
| 162 ![Diff of The Verge before and after loading ads][diff] | 183 ![Diff of The Verge before and after loading ads][diff] |
| 163 | 184 |
| 164 [pseudo-stack]: https://storage.googleapis.com/chromium-docs.appspot. com/058e50350836f55724e100d4dbbddf4b9803f550 | 185 [pseudo-stack]: https://storage.googleapis.com/chromium-docs.appspot. com/058e50350836f55724e100d4dbbddf4b9803f550 |
| 165 [break-down-by-backtrace]: https://storage.googleapis.com/chromium-docs.appspot. com/ec61c5f15705f5bcf3ca83a155ed647a0538bbe1 | 186 [break-down-by-backtrace]: https://storage.googleapis.com/chromium-docs.appspot. com/ec61c5f15705f5bcf3ca83a155ed647a0538bbe1 |
| 166 [break-down-by-type]: https://storage.googleapis.com/chromium-docs.appspot. com/2236e61021922c0813908c6745136953fa20a37b | 187 [break-down-by-type]: https://storage.googleapis.com/chromium-docs.appspot. com/2236e61021922c0813908c6745136953fa20a37b |
| 167 [type-then-backtrace]: https://storage.googleapis.com/chromium-docs.appspot. com/c5367dde11476bdbf2d5a1c51674148915573d11 | 188 [type-then-backtrace]: https://storage.googleapis.com/chromium-docs.appspot. com/c5367dde11476bdbf2d5a1c51674148915573d11 |
| 168 [diff]: https://storage.googleapis.com/chromium-docs.appspot. com/802141906869cd533bb613da5f91bd0b071ceb24 | 189 [diff]: https://storage.googleapis.com/chromium-docs.appspot. com/802141906869cd533bb613da5f91bd0b071ceb24 |
| OLD | NEW |