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

Issue 1555553002: [profiler] Implement POC Sampling Heap Profiler (Closed)

Created:
4 years, 11 months ago by ofrobots
Modified:
4 years, 11 months ago
CC:
Hannes Payer (out of office), Paweł Hajdan Jr., ulan, v8-reviews_googlegroups.com
Base URL:
https://chromium.googlesource.com/v8/v8.git@master
Target Ref:
refs/pending/heads/master
Project:
v8
Visibility:
Public.

Description

[profiler] Implement POC Sampling Heap Profiler This implements a proof-of-concept sampling based heap profiler inspired by tcmalloc's heap profiler [1] and Go's mprof/memprofile [2]. The basic idea is the sample allocations using a randomized Poisson process. At any point in time we can cheaply request the set of live sample objects that should be a representative sample of heap. Samples include stack-traces from the allocation sites, making this an effective tool for memory leak debugging. Unlike AllocationTracking, this is intended to be cheap and usable online in production. The proof-of-concept is only sampling new-space allocations at this point. Support for sampling paged space and native allocations is anticipated in the future. [1] http://goog-perftools.sourceforge.net/doc/heap_profiler.html [2] http://blog.golang.org/profiling-go-programs Committed: https://crrev.com/e5a9947811db9c9e23557dbad27f8b8a349b3262 Cr-Commit-Position: refs/heads/master@{#33448}

Patch Set 1 #

Patch Set 2 : cleanup samples when sampling heap profiler is stopped #

Total comments: 5

Patch Set 3 : switch from JSON to a C++ api #

Patch Set 4 : Flesh out tests. Switch to a call-graph based API similar to cpu profiler. #

Patch Set 5 : name strings cannot be null strings anymore #

Patch Set 6 : fix warning + minor cleanup in AllocateNode #

Total comments: 2

Patch Set 7 : remove commented code #

Total comments: 18

Patch Set 8 : return profile as a transferred pointer - cannot move due to various c++11 issues #

Patch Set 9 : address code review comments from alph@ #

Patch Set 10 : increase sampling frequency in tests to reduce random chance failure likelihood #

Total comments: 39

Patch Set 11 : address round 2 comments from alph@ #

Total comments: 1

Patch Set 12 : remove unused variable #

Unified diffs Side-by-side diffs Delta from patch set Stats (+770 lines, -50 lines) Patch
M BUILD.gn View 1 chunk +2 lines, -0 lines 0 comments Download
M include/v8-profiler.h View 1 2 3 4 5 6 7 8 9 10 2 chunks +127 lines, -0 lines 0 comments Download
M src/api.cc View 1 2 3 4 5 6 7 8 1 chunk +17 lines, -0 lines 0 comments Download
M src/heap/heap.h View 1 2 3 2 chunks +55 lines, -0 lines 0 comments Download
M src/heap/incremental-marking.h View 1 2 3 1 chunk +1 line, -0 lines 0 comments Download
M src/heap/spaces.h View 1 2 3 2 chunks +1 line, -48 lines 0 comments Download
M src/isolate.cc View 1 chunk +3 lines, -2 lines 0 comments Download
M src/profiler/heap-profiler.h View 1 2 3 4 5 6 7 3 chunks +6 lines, -0 lines 0 comments Download
M src/profiler/heap-profiler.cc View 1 2 3 4 5 6 7 8 9 10 2 chunks +26 lines, -0 lines 0 comments Download
A src/profiler/sampling-heap-profiler.h View 1 2 3 4 5 6 7 8 9 10 1 chunk +135 lines, -0 lines 0 comments Download
A src/profiler/sampling-heap-profiler.cc View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +250 lines, -0 lines 0 comments Download
M test/cctest/test-heap-profiler.cc View 1 2 3 4 5 6 7 8 9 10 1 chunk +145 lines, -0 lines 0 comments Download
M tools/gyp/v8.gyp View 1 chunk +2 lines, -0 lines 0 comments Download

Messages

