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

Issue 422593003: Initial GetSample implementation. (Closed)

Created:
6 years, 5 months ago by gholap
Modified:
6 years ago
CC:
fmeawad
Project:
v8
Visibility:
Public.

Description

Initial GetSample implementation. BUG=v8:3490 LOG=N

Patch Set 1 #

Patch Set 2 : Moved the thread pausing logic inside Sampler::GetSample #

Total comments: 1

Patch Set 3 : Killed max_frame_count argument. #

Patch Set 4 : Moved initialization of sample from the signal emitter to sigal handler thread. #

Total comments: 12

Patch Set 5 : Added TODOs, removed trailing underscores from var names. #

Patch Set 6 : Added TODOs, removed trailing underscores from var names. #

Patch Set 7 : Oops. The previous commit was broken. #

Patch Set 8 : Frames count was a bit-field had missed that previously. Now the API actually works. #

Total comments: 18

Patch Set 9 : Addressed the comments. #

Total comments: 17

Patch Set 10 : Addressed some comments. memory barrier and semaphore_signal still WIP. #

Total comments: 4

Patch Set 11 : Addressed the nits. #

Total comments: 2

Patch Set 12 : Fixed typo. Made sure SIGPROF handler is always installed. Added a test. #

Total comments: 2

Patch Set 13 : Increased loop length. Changed assignment to addition to subvert optimization. #

Patch Set 14 : Time based loop. Added sample count. Removed the sleep(0). #

Patch Set 15 : Added synchronization to sampler api test. #

Total comments: 28

Patch Set 16 : Addressed the comments. Fixed the nits. #

Total comments: 2

Patch Set 17 : Fixed variable naming nits. #

Total comments: 4

Patch Set 18 : Removed Address from public API. Removed the function to copy TickSample to Sample. #

Total comments: 14

Patch Set 19 : reinterpret_cast -> static_cast. Also addressed other comments. #

Patch Set 20 : Simplified profile-generator for loop. #

Patch Set 21 : Added test to verify the pc values in obtained sample. #

Total comments: 6

Patch Set 22 : unsigned -> size_t and kMaxFramesCount is in an enum now as opposed to a compile time constant. #

Patch Set 23 : Made the Sample class into an iterable. #

Total comments: 16

Patch Set 24 : Addressed nits. Built and tested on windows. #

Patch Set 25 : Rebased on bleeding_edge #

Total comments: 17

Patch Set 26 : Moved thread logic out of GetSample #

Total comments: 5
Unified diffs Side-by-side diffs Delta from patch set Stats (+444 lines, -29 lines) Patch
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 23 24 25 3 chunks +48 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 25 3 chunks +18 lines, -0 lines 0 comments Download
M src/cpu-profiler.h View 1 25 1 chunk +2 lines, -0 lines 0 comments Download
M src/flag-definitions.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 1 chunk +3 lines, -0 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 23 24 25 4 chunks +7 lines, -2 lines 0 comments Download
M src/profile-generator.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 25 1 chunk +2 lines, -5 lines 0 comments Download
M src/sampler.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 4 chunks +32 lines, -7 lines 3 comments Download
M src/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 25 10 chunks +111 lines, -13 lines 2 comments Download
M test/cctest/cctest.gyp View 1 2 3 4 5 6 7 8 9 10 11 25 1 chunk +1 line, -0 lines 0 comments Download
M test/cctest/test-log-stack-tracer.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 25 1 chunk +2 lines, -2 lines 0 comments Download
A test/cctest/test-sampler-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 25 1 chunk +218 lines, -0 lines 0 comments Download

Messages

