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

Issue 15418002: Record Chrome trace events in tcmalloc heap profiles (Closed)

Created:
7 years, 7 months ago by James Cook
Modified:
7 years, 5 months ago
CC:
chromium-reviews, erikwright+watch_chromium.org, dmikurube+memory_chromium.org, sail+watch_chromium.org, Jorge Lucangeli Obes, darin (slow to review), brettw
Visibility:
Public.

Description

Record Chrome trace events in tcmalloc heap profiles This allows about:tracing to show tcmalloc heap memory allocation over time. The implementation: * Adds a "memory" checkbox to about:tracing * Uses thread-local-storage to store the "stack" of trace events per thread while about:tracing is running. * Introduces a StackGeneratorFunction callback into tcmalloc, allowing it to call back into Chrome to get a "stack" of trace events. * Parses the heap profiler output of tcmalloc and converts it to JSON to be displayed by a visualizer in the about:tracing trace viewer. BUG=243895 TEST=base_unittests TraceMemoryTest.* Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=213473

Patch Set 1 #

Patch Set 2 : cleanup #

Patch Set 3 : chrome works #

Patch Set 4 : json output, but no green dots on trace #

Total comments: 6

Patch Set 5 : still no dots #

Total comments: 1

Patch Set 6 : dots appear in about:tracing #

Patch Set 7 : don't trace the traces #

Patch Set 8 : cleanup, run in all renderers #

Patch Set 9 : only start heap profiling after tracing starts #

Patch Set 10 : rebase #

Patch Set 11 : fix crash in GetPseudoStack, rebase #

Patch Set 12 : add simple ScopedTraceMemory unit test #

Patch Set 13 : increase stack depth, tests need it #

Patch Set 14 : fix deep scope nesting #

Patch Set 15 : rebase #

Patch Set 16 : dump via RepeatingTimer, more tests #

Patch Set 17 : rebase, cleanup #

Total comments: 43

Patch Set 18 : rebase #

Patch Set 19 : review comments part 1, rename to trace_event_memory #

Patch Set 20 : review comments 2 #

Total comments: 7

Patch Set 21 : review comments 3 #

Total comments: 3

Patch Set 22 : review comments 4 #

Total comments: 23

Patch Set 23 : review comments 5 #

Patch Set 24 : rebase, sorry #

Patch Set 25 : New TLS implementation #

Patch Set 26 : . #

Total comments: 16

Patch Set 27 : rebase #

Patch Set 28 : jar review comments #

Patch Set 29 : move to ChildThread #

Total comments: 1

Patch Set 30 : cleanup forward declarations #

Total comments: 3

Patch Set 31 : rebase #

Patch Set 32 : fix comments #

Patch Set 33 : fix tests on unsupported platforms, signed/unsigned conversions #

Patch Set 34 : rebase, message_loop.h moved #

Patch Set 35 : eliminate base to tcmalloc dependency #

Patch Set 36 : fix memory leak, don't enable when tracing record dialog first opens #

Patch Set 37 : Add system stats tracing to Chrome #

Unified diffs Side-by-side diffs Delta from patch set Stats (+273 lines, -1 line) Patch
M base/base.gypi View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 1 chunk +2 lines, -0 lines 0 comments Download
M base/debug/trace_event_impl.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 1 chunk +1 line, -1 line 0 comments Download
A base/debug/trace_event_system.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 1 chunk +70 lines, -0 lines 0 comments Download
A base/debug/trace_event_system.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 1 chunk +195 lines, -0 lines 0 comments Download
M content/browser/browser_main_loop.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 2 chunks +2 lines, -0 lines 0 comments Download
M content/browser/browser_main_loop.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 2 chunks +3 lines, -0 lines 0 comments Download

Messages