Total messages: 47 (15 generated)
ofrobots
On 2015/12/29 16:49:53, ofrobots wrote: > mailto:ofrobots@google.com changed reviewers: > + mailto:hpayer@chromium.org, mailto:jochen@chromium.org, mailto:yangguo@chromium.org This ...
4 years, 11 months ago (2015-12-29 16:51:42 UTC) #3
Yang
https://codereview.chromium.org/1555553002/diff/20001/include/v8-profiler.h File include/v8-profiler.h (right): https://codereview.chromium.org/1555553002/diff/20001/include/v8-profiler.h#newcode529 include/v8-profiler.h:529: * currently live in the system. Each sampled allocation ...
4 years, 11 months ago (2016-01-07 06:14:10 UTC) #5
ofrobots
https://codereview.chromium.org/1555553002/diff/20001/include/v8-profiler.h File include/v8-profiler.h (right): https://codereview.chromium.org/1555553002/diff/20001/include/v8-profiler.h#newcode529 include/v8-profiler.h:529: * currently live in the system. Each sampled allocation ...
4 years, 11 months ago (2016-01-07 06:49:30 UTC) #6
jochen (gone - plz use gerrit)
https://codereview.chromium.org/1555553002/diff/20001/include/v8-profiler.h File include/v8-profiler.h (right): https://codereview.chromium.org/1555553002/diff/20001/include/v8-profiler.h#newcode529 include/v8-profiler.h:529: * currently live in the system. Each sampled allocation ...
4 years, 11 months ago (2016-01-07 10:29:34 UTC) #7
ofrobots
On 2016/01/07 10:29:34, jochen wrote: > https://codereview.chromium.org/1555553002/diff/20001/include/v8-profiler.h > File include/v8-profiler.h (right): > > https://codereview.chromium.org/1555553002/diff/20001/include/v8-profiler.h#newcode529 > ...
4 years, 11 months ago (2016-01-07 14:04:47 UTC) #8
jochen (gone - plz use gerrit)
On 2016/01/07 at 14:04:47, ofrobots wrote: > On 2016/01/07 10:29:34, jochen wrote: > > https://codereview.chromium.org/1555553002/diff/20001/include/v8-profiler.h ...
4 years, 11 months ago (2016-01-07 14:06:03 UTC) #9
noordhuis
On 2016/01/07 06:49:30, ofrobots wrote: > I chose the present format (JSON string pushed to ...
4 years, 11 months ago (2016-01-07 15:31:59 UTC) #10
ofrobots
On 2016/01/07 15:31:59, noordhuis wrote: > On 2016/01/07 06:49:30, ofrobots wrote: > > I chose ...
4 years, 11 months ago (2016-01-08 01:53:11 UTC) #11
ofrobots
On 2016/01/07 14:06:03, jochen wrote: > On 2016/01/07 at 14:04:47, ofrobots wrote: > > On ...
4 years, 11 months ago (2016-01-08 01:54:56 UTC) #12
ofrobots
This is ready for review.
4 years, 11 months ago (2016-01-14 19:15:15 UTC) #13
jochen (gone - plz use gerrit)
I defer to Yang and Hannes
4 years, 11 months ago (2016-01-15 14:39:22 UTC) #14
Yang
On 2016/01/15 14:39:22, jochen wrote: > I defer to Yang and Hannes I've been busy ...
4 years, 11 months ago (2016-01-15 15:29:06 UTC) #15
Hannes Payer (out of office)
LGTM from the GC side https://codereview.chromium.org/1555553002/diff/100001/test/cctest/test-heap-profiler.cc File test/cctest/test-heap-profiler.cc (right): https://codereview.chromium.org/1555553002/diff/100001/test/cctest/test-heap-profiler.cc#newcode2876 test/cctest/test-heap-profiler.cc:2876: // static void PrintNode(const ...
4 years, 11 months ago (2016-01-19 08:44:08 UTC) #16
Yang
LGTM as well. https://codereview.chromium.org/1555553002/diff/100001/test/cctest/test-heap-profiler.cc File test/cctest/test-heap-profiler.cc (right): https://codereview.chromium.org/1555553002/diff/100001/test/cctest/test-heap-profiler.cc#newcode2876 test/cctest/test-heap-profiler.cc:2876: // static void PrintNode(const v8::AllocationProfile::Node* node, ...
4 years, 11 months ago (2016-01-19 12:33:34 UTC) #17
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1555553002/120001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1555553002/120001
4 years, 11 months ago (2016-01-19 19:36:44 UTC) #19
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: v8_win_compile_dbg on tryserver.v8 (JOB_FAILED, http://build.chromium.org/p/tryserver.v8/builders/v8_win_compile_dbg/builds/12064)
4 years, 11 months ago (2016-01-19 19:40:26 UTC) #21
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1555553002/140001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1555553002/140001
4 years, 11 months ago (2016-01-19 23:00:02 UTC) #23
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: v8_win_nosnap_shared_compile_rel on tryserver.v8 (JOB_FAILED, http://build.chromium.org/p/tryserver.v8/builders/v8_win_nosnap_shared_compile_rel/builds/9245)
4 years, 11 months ago (2016-01-19 23:11:40 UTC) #25
alph
https://codereview.chromium.org/1555553002/diff/120001/include/v8-profiler.h File include/v8-profiler.h (right): https://codereview.chromium.org/1555553002/diff/120001/include/v8-profiler.h#newcode515 include/v8-profiler.h:515: std::deque<Node> nodes; Can you move it to the implementation ...
4 years, 11 months ago (2016-01-19 23:43:57 UTC) #26
ofrobots
alph@ PTAL. https://codereview.chromium.org/1555553002/diff/120001/include/v8-profiler.h File include/v8-profiler.h (right): https://codereview.chromium.org/1555553002/diff/120001/include/v8-profiler.h#newcode515 include/v8-profiler.h:515: std::deque<Node> nodes; On 2016/01/19 23:43:57, alph wrote: ...
4 years, 11 months ago (2016-01-20 02:14:50 UTC) #27
ofrobots
https://codereview.chromium.org/1555553002/diff/120001/src/profiler/sampling-heap-profiler.cc File src/profiler/sampling-heap-profiler.cc (right): https://codereview.chromium.org/1555553002/diff/120001/src/profiler/sampling-heap-profiler.cc#newcode71 src/profiler/sampling-heap-profiler.cc:71: // We sample with a Poisson process, with constant ...
4 years, 11 months ago (2016-01-20 02:21:46 UTC) #28
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1555553002/160001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1555553002/160001
4 years, 11 months ago (2016-01-20 02:23:27 UTC) #30
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: v8_android_arm_compile_rel on tryserver.v8 (JOB_FAILED, http://build.chromium.org/p/tryserver.v8/builders/v8_android_arm_compile_rel/builds/12262)
4 years, 11 months ago (2016-01-20 02:29:27 UTC) #32
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1555553002/180001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1555553002/180001
4 years, 11 months ago (2016-01-20 04:07:29 UTC) #34
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: v8_android_arm_compile_rel on tryserver.v8 (JOB_FAILED, http://build.chromium.org/p/tryserver.v8/builders/v8_android_arm_compile_rel/builds/12264)
4 years, 11 months ago (2016-01-20 04:14:34 UTC) #36
alph
Thank you. Great work! Some more comments below. https://codereview.chromium.org/1555553002/diff/180001/include/v8-profiler.h File include/v8-profiler.h (right): https://codereview.chromium.org/1555553002/diff/180001/include/v8-profiler.h#newcode8 include/v8-profiler.h:8: #include ...
4 years, 11 months ago (2016-01-20 23:13:01 UTC) #37
ofrobots
https://codereview.chromium.org/1555553002/diff/180001/include/v8-profiler.h File include/v8-profiler.h (right): https://codereview.chromium.org/1555553002/diff/180001/include/v8-profiler.h#newcode8 include/v8-profiler.h:8: #include <string> On 2016/01/20 23:13:01, alph wrote: > not ...
4 years, 11 months ago (2016-01-21 03:03:28 UTC) #38
alph
Thanks a lot! lgtm https://codereview.chromium.org/1555553002/diff/180001/src/profiler/sampling-heap-profiler.cc File src/profiler/sampling-heap-profiler.cc (right): https://codereview.chromium.org/1555553002/diff/180001/src/profiler/sampling-heap-profiler.cc#newcode84 src/profiler/sampling-heap-profiler.cc:84: : (next > INTPTR_MAX ? ...
4 years, 11 months ago (2016-01-21 03:21:55 UTC) #39
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1555553002/220001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1555553002/220001
4 years, 11 months ago (2016-01-21 20:48:44 UTC) #42
commit-bot: I haz the power
Committed patchset #12 (id:220001)
4 years, 11 months ago (2016-01-21 21:13:34 UTC) #44
commit-bot: I haz the power
Patchset 12 (id:??) landed as https://crrev.com/e5a9947811db9c9e23557dbad27f8b8a349b3262 Cr-Commit-Position: refs/heads/master@{#33448}
4 years, 11 months ago (2016-01-21 21:13:54 UTC) #46
ofrobots
4 years, 11 months ago (2016-01-21 21:53:14 UTC) #47
Message was sent while issue was closed.
A revert of this CL (patchset #12 id:220001) has been created in
https://codereview.chromium.org/1615173002/ by ofrobots@google.com.

The reason for reverting is: The random nature of the tests caused the following
buildbot to fail:
https://build.chromium.org/p/client.v8/builders/V8%20Linux%20gcc%204.8/builds....

Powered by Google App Engine
This is Rietveld 408576698