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

Issue 1922303002: Create libsampler as V8 sampler library. (Closed)

Created:
4 years, 8 months ago by lpy
Modified:
4 years, 7 months ago
CC:
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

Reland: Create libsampler as V8 sampler library. This patch does five things: 1. Extracts sampler as libsampler to provide sampling functionality support. 2. Makes SampleStack virtual so embedders can override the behaviour of sample collecting. 3. Removes sampler.[h|cc]. 4. Moves sampling thread into log.cc as workaround to keep the --prof functionality. 5. Creates SamplerManager to manage the relationship between samplers and threads. The reason we port hashmap.h is that in debug mode, STL containers are using mutexes from a mutex pool, which may lead to deadlock when using asynchronously signal handler. Currently libsampler is used in V8 temporarily. BUG=v8:4789 LOG=n Committed: https://crrev.com/06cc9b7c176a6223971deaa9fbcafe1a05058c7b Cr-Commit-Position: refs/heads/master@{#36527} Committed: https://crrev.com/a0198c0f627de392280f00099333f96ee34d2519 Cr-Commit-Position: refs/heads/master@{#36532}

Patch Set 1 #

Patch Set 2 : #

Total comments: 8

Patch Set 3 : #

Total comments: 6

Patch Set 4 : #

Total comments: 8

Patch Set 5 : #

Total comments: 1

Patch Set 6 : Rebase #

Total comments: 2

Patch Set 7 : Add BUILD.gn target, address jochen's comment, rebase. #

Patch Set 8 : #

Patch Set 9 : update test #

Total comments: 4

Patch Set 10 : Add v8 dependency for libsampler in v8.gyp, rebased #

Patch Set 11 : Move sampling thread to log.cc, use libsampler in v8 as workaround, delete sampler.[h|cc] #

Patch Set 12 : Fix windows build failure. #

Patch Set 13 : Fix GN build with Chrome #

Patch Set 14 : #

Patch Set 15 : Use LazyInstance for std::map, fix static-initializer check #

Patch Set 16 : Switch list to vector #

Patch Set 17 : Port hashmap #

Patch Set 18 : #

Patch Set 19 : #

Total comments: 12

Patch Set 20 : #

Patch Set 21 : Address alph's comments #

Patch Set 22 : Fix ASAN failure #

Patch Set 23 : #

Total comments: 6

Patch Set 24 : Address alph's comment #

Total comments: 1

Patch Set 25 : Fix TSAN failure #