Total messages: 52 (0 generated)
nduca
+dsinclair, any idea why the append method isn't being called? James says he verified that ...
7 years, 7 months ago (2013-05-20 23:03:41 UTC) #1
nduca
lgtm ; https://codereview.chromium.org/15418002/diff/8001/chrome/browser/chrome_browser_main_linux.cc File chrome/browser/chrome_browser_main_linux.cc (right): https://codereview.chromium.org/15418002/diff/8001/chrome/browser/chrome_browser_main_linux.cc#newcode148 chrome/browser/chrome_browser_main_linux.cc:148: scoped_ptr<MemoryDumpHolder> dump_holder(new MemoryDumpHolder(dump)); maybe this needs to ...
7 years, 7 months ago (2013-05-20 23:04:44 UTC) #2
nduca
oops
7 years, 7 months ago (2013-05-20 23:04:55 UTC) #3
dsinclair
https://codereview.chromium.org/15418002/diff/8001/chrome/browser/chrome_browser_main_linux.cc File chrome/browser/chrome_browser_main_linux.cc (right): https://codereview.chromium.org/15418002/diff/8001/chrome/browser/chrome_browser_main_linux.cc#newcode143 chrome/browser/chrome_browser_main_linux.cc:143: bool enabled = TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED("tcmalloc2"); On 2013/05/20 23:03:41, nduca wrote: ...
7 years, 7 months ago (2013-05-21 00:32:07 UTC) #4
James Cook
AppendAsTraceFormat is getting called now using PassAs. But still no green dots. https://codereview.chromium.org/15418002/diff/21001/chrome/browser/chrome_browser_main_linux.cc File chrome/browser/chrome_browser_main_linux.cc ...
7 years, 7 months ago (2013-05-21 01:45:41 UTC) #5
nduca
Pop open devtools once about:tracing has finished loading. Are there any javascript console warnings? Or, ...
7 years, 7 months ago (2013-05-21 02:13:54 UTC) #6
James Cook
On 2013/05/21 02:13:54, nduca wrote: > Pop open devtools once about:tracing has finished loading. Are ...
7 years, 7 months ago (2013-05-21 12:40:47 UTC) #7
James Cook
Above problem looks like it was due to a trace viewer issue, it works now.
7 years, 7 months ago (2013-05-24 04:01:54 UTC) #8
James Cook
Nat, PTAL
7 years, 6 months ago (2013-06-17 23:13:52 UTC) #9
dsinclair
https://codereview.chromium.org/15418002/diff/84001/base/debug/trace_memory.cc File base/debug/trace_memory.cc (right): https://codereview.chromium.org/15418002/diff/84001/base/debug/trace_memory.cc#newcode16 base/debug/trace_memory.cc:16: #if !defined(NO_TCMALLOC) && !defined(OS_NACL) && (defined(OS_LINUX) || defined(OS_ANDROID)) Could ...
7 years, 6 months ago (2013-06-18 15:30:15 UTC) #10
Dai Mikurube (NOT FULLTIME)
Some comments in third_party/tcmalloc. https://codereview.chromium.org/15418002/diff/84001/third_party/tcmalloc/chromium/src/gperftools/heap-profiler.h File third_party/tcmalloc/chromium/src/gperftools/heap-profiler.h (right): https://codereview.chromium.org/15418002/diff/84001/third_party/tcmalloc/chromium/src/gperftools/heap-profiler.h#newcode72 third_party/tcmalloc/chromium/src/gperftools/heap-profiler.h:72: * applications that exclusively use ...
7 years, 6 months ago (2013-06-19 04:34:03 UTC) #11
James Cook
Thanks for the feedback, guys! I'm busy with some last minute R29 patches but should ...
7 years, 6 months ago (2013-06-19 14:36:36 UTC) #12
nduca
<3 this patch https://codereview.chromium.org/15418002/diff/84001/base/debug/trace_event.h File base/debug/trace_event.h (right): https://codereview.chromium.org/15418002/diff/84001/base/debug/trace_event.h#newcode231 base/debug/trace_event.h:231: TRACE_MEMORY(category_group, name) \ should we prefix ...
7 years, 6 months ago (2013-06-20 20:09:29 UTC) #13
dsinclair
On 2013/06/20 20:09:29, nduca wrote: > <3 this patch > > https://codereview.chromium.org/15418002/diff/84001/base/debug/trace_event.h > File base/debug/trace_event.h ...
7 years, 6 months ago (2013-06-21 14:35:34 UTC) #14
James Cook
Guys, please take another look. Apologies for the delay - R29 kept me occupied recently. ...
7 years, 5 months ago (2013-06-29 00:02:42 UTC) #15
Dai Mikurube (NOT FULLTIME)
Thanks for working on it, James! Added some more comments. https://codereview.chromium.org/15418002/diff/107001/third_party/tcmalloc/chromium/src/heap-profile-table.cc File third_party/tcmalloc/chromium/src/heap-profile-table.cc (right): https://codereview.chromium.org/15418002/diff/107001/third_party/tcmalloc/chromium/src/heap-profile-table.cc#newcode407 ...
7 years, 5 months ago (2013-07-01 05:47:41 UTC) #16
James Cook
https://codereview.chromium.org/15418002/diff/107001/third_party/tcmalloc/chromium/src/heap-profile-table.cc File third_party/tcmalloc/chromium/src/heap-profile-table.cc (right): https://codereview.chromium.org/15418002/diff/107001/third_party/tcmalloc/chromium/src/heap-profile-table.cc#newcode407 third_party/tcmalloc/chromium/src/heap-profile-table.cc:407: // and increases the size of the profile dumps ...
7 years, 5 months ago (2013-07-01 16:59:16 UTC) #17
James Cook
https://codereview.chromium.org/15418002/diff/107001/third_party/tcmalloc/chromium/src/heap-profile-table.cc File third_party/tcmalloc/chromium/src/heap-profile-table.cc (right): https://codereview.chromium.org/15418002/diff/107001/third_party/tcmalloc/chromium/src/heap-profile-table.cc#newcode407 third_party/tcmalloc/chromium/src/heap-profile-table.cc:407: // and increases the size of the profile dumps ...
7 years, 5 months ago (2013-07-01 22:37:16 UTC) #18
James Cook
Guys, please take another look. https://codereview.chromium.org/15418002/diff/107001/third_party/tcmalloc/chromium/src/heap-profiler.cc File third_party/tcmalloc/chromium/src/heap-profiler.cc (right): https://codereview.chromium.org/15418002/diff/107001/third_party/tcmalloc/chromium/src/heap-profiler.cc#newcode389 third_party/tcmalloc/chromium/src/heap-profiler.cc:389: // so it does ...
7 years, 5 months ago (2013-07-01 23:51:19 UTC) #19
Dai Mikurube (NOT FULLTIME)
I'll say l g t m for the heap-profiler things in tcmalloc/chromium if the /proc/self/maps ...
7 years, 5 months ago (2013-07-02 01:39:06 UTC) #20
nduca
It seems to me that tcmalloc reading /proc isn't required when we're using pseudo stacks. ...
7 years, 5 months ago (2013-07-02 08:01:02 UTC) #21
Dai Mikurube (NOT FULLTIME)
On 2013/07/02 08:01:02, nduca wrote: > It seems to me that tcmalloc reading /proc isn't ...
7 years, 5 months ago (2013-07-02 08:13:42 UTC) #22
nduca
> > about fixing ProcMapsIterator to "fail cleanly" when it cannot open > > /proc/self/maps? ...
7 years, 5 months ago (2013-07-02 08:16:00 UTC) #23
dsinclair
lgtm with a couple nits. https://codereview.chromium.org/15418002/diff/121001/base/debug/trace_event_memory.h File base/debug/trace_event_memory.h (right): https://codereview.chromium.org/15418002/diff/121001/base/debug/trace_event_memory.h#newcode78 base/debug/trace_event_memory.h:78: // to trace event ...
7 years, 5 months ago (2013-07-02 15:27:56 UTC) #24
James Cook
Dai, Nat, please take another look. +jorgelo FYI I replaced the optional pseudo_stack_generator callback with ...
7 years, 5 months ago (2013-07-02 21:17:59 UTC) #25
James Cook
https://codereview.chromium.org/15418002/diff/129001/third_party/tcmalloc/chromium/src/heap-profiler.cc File third_party/tcmalloc/chromium/src/heap-profiler.cc (right): https://codereview.chromium.org/15418002/diff/129001/third_party/tcmalloc/chromium/src/heap-profiler.cc#newcode382 third_party/tcmalloc/chromium/src/heap-profiler.cc:382: int depth = (*stack_generator_function)(skip_count + 1, stack); FYI - ...
7 years, 5 months ago (2013-07-02 21:20:41 UTC) #26
Dai Mikurube (NOT FULLTIME)
I like this patch. lgtm!
7 years, 5 months ago (2013-07-03 03:52:23 UTC) #27
James Cook
jar, can I get OWNERS approval for third_party/tcmalloc/*? This is the first patch towards implementing ...
7 years, 5 months ago (2013-07-03 16:18:36 UTC) #28
jar (doing other things)
A bunch of nits, and a few real questions. https://codereview.chromium.org/15418002/diff/129001/base/debug/trace_event_memory.cc File base/debug/trace_event_memory.cc (right): https://codereview.chromium.org/15418002/diff/129001/base/debug/trace_event_memory.cc#newcode18 base/debug/trace_event_memory.cc:18: ...
7 years, 5 months ago (2013-07-04 02:18:29 UTC) #29
James Cook
jar, please take another look. I had to do a rebase in the middle to ...
7 years, 5 months ago (2013-07-08 23:21:33 UTC) #30
jar (doing other things)
Mostly nits... https://codereview.chromium.org/15418002/diff/159001/base/debug/trace_event_memory.cc File base/debug/trace_event_memory.cc (right): https://codereview.chromium.org/15418002/diff/159001/base/debug/trace_event_memory.cc#newcode64 base/debug/trace_event_memory.cc:64: int index_; nit: better is size_t https://codereview.chromium.org/15418002/diff/159001/base/debug/trace_event_memory.cc#newcode253 ...
7 years, 5 months ago (2013-07-12 01:24:26 UTC) #31
James Cook
jar, please take another look https://codereview.chromium.org/15418002/diff/159001/base/debug/trace_event_memory.cc File base/debug/trace_event_memory.cc (right): https://codereview.chromium.org/15418002/diff/159001/base/debug/trace_event_memory.cc#newcode64 base/debug/trace_event_memory.cc:64: int index_; On 2013/07/12 ...
7 years, 5 months ago (2013-07-12 17:40:26 UTC) #32
James Cook
piman, can I get OWNERS approval for content/* ? I'm adding an observer for the ...
7 years, 5 months ago (2013-07-12 17:41:03 UTC) #33
piman
2 questions, otherwise the patch seems reasonable: 1- what does it mean to instantiate a ...
7 years, 5 months ago (2013-07-12 18:02:36 UTC) #34
James Cook
Addressing piman's comments: > 1- what does it mean to instantiate a TraceMemoryController? Since it's ...
7 years, 5 months ago (2013-07-12 18:50:31 UTC) #35
piman
lgtm https://codereview.chromium.org/15418002/diff/183001/content/renderer/render_thread_impl.h File content/renderer/render_thread_impl.h (right): https://codereview.chromium.org/15418002/diff/183001/content/renderer/render_thread_impl.h#newcode51 content/renderer/render_thread_impl.h:51: class TraceMemoryController; nit: you don't need this any ...
7 years, 5 months ago (2013-07-12 19:15:26 UTC) #36
jar (doing other things)
Brett/Darin: Do you know what the style guide advocates for the issue below? I suspect ...
7 years, 5 months ago (2013-07-13 00:51:08 UTC) #37
James Cook
https://codereview.chromium.org/15418002/diff/188001/base/debug/trace_event.h File base/debug/trace_event.h (right): https://codereview.chromium.org/15418002/diff/188001/base/debug/trace_event.h#newcode242 base/debug/trace_event.h:242: #define TRACING_IS_OFFICIAL_BUILD 0 On 2013/07/13 00:51:08, jar wrote: > ...
7 years, 5 months ago (2013-07-15 16:58:26 UTC) #38
nduca
I think it is fine to proceed using the style of the module. We can ...
7 years, 5 months ago (2013-07-15 18:42:55 UTC) #39
jar (doing other things)
LGTM with the one nit below. Thanks. https://codereview.chromium.org/15418002/diff/188001/base/debug/trace_event.h File base/debug/trace_event.h (right): https://codereview.chromium.org/15418002/diff/188001/base/debug/trace_event.h#newcode242 base/debug/trace_event.h:242: #define TRACING_IS_OFFICIAL_BUILD ...
7 years, 5 months ago (2013-07-16 22:54:47 UTC) #40
nduca
lgtm
7 years, 5 months ago (2013-07-17 17:31:14 UTC) #41
darin (slow to review)
Yeah, I don't think we have a style rule here. In my experience, the #if ...
7 years, 5 months ago (2013-07-17 17:43:46 UTC) #42
James Cook
Filed https://code.google.com/p/chromium/issues/detail?id=261382 to track the OFFICIAL_BUILD macro cleanup.
7 years, 5 months ago (2013-07-17 22:57:19 UTC) #43
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/jamescook@chromium.org/15418002/212001
7 years, 5 months ago (2013-07-17 23:16:15 UTC) #44
commit-bot: I haz the power
Step "update" is always a major failure. Look at the try server FAQ for more ...
7 years, 5 months ago (2013-07-18 00:21:51 UTC) #45
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/jamescook@chromium.org/15418002/229001
7 years, 5 months ago (2013-07-18 21:30:09 UTC) #46
commit-bot: I haz the power
Sorry for I got bad news for ya. Compile failed with a clobber build on ...
7 years, 5 months ago (2013-07-18 22:31:40 UTC) #47
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/jamescook@chromium.org/15418002/248002
7 years, 5 months ago (2013-07-18 23:15:01 UTC) #48
commit-bot: I haz the power
Retried try job too often on linux_chromeos for step(s) cacheinvalidation_unittests, dbus_unittests http://build.chromium.org/p/tryserver.chromium/buildstatus?builder=linux_chromeos&number=137209
7 years, 5 months ago (2013-07-19 00:23:38 UTC) #49
nduca
lgtm
7 years, 5 months ago (2013-07-22 23:37:46 UTC) #50
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/jamescook@chromium.org/15418002/286001
7 years, 5 months ago (2013-07-24 17:26:59 UTC) #51
commit-bot: I haz the power
7 years, 5 months ago (2013-07-24 18:38:31 UTC) #52
Message was sent while issue was closed.
Change committed as 213473

Powered by Google App Engine
This is Rietveld 408576698