Total messages: 59 (4 generated)
fmeawad
I have done a quick first pass. https://codereview.chromium.org/422593003/diff/20001/include/v8-sampler.h File include/v8-sampler.h (right): https://codereview.chromium.org/422593003/diff/20001/include/v8-sampler.h#newcode62 include/v8-sampler.h:62: unsigned max_frame_count, ...
6 years, 4 months ago (2014-07-29 18:30:50 UTC) #1
gholap
ptal https://codereview.chromium.org/422593003/diff/60001/src/api.cc File src/api.cc (right): https://codereview.chromium.org/422593003/diff/60001/src/api.cc#newcode7440 src/api.cc:7440: if (sampler_ == NULL) return NULL; On 2014/07/29 ...
6 years, 4 months ago (2014-07-29 23:25:21 UTC) #2
gholap
This is the first CL towards moving the cpu-profiler out of v8 by creating an ...
6 years, 4 months ago (2014-07-29 23:48:08 UTC) #3
Yang
I'm not sure I'm the right guy to do this review, since both Sven and ...
6 years, 4 months ago (2014-08-12 14:21:36 UTC) #4
Benedikt Meurer
https://codereview.chromium.org/422593003/diff/140001/include/v8-sampler.h File include/v8-sampler.h (right): https://codereview.chromium.org/422593003/diff/140001/include/v8-sampler.h#newcode17 include/v8-sampler.h:17: typedef unsigned char* Address; I don't think we need ...
6 years, 4 months ago (2014-08-13 06:29:11 UTC) #5
gholap
I've addressed the comments, please let me know how it looks like... Also, I'll try ...
6 years, 4 months ago (2014-08-13 21:09:22 UTC) #6
Benedikt Meurer
https://codereview.chromium.org/422593003/diff/160001/include/v8-sampler.h File include/v8-sampler.h (right): https://codereview.chromium.org/422593003/diff/160001/include/v8-sampler.h#newcode16 include/v8-sampler.h:16: typedef unsigned char* Address; We don't need this typedef ...
6 years, 4 months ago (2014-08-14 04:20:23 UTC) #7
gholap
Addressed most the comments and nits. Memory barrier and semaphore_signal still WIP. (I'm figuring out, ...
6 years, 4 months ago (2014-08-15 17:54:14 UTC) #8
gholap
just checked semaphore_signal on xnu man pages. It is safe to call it even from ...
6 years, 4 months ago (2014-08-15 22:05:19 UTC) #9
Benedikt Meurer
LGTM with nits. https://codereview.chromium.org/422593003/diff/160001/include/v8-sampler.h File include/v8-sampler.h (right): https://codereview.chromium.org/422593003/diff/160001/include/v8-sampler.h#newcode16 include/v8-sampler.h:16: typedef unsigned char* Address; On 2014/08/15 ...
6 years, 4 months ago (2014-08-18 04:22:04 UTC) #10
gholap
Fixed the nits. I don't have commiter access, whom could I contact so that they ...
6 years, 4 months ago (2014-08-18 19:52:00 UTC) #11
Benedikt Meurer
On 2014/08/18 at 19:52:00, gholap wrote: > Fixed the nits. I don't have commiter access, ...
6 years, 4 months ago (2014-08-19 03:45:12 UTC) #12
Yang
On 2014/08/19 03:45:12, Benedikt Meurer wrote: > On 2014/08/18 at 19:52:00, gholap wrote: > > ...
6 years, 4 months ago (2014-08-19 08:06:24 UTC) #13
Yang
On 2014/08/19 08:06:24, Yang wrote: > On 2014/08/19 03:45:12, Benedikt Meurer wrote: > > On ...
6 years, 4 months ago (2014-08-21 06:01:15 UTC) #14
Yang
https://codereview.chromium.org/422593003/diff/200001/include/v8-sampler.h File include/v8-sampler.h (right): https://codereview.chromium.org/422593003/diff/200001/include/v8-sampler.h#newcode16 include/v8-sampler.h:16: /* TODO(gholap): This should go away and struct Smaple ...
6 years, 4 months ago (2014-08-21 06:04:52 UTC) #15
gholap
Added a test. Please have a look :) https://codereview.chromium.org/422593003/diff/200001/include/v8-sampler.h File include/v8-sampler.h (right): https://codereview.chromium.org/422593003/diff/200001/include/v8-sampler.h#newcode16 include/v8-sampler.h:16: /* ...
6 years, 4 months ago (2014-08-22 22:51:16 UTC) #16
Benedikt Meurer
https://codereview.chromium.org/422593003/diff/220001/test/cctest/test-sampler-api.cc File test/cctest/test-sampler-api.cc (right): https://codereview.chromium.org/422593003/diff/220001/test/cctest/test-sampler-api.cc#newcode110 test/cctest/test-sampler-api.cc:110: TEST(StackDepthIsConsistent) { Please don't add any more of these ...
6 years, 4 months ago (2014-08-25 04:24:22 UTC) #17
gholap
https://codereview.chromium.org/422593003/diff/220001/test/cctest/test-sampler-api.cc File test/cctest/test-sampler-api.cc (right): https://codereview.chromium.org/422593003/diff/220001/test/cctest/test-sampler-api.cc#newcode110 test/cctest/test-sampler-api.cc:110: TEST(StackDepthIsConsistent) { On 2014/08/25 04:24:22, Benedikt Meurer wrote: > ...
6 years, 4 months ago (2014-08-25 17:12:31 UTC) #18
Benedikt Meurer
> Ah! I see your point. Without synchronization, the test is a fragile one. Also, ...
6 years, 4 months ago (2014-08-26 05:06:39 UTC) #19
gholap
I changed the test so that it now uses semaphores for synchronization instead of relying ...
6 years, 3 months ago (2014-08-26 23:27:13 UTC) #20
Benedikt Meurer
https://codereview.chromium.org/422593003/diff/280001/include/v8-sampler.h File include/v8-sampler.h (right): https://codereview.chromium.org/422593003/diff/280001/include/v8-sampler.h#newcode56 include/v8-sampler.h:56: static Sample* GetSample(Isolate* isolate, Looking at the use in ...
6 years, 3 months ago (2014-08-27 04:17:24 UTC) #21
Sven Panne
https://codereview.chromium.org/422593003/diff/280001/include/v8-sampler.h File include/v8-sampler.h (right): https://codereview.chromium.org/422593003/diff/280001/include/v8-sampler.h#newcode41 include/v8-sampler.h:41: unsigned frames_count : kMaxFramesCountLog2; // Number of captured frames. ...
6 years, 3 months ago (2014-08-27 06:13:47 UTC) #22
gholap
> I would even go a step further and return void: Setting frames_count to zero ...
6 years, 3 months ago (2014-08-27 16:21:41 UTC) #23
gholap
- Addressed the comments. - Got rid of v8-sampler.h by moving code into v8.h - ...
6 years, 3 months ago (2014-08-27 21:48:09 UTC) #24
Sven Panne
On 2014/08/27 16:21:41, gholap wrote: > I see your point. It makes complete sense to ...
6 years, 3 months ago (2014-08-28 06:01:54 UTC) #25
Benedikt Meurer
https://codereview.chromium.org/422593003/diff/300001/test/cctest/test-sampler-api.cc File test/cctest/test-sampler-api.cc (right): https://codereview.chromium.org/422593003/diff/300001/test/cctest/test-sampler-api.cc#newcode21 test/cctest/test-sampler-api.cc:21: v8::base::Semaphore* SamplerSemaphore = new v8::base::Semaphore(0); Nit: Variable naming, SamplerSemaphore ...
6 years, 3 months ago (2014-08-29 04:23:50 UTC) #26
gholap
Taken into account all nits and changes pointed out by Benedikt and Sven. Please take ...
6 years, 3 months ago (2014-08-29 20:00:14 UTC) #27
Sven Panne
https://codereview.chromium.org/422593003/diff/320001/include/v8.h File include/v8.h (right): https://codereview.chromium.org/422593003/diff/320001/include/v8.h#newcode1303 include/v8.h:1303: typedef unsigned char* Address; Just use void* in sample ...
6 years, 3 months ago (2014-09-01 08:35:58 UTC) #28
gholap
ptal? :) https://codereview.chromium.org/422593003/diff/320001/include/v8.h File include/v8.h (right): https://codereview.chromium.org/422593003/diff/320001/include/v8.h#newcode1303 include/v8.h:1303: typedef unsigned char* Address; On 2014/09/01 08:35:58, ...
6 years, 3 months ago (2014-09-02 07:43:50 UTC) #29
Sven Panne
Almost there... https://codereview.chromium.org/422593003/diff/340001/src/log.cc File src/log.cc (right): https://codereview.chromium.org/422593003/diff/340001/src/log.cc#newcode1723 src/log.cc:1723: msg.AppendAddress(reinterpret_cast<Address>(sample->stack[i])); Always use the least powerful cast ...
6 years, 3 months ago (2014-09-02 08:15:02 UTC) #30
gholap
Addressed the comments. Sven, thanks a lot for the quick reviews!! :) https://codereview.chromium.org/422593003/diff/340001/src/log.cc File src/log.cc ...
6 years, 3 months ago (2014-09-02 08:56:08 UTC) #31
Sven Panne
https://codereview.chromium.org/422593003/diff/340001/src/profile-generator.cc File src/profile-generator.cc (right): https://codereview.chromium.org/422593003/diff/340001/src/profile-generator.cc#newcode631 src/profile-generator.cc:631: for (const Address* stack_pos = reinterpret_cast<const Address*>(sample.stack), On 2014/09/02 ...
6 years, 3 months ago (2014-09-02 11:15:36 UTC) #32
gholap
As Sven pointed out, simplified the for loop. what say now? https://codereview.chromium.org/422593003/diff/340001/src/profile-generator.cc File src/profile-generator.cc (right): ...
6 years, 3 months ago (2014-09-02 14:43:11 UTC) #33
gholap
As Sven pointed out, simplified the for loop. what say now?
6 years, 3 months ago (2014-09-02 14:43:11 UTC) #34
gholap
As Sven pointed out, simplified the for loop. what say now?
6 years, 3 months ago (2014-09-02 14:43:12 UTC) #35
gholap
As Sven pointed out, simplified the for loop. what say now?
6 years, 3 months ago (2014-09-02 14:43:14 UTC) #36
gholap
Now the tests also cover the verification of pc values against the compiled code to ...
6 years, 3 months ago (2014-09-02 18:10:56 UTC) #38
Benedikt Meurer
I thought about the public API again. https://codereview.chromium.org/422593003/diff/420001/include/v8.h File include/v8.h (right): https://codereview.chromium.org/422593003/diff/420001/include/v8.h#newcode1313 include/v8.h:1313: struct V8_EXPORT ...
6 years, 3 months ago (2014-09-03 04:24:30 UTC) #39
gholap
made the changes: 1) unsigned -> size_t 2) kMaxFramesCount is in an enum now as ...
6 years, 3 months ago (2014-09-03 19:44:29 UTC) #40
gholap
Made the Sample class into an iterable thing. Have a look :)
6 years, 3 months ago (2014-09-04 09:30:39 UTC) #41
Benedikt Meurer
One last nit from me. https://codereview.chromium.org/422593003/diff/460001/src/sampler.cc File src/sampler.cc (right): https://codereview.chromium.org/422593003/diff/460001/src/sampler.cc#newcode757 src/sampler.cc:757: *sample = v8::Sample(SignalHandler::sample_.stack, Nit: ...
6 years, 3 months ago (2014-09-05 03:50:00 UTC) #42
Sven Panne
LGTM if Benedikt's comments are addressed
6 years, 3 months ago (2014-09-05 06:40:10 UTC) #43
Benedikt Meurer
And of course, rebase your patch on bleeding_edge.
6 years, 3 months ago (2014-09-05 07:11:49 UTC) #44
alph
6 years, 3 months ago (2014-09-08 11:29:17 UTC) #46
alph
https://codereview.chromium.org/422593003/diff/460001/include/v8.h File include/v8.h (right): https://codereview.chromium.org/422593003/diff/460001/include/v8.h#newcode1301 include/v8.h:1301: * Isolate::Getsample collects the current JS execution state as ...
6 years, 3 months ago (2014-09-08 12:47:40 UTC) #47
gholap
Addressed the issues - nits - placement new - windows build and testing TODO: rebase ...
6 years, 3 months ago (2014-09-08 23:57:38 UTC) #48
alph
lgtm. I'd suggest you to have yurys@ to take a look at it as he's ...
6 years, 3 months ago (2014-09-09 13:54:37 UTC) #49
yurys
https://codereview.chromium.org/422593003/diff/500001/include/v8.h File include/v8.h (right): https://codereview.chromium.org/422593003/diff/500001/include/v8.h#newcode4359 include/v8.h:4359: void GetSample(Sample* sample); This is not what the document ...
6 years, 3 months ago (2014-09-09 14:35:20 UTC) #50
jochen (gone - plz use gerrit)
https://codereview.chromium.org/422593003/diff/500001/include/v8.h File include/v8.h (right): https://codereview.chromium.org/422593003/diff/500001/include/v8.h#newcode4359 include/v8.h:4359: void GetSample(Sample* sample); On 2014/09/09 14:35:20, yurys wrote: > ...
6 years, 3 months ago (2014-09-10 07:39:20 UTC) #52
gholap
I've addressed the main concern regarding moving the threading logic out of GetSample and I've ...
6 years, 3 months ago (2014-09-17 02:35:07 UTC) #53
alph
As far as I understand the idea was to remove all the signal handling / ...
6 years, 3 months ago (2014-09-17 11:55:43 UTC) #54
Sven Panne
> [...] Shouldn't it be just a plain GetSample function that collects a stack trace ...
6 years, 3 months ago (2014-09-17 12:03:48 UTC) #55
gholap
How about we move the design discussion here? https://docs.google.com/a/chromium.org/document/d/1TiY-DFwkRTT0EiOijg2aTPrt2AuZwGCCP8UfKLB-ogI/edit The document has extensive listing of ...
6 years, 3 months ago (2014-09-17 16:33:39 UTC) #56
alph
On 2014/09/17 16:33:39, gholap wrote: > How about we move the design discussion here? > ...
6 years, 3 months ago (2014-09-17 16:36:47 UTC) #57
yurys
6 years ago (2014-11-25 12:18:07 UTC) #59
Closing this issue as this functionality was implemented in
https://codereview.chromium.org/596533002

Powered by Google App Engine
This is Rietveld 408576698