Unified diffs Side-by-side diffs Delta from patch set Stats (+581 lines, -1485 lines) Patch
M BUILD.gn 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 4 chunks +23 lines, -2 lines 0 comments Download
M include/v8.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 chunk +6 lines, -0 lines 0 comments Download
M src/api.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 1 chunk +6 lines, -0 lines 0 comments Download
M src/isolate.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 2 chunks +2 lines, -2 lines 0 comments Download
A + src/libsampler/DEPS View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 chunk +3 lines, -4 lines 0 comments Download
A + src/libsampler/hashmap.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 10 chunks +36 lines, -114 lines 0 comments Download
A + src/libsampler/utils.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 chunk +20 lines, -15 lines 0 comments Download
A + src/libsampler/v8-sampler.h View 1 2 3 4 5 6 7 8 9 10 5 chunks +18 lines, -23 lines 0 comments Download
A + src/libsampler/v8-sampler.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 14 chunks +217 lines, -366 lines 0 comments Download
M src/log.h View 1 2 3 4 5 6 7 8 9 10 3 chunks +5 lines, -2 lines 0 comments Download
M src/log.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 5 chunks +59 lines, -9 lines 0 comments Download
M src/profiler/cpu-profiler.h View 1 2 3 4 5 6 7 8 9 10 3 chunks +3 lines, -3 lines 0 comments Download
M src/profiler/cpu-profiler.cc View 1 2 3 4 5 6 7 8 9 10 3 chunks +4 lines, -3 lines 0 comments Download
D src/profiler/sampler.h View 1 2 3 4 5 6 7 8 9 10 1 chunk +0 lines, -108 lines 0 comments Download
D src/profiler/sampler.cc View 1 2 3 4 5 6 7 8 9 10 1 chunk +0 lines, -828 lines 0 comments Download
M src/v8.cc View 1 2 3 4 5 6 7 8 9 10 3 chunks +3 lines, -3 lines 0 comments Download
M src/v8.gyp 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 3 chunks +33 lines, -2 lines 0 comments Download
M test/cctest/cctest.gyp 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 1 chunk +1 line, -0 lines 0 comments Download
A test/cctest/libsampler/test-sampler.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 chunk +141 lines, -0 lines 0 comments Download
M test/cctest/test-cpu-profiler.cc View 1 2 3 4 5 6 7 8 9 10 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 64 (19 generated)
fmeawad
Some comments. https://codereview.chromium.org/1922303002/diff/20001/src/libsampler/v8-sampler.cc File src/libsampler/v8-sampler.cc (right): https://codereview.chromium.org/1922303002/diff/20001/src/libsampler/v8-sampler.cc#newcode235 src/libsampler/v8-sampler.cc:235: class SamplerManager { maybe SamplingManager? https://codereview.chromium.org/1922303002/diff/20001/src/libsampler/v8-sampler.h File ...
4 years, 7 months ago (2016-05-02 23:14:37 UTC) #3
lpy
alph@, jochen@, PTAL.
4 years, 7 months ago (2016-05-03 17:16:06 UTC) #5
alph
It's better to not put four things into one patch, but rather have four patches. ...
4 years, 7 months ago (2016-05-03 18:48:07 UTC) #6
lpy
PTAL. https://codereview.chromium.org/1922303002/diff/20001/include/v8.h File include/v8.h (right): https://codereview.chromium.org/1922303002/diff/20001/include/v8.h#newcode6300 include/v8.h:6300: * Check if this isolate is in use. ...
4 years, 7 months ago (2016-05-04 00:09:24 UTC) #7
lpy
On 2016/05/03 18:48:07, alph wrote: > It's better to not put four things into one ...
4 years, 7 months ago (2016-05-04 00:14:57 UTC) #8
alph
https://codereview.chromium.org/1922303002/diff/40001/src/libsampler/v8-sampler.cc File src/libsampler/v8-sampler.cc (right): https://codereview.chromium.org/1922303002/diff/40001/src/libsampler/v8-sampler.cc#newcode419 src/libsampler/v8-sampler.cc:419: SignalHandler::FillRegisterState(context, state); still it is possible to move this ...
4 years, 7 months ago (2016-05-04 00:20:18 UTC) #9
lpy
Thanks. PTAL. https://codereview.chromium.org/1922303002/diff/40001/src/libsampler/v8-sampler.cc File src/libsampler/v8-sampler.cc (right): https://codereview.chromium.org/1922303002/diff/40001/src/libsampler/v8-sampler.cc#newcode419 src/libsampler/v8-sampler.cc:419: SignalHandler::FillRegisterState(context, state); On 2016/05/04 00:20:18, alph wrote: ...
4 years, 7 months ago (2016-05-04 00:56:09 UTC) #10
jochen (gone - plz use gerrit)
I like this direction a lot! I wonder whether libsampler should control spin up the ...
4 years, 7 months ago (2016-05-04 07:29:07 UTC) #12
lpy
PTAL. Replaced list and hash map with STL. https://codereview.chromium.org/1922303002/diff/60001/src/libsampler/v8-sampler.cc File src/libsampler/v8-sampler.cc (left): https://codereview.chromium.org/1922303002/diff/60001/src/libsampler/v8-sampler.cc#oldcode5 src/libsampler/v8-sampler.cc:5: #include ...
4 years, 7 months ago (2016-05-05 22:24:17 UTC) #13
alph
On 2016/05/04 00:14:57, lpy wrote: > On 2016/05/03 18:48:07, alph wrote: > > It's better ...
4 years, 7 months ago (2016-05-05 22:39:09 UTC) #14
lpy
On 2016/05/05 22:39:09, alph wrote: > On 2016/05/04 00:14:57, lpy wrote: > > On 2016/05/03 ...
4 years, 7 months ago (2016-05-05 22:55:15 UTC) #15
alph
On 2016/05/05 22:55:15, lpy wrote: > On 2016/05/05 22:39:09, alph wrote: > > On 2016/05/04 ...
4 years, 7 months ago (2016-05-05 23:09:53 UTC) #16
jochen (gone - plz use gerrit)
On 2016/05/05 at 23:09:53, alph wrote: > On 2016/05/05 22:55:15, lpy wrote: > > On ...
4 years, 7 months ago (2016-05-06 09:43:41 UTC) #17
lpy
> btw, shouldn't we finally switch chrome over to the new api? I am confused ...
4 years, 7 months ago (2016-05-06 17:41:10 UTC) #18
alph
On 2016/05/06 17:41:10, lpy wrote: > > btw, shouldn't we finally switch chrome over to ...
4 years, 7 months ago (2016-05-06 19:28:38 UTC) #19
alph
https://codereview.chromium.org/1922303002/diff/80001/src/libsampler/v8-sampler.cc File src/libsampler/v8-sampler.cc (right): https://codereview.chromium.org/1922303002/diff/80001/src/libsampler/v8-sampler.cc#newcode365 src/libsampler/v8-sampler.cc:365: SamplerManager::sampler_map_.find(thread_id); Wasn't there an issue with a deadlock in ...
4 years, 7 months ago (2016-05-06 19:33:19 UTC) #20
lpy
On 2016/05/06 19:33:19, alph wrote: > https://codereview.chromium.org/1922303002/diff/80001/src/libsampler/v8-sampler.cc > File src/libsampler/v8-sampler.cc (right): > > https://codereview.chromium.org/1922303002/diff/80001/src/libsampler/v8-sampler.cc#newcode365 > ...
4 years, 7 months ago (2016-05-06 19:38:06 UTC) #21
alph
On 2016/05/06 19:38:06, lpy wrote: > On 2016/05/06 19:33:19, alph wrote: > > > https://codereview.chromium.org/1922303002/diff/80001/src/libsampler/v8-sampler.cc ...
4 years, 7 months ago (2016-05-06 22:33:25 UTC) #22
lpy
On 2016/05/06 22:33:25, alph wrote: > On 2016/05/06 19:38:06, lpy wrote: > > On 2016/05/06 ...
4 years, 7 months ago (2016-05-06 23:03:08 UTC) #23
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1922303002/100001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1922303002/100001
4 years, 7 months ago (2016-05-09 17:01:22 UTC) #25
commit-bot: I haz the power
Dry run: This issue passed the CQ dry run.
4 years, 7 months ago (2016-05-09 17:31:33 UTC) #27
jochen (gone - plz use gerrit)
can you add a BUILD.gn target as well please? https://codereview.chromium.org/1922303002/diff/100001/src/v8.gyp File src/v8.gyp (right): https://codereview.chromium.org/1922303002/diff/100001/src/v8.gyp#newcode1932 src/v8.gyp:1932: ...
4 years, 7 months ago (2016-05-10 11:52:41 UTC) #28
lpy
PTAL. https://codereview.chromium.org/1922303002/diff/100001/src/v8.gyp File src/v8.gyp (right): https://codereview.chromium.org/1922303002/diff/100001/src/v8.gyp#newcode1932 src/v8.gyp:1932: 'v8_base', On 2016/05/10 11:52:40, jochen wrote: > you ...
4 years, 7 months ago (2016-05-10 18:27:34 UTC) #29
jochen (gone - plz use gerrit)
https://codereview.chromium.org/1922303002/diff/160001/BUILD.gn File BUILD.gn (right): https://codereview.chromium.org/1922303002/diff/160001/BUILD.gn#newcode2022 BUILD.gn:2022: ":v8_libbase", should also depend on v8 https://codereview.chromium.org/1922303002/diff/160001/src/v8.gyp File src/v8.gyp ...
4 years, 7 months ago (2016-05-11 08:54:40 UTC) #30
lpy
PTAL. https://codereview.chromium.org/1922303002/diff/160001/BUILD.gn File BUILD.gn (right): https://codereview.chromium.org/1922303002/diff/160001/BUILD.gn#newcode2022 BUILD.gn:2022: ":v8_libbase", On 2016/05/11 08:54:40, jochen (soon OOO) wrote: ...
4 years, 7 months ago (2016-05-11 20:57:30 UTC) #31
lpy
I made a few changes, the main changes is: 1. Deleted sampler.[h|cc] 2. Used libsampler ...
4 years, 7 months ago (2016-05-18 20:43:51 UTC) #32
lpy
There's deadlock happening on debug build, and it is happening on two different STL container ...
4 years, 7 months ago (2016-05-19 01:03:12 UTC) #33
alph
On 2016/05/19 01:03:12, lpy wrote: > There's deadlock happening on debug build, and it is ...
4 years, 7 months ago (2016-05-19 21:49:07 UTC) #35
lpy
On 2016/05/19 21:49:07, alph wrote: > On 2016/05/19 01:03:12, lpy wrote: > > There's deadlock ...
4 years, 7 months ago (2016-05-20 17:05:21 UTC) #36
lpy
By moving `sampling_thread_->Join` out of the destructor of Ticker, the compilation on Windows won't hang, ...
4 years, 7 months ago (2016-05-22 05:15:07 UTC) #37
alph
I still don't like that several items (now there are five) are done in a ...
4 years, 7 months ago (2016-05-23 23:37:28 UTC) #39
lpy
Most changes of this patch are: libsampler/ directory, and sampling thread in log.cc If we ...
4 years, 7 months ago (2016-05-24 17:07:57 UTC) #41
alph
lgtm w/ nits. Ok, this seems to be a good starting point. Let's land it ...
4 years, 7 months ago (2016-05-24 22:19:21 UTC) #42
lpy
Thank you for reviewing such a big patch. https://codereview.chromium.org/1922303002/diff/440001/include/v8.h File include/v8.h (right): https://codereview.chromium.org/1922303002/diff/440001/include/v8.h#newcode6338 include/v8.h:6338: bool ...
4 years, 7 months ago (2016-05-24 23:13:10 UTC) #43
Yang
LGTM Question about this though: "4. Moves sampling thread into log.cc as workaround to keep ...
4 years, 7 months ago (2016-05-25 08:29:39 UTC) #44
lpy
On 2016/05/25 08:29:39, Yang wrote: > LGTM Thanks for review this. > Question about this ...
4 years, 7 months ago (2016-05-25 13:59:26 UTC) #45
Yang
On 2016/05/25 13:59:26, lpy wrote: > On 2016/05/25 08:29:39, Yang wrote: > > LGTM > ...
4 years, 7 months ago (2016-05-25 14:38:11 UTC) #46
lpy
> https://codereview.chromium.org/1922303002/diff/460001/src/libsampler/hashmap.h#newcode5 > > > src/libsampler/hashmap.h:5: // This file is ported from src/hashmap.h > > ...
4 years, 7 months ago (2016-05-25 16:21:51 UTC) #47
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1922303002/460001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1922303002/460001
4 years, 7 months ago (2016-05-25 19:03:51 UTC) #50
commit-bot: I haz the power
Committed patchset #24 (id:460001)
4 years, 7 months ago (2016-05-25 19:06:01 UTC) #52
commit-bot: I haz the power
Patchset 24 (id:??) landed as https://crrev.com/06cc9b7c176a6223971deaa9fbcafe1a05058c7b Cr-Commit-Position: refs/heads/master@{#36527}
4 years, 7 months ago (2016-05-25 19:06:56 UTC) #54
lpy
A revert of this CL (patchset #24 id:460001) has been created in https://codereview.chromium.org/2000323007/ by lpy@chromium.org. ...
4 years, 7 months ago (2016-05-25 20:19:45 UTC) #55
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1922303002/480001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1922303002/480001
4 years, 7 months ago (2016-05-26 02:12:16 UTC) #60
commit-bot: I haz the power
Committed patchset #25 (id:480001)
4 years, 7 months ago (2016-05-26 02:14:08 UTC) #62
commit-bot: I haz the power
4 years, 7 months ago (2016-05-26 02:15:02 UTC) #64
Message was sent while issue was closed.
Patchset 25 (id:??) landed as
https://crrev.com/a0198c0f627de392280f00099333f96ee34d2519
Cr-Commit-Position: refs/heads/master@{#36532}

Powered by Google App Engine
This is Rietveld 408576698