Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(179)

Side by Side Diff: components/tracing/docs/heap_profiler.md

Issue 2084973002: [Docs] Add native heap profiling instructions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 intergrated with the chrome://tracing ecosystem. 5 intergrated with the chrome://tracing ecosystem.
6 6
7 [TOC] 7 [TOC]
8 8
9 ## How to Use 9 ## How to Use
10 10
(...skipping 15 matching lines...) Expand all
26 ![Cells containing a heap dump][cells-heap-dump] 26 ![Cells containing a heap dump][cells-heap-dump]
27 27
28 5. Scroll down all the way to _Heap Details_. 28 5. Scroll down all the way to _Heap Details_.
29 29
30 6. Pinpoint the memory bug and live happily ever after. 30 6. Pinpoint the memory bug and live happily ever after.
31 31
32 [memory-infra]: memory_infra.md 32 [memory-infra]: memory_infra.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
37
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
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
42 real C/C++ stack traces.
43
44 1. Build with the following GN flags:
45
46 Linux
47
48 enable_profiling = true
Primiano Tucci (use gerrit) 2016/06/30 14:45:47 Should we suggest also enable_full_stack_frames_f
49
50
51 Android
52
53 arm_use_thumb = false
54 enable_profiling = true
55
56 2. Start Chrome with `--enable-heap-profiling=native` switch (notice
57 `=native` part).
58
59 On Android use the command line tool before starting the app:
60
61 build/android/adb_chrome_public_command_line --enable-heap-profiling=nat ive
62
63 (run the tool with an empty argument `''` to clear the command line)
64
65 3. Grab a [MemoryInfra][memory-infra] trace. You don't need any other
66 categories besides `memory-infra`.
67
68 4. Save the grabbed trace file. This step is needed because freshly
69 taken trace file contains raw addresses (which look like `pc:dcf5dbf8`)
70 instead of function names, and needs to be symbolized.
71
72 4. Symbolize the trace file. During symbolization addresses are resolved to
73 the corresponding function names and trace file is rewritten (but a back up
74 is saved with `.BACKUP` extension).
75
76 Linux
77
78 third_party/catapult/tracing/bin/symbolize_trace <trace file>
79
80 Android
81
82 third_party/catapult/tracing/bin/symbolize_trace --output-directory out/ Release <trace file>
83
84 (note `--output-directory` and make sure it's right for your setup)
Primiano Tucci (use gerrit) 2016/06/30 14:45:47 I think this note is really redundant :)
85
86 5. Load the trace file in `chrome://tracing`. Locate a purple ![M][m-purple]
87 dot, and continue from step *3* from the instructions above. Native stac k
88 traces will be shown in the _Heap Details_ pane.
89
36 ## Heap Details 90 ## Heap Details
37 91
38 The heap details view contains a tree that represents the heap. The size of the 92 The heap details view contains a tree that represents the heap. The size of the
39 root node corresponds to the selected allocator cell. 93 root node corresponds to the selected allocator cell.
40 94
41 *** aside 95 *** aside
42 The size value in the heap details view will not match the value in the selected 96 The size value in the heap details view will not match the value in the selected
43 analysis view cell exactly. There are three reasons for this. First, the heap 97 analysis view cell exactly. There are three reasons for this. First, the heap
44 profiler reports the memory that _the program requested_, whereas the allocator 98 profiler reports the memory that _the program requested_, whereas the allocator
45 reports the memory that it _actually allocated_ plus its own bookkeeping 99 reports the memory that it _actually allocated_ plus its own bookkeeping
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 memory allocated by PartitionAlloc alone, the total renderer memory increase was 159 memory allocated by PartitionAlloc alone, the total renderer memory increase was
106 around 72 MiB.) 160 around 72 MiB.)
107 161
108 ![Diff of The Verge before and after loading ads][diff] 162 ![Diff of The Verge before and after loading ads][diff]
109 163
110 [pseudo-stack]: https://storage.googleapis.com/chromium-docs.appspot. com/058e50350836f55724e100d4dbbddf4b9803f550 164 [pseudo-stack]: https://storage.googleapis.com/chromium-docs.appspot. com/058e50350836f55724e100d4dbbddf4b9803f550
111 [break-down-by-backtrace]: https://storage.googleapis.com/chromium-docs.appspot. com/ec61c5f15705f5bcf3ca83a155ed647a0538bbe1 165 [break-down-by-backtrace]: https://storage.googleapis.com/chromium-docs.appspot. com/ec61c5f15705f5bcf3ca83a155ed647a0538bbe1
112 [break-down-by-type]: https://storage.googleapis.com/chromium-docs.appspot. com/2236e61021922c0813908c6745136953fa20a37b 166 [break-down-by-type]: https://storage.googleapis.com/chromium-docs.appspot. com/2236e61021922c0813908c6745136953fa20a37b
113 [type-then-backtrace]: https://storage.googleapis.com/chromium-docs.appspot. com/c5367dde11476bdbf2d5a1c51674148915573d11 167 [type-then-backtrace]: https://storage.googleapis.com/chromium-docs.appspot. com/c5367dde11476bdbf2d5a1c51674148915573d11
114 [diff]: https://storage.googleapis.com/chromium-docs.appspot. com/802141906869cd533bb613da5f91bd0b071ceb24 168 [diff]: https://storage.googleapis.com/chromium-docs.appspot. com/802141906869cd533bb613da5f91bd0b071ceb24
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698