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

Issue 424973004: Extend CPU profiler with mapping ticks to source lines (Closed)

Created:
6 years, 4 months ago by Weiliang
Modified:
6 years, 2 months ago
CC:
v8-dev, Paweł Hajdan Jr., danno, Benedikt Meurer
Project:
v8
Visibility:
Public.

Description

The idea behind of this solution is to use the existing "relocation info" instead of consumption the CodeLinePosition events emitted by the V8 compilers. During generation code and relocation info are generated simultaneously. When code generation is done you each code object has associated "relocation info". Relocation information lets V8 to mark interesting places in the generated code: the pointers that might need to be relocated (after garbage collection), correspondences between the machine program counter and source locations for stack walking. This patch: 1. Add more source positions info in reloc info to make it suitable for source level mapping. The amount of data should not be increased dramatically because (1) V8 already marks interesting places in the generated code and (2) V8 does not write redundant information (it writes a pair (pc_offset, pos) only if pos is changed and skips other). I measured it on Octane benchmark - for unoptimized code the number of source positions may achieve 2x ('lin_solve' from NavierStokes benchmark). 2. When a sample happens, CPU profiler finds a code object by pc, then use its reloc info to match the sample to a source line. If a source line is found that hit counter is increased by one for this line. 3. Add a new public V8 API to get the hit source lines by CDT CPU profiler. Note that it's expected a minor patch in Blink to pack the source level info in JSON to be shown. 4.Add a test that checks how the samples are distributed through source lines. It tests two cases: (1) relocation info created during code generation and (2) relocation info associated with precompiled function's version. Patch from Denis Pravdin <denis.pravdin@intel.com>; BUG=None LOG=Y

Patch Set 1 #

Total comments: 25

Patch Set 2 : addressed the comments #

Total comments: 10

Patch Set 3 : Addressed comments #

Total comments: 13

Patch Set 4 : rebasing #

Patch Set 5 : addressed comments #

Total comments: 13

Patch Set 6 : rebasing again #

Patch Set 7 : addressed some comments #

Patch Set 8 : addressed the various code object issue in the test #

Total comments: 4

Patch Set 9 : git cl format #

Total comments: 10

Patch Set 10 : addressed alph comments #

Patch Set 11 : remove the change on cctest.status #

Patch Set 12 : addressed yurys comments #

Patch Set 13 : Addressed yurys comments #

Patch Set 14 : rebasing #

Patch Set 15 : Fixed TickLines failure when using turbofan after rebasing #

Patch Set 16 : fixed v8_linux_nosnap_dbg failure #

Unified diffs Side-by-side diffs Delta from patch set Stats (+336 lines, -55 lines) Patch
M include/v8-profiler.h View 1 2 2 chunks +20 lines, -0 lines 0 comments Download
M src/api.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +13 lines, -0 lines 0 comments Download
M src/cpu-profiler.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 6 chunks +34 lines, -12 lines 0 comments Download
M src/full-codegen.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +1 line, -0 lines 0 comments Download
M src/profile-generator.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 10 chunks +62 lines, -11 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 13 chunks +96 lines, -23 lines 0 comments Download
M src/profile-generator-inl.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 3 chunks +12 lines, -9 lines 0 comments Download
M test/cctest/test-cpu-profiler.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +98 lines, -0 lines 0 comments Download

Messages

Total messages: 60 (3 generated)
Weiliang
Hi Danno, This is a patch from Denis Pravdin <denis.pravdin@intel.com> to extend V8 CPU profiler ...
6 years, 4 months ago (2014-07-29 09:16:38 UTC) #1
danno
Yury and Sven, could you please take a look? https://codereview.chromium.org/424973004/diff/1/AUTHORS File AUTHORS (right): https://codereview.chromium.org/424973004/diff/1/AUTHORS#newcode31 AUTHORS:31: ...
6 years, 4 months ago (2014-07-29 09:24:51 UTC) #2
alph
https://codereview.chromium.org/424973004/diff/1/include/v8-profiler.h File include/v8-profiler.h (right): https://codereview.chromium.org/424973004/diff/1/include/v8-profiler.h#newcode25 include/v8-profiler.h:25: unsigned int ticks; hitCount? https://codereview.chromium.org/424973004/diff/1/include/v8-profiler.h#newcode61 include/v8-profiler.h:61: * True if ...
6 years, 4 months ago (2014-07-29 12:55:56 UTC) #3
yurys
https://codereview.chromium.org/424973004/diff/1/include/v8-profiler.h File include/v8-profiler.h (right): https://codereview.chromium.org/424973004/diff/1/include/v8-profiler.h#newcode20 include/v8-profiler.h:20: typedef struct { struct LineTick, also it can be ...
6 years, 4 months ago (2014-07-29 13:15:11 UTC) #4
Sven Panne
LGTM from my side if the previous comments are addressed.
6 years, 4 months ago (2014-08-05 12:26:08 UTC) #5
Weiliang
Thanks a lot for all of your reviews. The comments are addressed and please take ...
6 years, 4 months ago (2014-08-06 04:10:16 UTC) #6
Denis Pravdin
On 2014/08/06 04:10:16, Weiliang wrote: > Thanks a lot for all of your reviews. The ...
6 years, 4 months ago (2014-08-07 17:41:54 UTC) #7
Sven Panne
LGTM from my side (still), but we should wait for Yury, too...
6 years, 4 months ago (2014-08-08 07:00:47 UTC) #8
yurys
https://codereview.chromium.org/424973004/diff/20001/include/v8-profiler.h File include/v8-profiler.h (right): https://codereview.chromium.org/424973004/diff/20001/include/v8-profiler.h#newcode25 include/v8-profiler.h:25: typedef struct { style: we use C++ style for ...
6 years, 4 months ago (2014-08-08 08:13:24 UTC) #9
Denis Pravdin
https://codereview.chromium.org/424973004/diff/20001/include/v8-profiler.h File include/v8-profiler.h (right): https://codereview.chromium.org/424973004/diff/20001/include/v8-profiler.h#newcode27 include/v8-profiler.h:27: int line; On 2014/08/08 08:13:23, yurys wrote: > How ...
6 years, 4 months ago (2014-08-11 05:35:31 UTC) #10
yurys
On 2014/08/11 05:35:31, Denis Pravdin wrote: > https://codereview.chromium.org/424973004/diff/20001/include/v8-profiler.h > File include/v8-profiler.h (right): > > https://codereview.chromium.org/424973004/diff/20001/include/v8-profiler.h#newcode27 ...
6 years, 4 months ago (2014-08-11 06:19:52 UTC) #11
Denis Pravdin
On 2014/08/11 06:19:52, yurys wrote: > On 2014/08/11 05:35:31, Denis Pravdin wrote: > > https://codereview.chromium.org/424973004/diff/20001/include/v8-profiler.h ...
6 years, 4 months ago (2014-08-11 06:28:16 UTC) #12
Weiliang
On behalf of Denis Please take a look at the patch set 3. Thanks a ...
6 years, 4 months ago (2014-08-11 08:48:54 UTC) #13
alph
https://codereview.chromium.org/424973004/diff/40001/src/cpu-profiler.cc File src/cpu-profiler.cc (right): https://codereview.chromium.org/424973004/diff/40001/src/cpu-profiler.cc#newcode260 src/cpu-profiler.cc:260: ASSERT(Script::cast(shared->script())); nit: DCHECK here and everywhere else. Also cast ...
6 years, 4 months ago (2014-08-11 12:18:15 UTC) #14
Denis Pravdin
https://codereview.chromium.org/424973004/diff/40001/src/profile-generator.cc File src/profile-generator.cc (right): https://codereview.chromium.org/424973004/diff/40001/src/profile-generator.cc#newcode226 src/profile-generator.cc:226: e->value = static_cast<char*>(e->value) + 1; On 2014/08/11 12:18:15, alph ...
6 years, 4 months ago (2014-08-11 13:00:13 UTC) #15
Denis Pravdin
https://codereview.chromium.org/424973004/diff/40001/src/cpu-profiler.cc File src/cpu-profiler.cc (right): https://codereview.chromium.org/424973004/diff/40001/src/cpu-profiler.cc#newcode260 src/cpu-profiler.cc:260: ASSERT(Script::cast(shared->script())); On 2014/08/11 12:18:15, alph wrote: > nit: DCHECK ...
6 years, 4 months ago (2014-08-11 13:11:50 UTC) #16
alph
https://codereview.chromium.org/424973004/diff/40001/src/cpu-profiler.cc File src/cpu-profiler.cc (right): https://codereview.chromium.org/424973004/diff/40001/src/cpu-profiler.cc#newcode260 src/cpu-profiler.cc:260: ASSERT(Script::cast(shared->script())); On 2014/08/11 13:11:50, Denis Pravdin wrote: > On ...
6 years, 4 months ago (2014-08-11 13:41:04 UTC) #17
Weiliang
rebased + addressed comments PTAL
6 years, 4 months ago (2014-08-13 08:55:39 UTC) #18
Denis Pravdin
On 2014/08/13 08:55:39, Weiliang wrote: > rebased + addressed comments > PTAL Please take a ...
6 years, 4 months ago (2014-08-15 04:50:10 UTC) #19
alph
https://codereview.chromium.org/424973004/diff/120001/src/cpu-profiler.cc File src/cpu-profiler.cc (right): https://codereview.chromium.org/424973004/diff/120001/src/cpu-profiler.cc#newcode261 src/cpu-profiler.cc:261: if (shared->script()->IsScript()) { Is it possible the shared->script() is ...
6 years, 4 months ago (2014-08-15 12:10:47 UTC) #20
Denis Pravdin
https://codereview.chromium.org/424973004/diff/120001/test/cctest/test-cpu-profiler.cc File test/cctest/test-cpu-profiler.cc (right): https://codereview.chromium.org/424973004/diff/120001/test/cctest/test-cpu-profiler.cc#newcode1134 test/cctest/test-cpu-profiler.cc:1134: CHECK_NE(NULL, line_info); On 2014/08/15 12:10:47, alph wrote: > I've ...
6 years, 4 months ago (2014-08-15 20:57:55 UTC) #21
alph
https://codereview.chromium.org/424973004/diff/120001/test/cctest/test-cpu-profiler.cc File test/cctest/test-cpu-profiler.cc (right): https://codereview.chromium.org/424973004/diff/120001/test/cctest/test-cpu-profiler.cc#newcode1134 test/cctest/test-cpu-profiler.cc:1134: CHECK_NE(NULL, line_info); On 2014/08/15 20:57:55, Denis Pravdin wrote: > ...
6 years, 4 months ago (2014-08-19 14:23:35 UTC) #22
Denis Pravdin
On 2014/08/19 14:23:35, alph wrote: > https://codereview.chromium.org/424973004/diff/120001/test/cctest/test-cpu-profiler.cc > File test/cctest/test-cpu-profiler.cc (right): > > https://codereview.chromium.org/424973004/diff/120001/test/cctest/test-cpu-profiler.cc#newcode1134 > ...
6 years, 4 months ago (2014-08-22 17:20:54 UTC) #23
Denis Pravdin
On 2014/08/19 14:23:35, alph wrote: > https://codereview.chromium.org/424973004/diff/120001/test/cctest/test-cpu-profiler.cc > File test/cctest/test-cpu-profiler.cc (right): > > https://codereview.chromium.org/424973004/diff/120001/test/cctest/test-cpu-profiler.cc#newcode1134 > ...
6 years, 4 months ago (2014-08-22 17:20:58 UTC) #24
Denis Pravdin
https://codereview.chromium.org/424973004/diff/120001/src/cpu-profiler.cc File src/cpu-profiler.cc (right): https://codereview.chromium.org/424973004/diff/120001/src/cpu-profiler.cc#newcode261 src/cpu-profiler.cc:261: if (shared->script()->IsScript()) { On 2014/08/15 12:10:47, alph wrote: > ...
6 years, 4 months ago (2014-08-23 05:18:52 UTC) #25
Denis Pravdin
On 2014/08/22 17:20:58, Denis Pravdin wrote: > On 2014/08/19 14:23:35, alph wrote: > > > ...
6 years, 3 months ago (2014-08-28 16:30:32 UTC) #26
Denis Pravdin
https://codereview.chromium.org/424973004/diff/120001/test/cctest/test-cpu-profiler.cc File test/cctest/test-cpu-profiler.cc (right): https://codereview.chromium.org/424973004/diff/120001/test/cctest/test-cpu-profiler.cc#newcode1134 test/cctest/test-cpu-profiler.cc:1134: CHECK_NE(NULL, line_info); Yes, you're right. I debugged the test ...
6 years, 3 months ago (2014-09-01 09:35:13 UTC) #27
Denis Pravdin
https://codereview.chromium.org/424973004/diff/120001/src/cpu-profiler.cc File src/cpu-profiler.cc (right): https://codereview.chromium.org/424973004/diff/120001/src/cpu-profiler.cc#newcode261 src/cpu-profiler.cc:261: if (shared->script()->IsScript()) { I reused the same pattern as ...
6 years, 3 months ago (2014-09-01 10:44:38 UTC) #28
Weiliang
https://codereview.chromium.org/424973004/diff/120001/src/profile-generator.h File src/profile-generator.h (right): https://codereview.chromium.org/424973004/diff/120001/src/profile-generator.h#newcode58 src/profile-generator.h:58: pc_offset_map_.insert(std::make_pair(pc_offset, line)); On 2014/09/01 10:44:38, Denis Pravdin wrote: > ...
6 years, 3 months ago (2014-09-03 02:29:48 UTC) #29
Weiliang
On 2014/09/03 02:29:48, Weiliang wrote: > https://codereview.chromium.org/424973004/diff/120001/src/profile-generator.h > File src/profile-generator.h (right): > > https://codereview.chromium.org/424973004/diff/120001/src/profile-generator.h#newcode58 > ...
6 years, 3 months ago (2014-09-03 08:34:50 UTC) #30
Weiliang
On 2014/09/03 08:34:50, Weiliang wrote: > On 2014/09/03 02:29:48, Weiliang wrote: > > https://codereview.chromium.org/424973004/diff/120001/src/profile-generator.h > ...
6 years, 3 months ago (2014-09-05 02:02:53 UTC) #31
alph
Sorry for long delay. lgtm. Please make sure you get one from yurys@ Thank you! ...
6 years, 3 months ago (2014-09-09 14:47:34 UTC) #32
yurys
I'm fine with the change once the couple of issues I pointed out in the ...
6 years, 3 months ago (2014-09-10 08:05:14 UTC) #33
Denis Pravdin
The yurys's comments were addressed. About adding column information to the hit count map - ...
6 years, 3 months ago (2014-09-11 08:14:44 UTC) #34
yurys
On 2014/09/11 08:14:44, Denis Pravdin wrote: > https://codereview.chromium.org/424973004/diff/200001/test/cctest/test-cpu-profiler.cc > File test/cctest/test-cpu-profiler.cc (right): > > https://codereview.chromium.org/424973004/diff/200001/test/cctest/test-cpu-profiler.cc#newcode1099 ...
6 years, 3 months ago (2014-09-12 13:46:28 UTC) #35
Weiliang
On 2014/09/12 13:46:28, yurys wrote: > On 2014/09/11 08:14:44, Denis Pravdin wrote: > > > ...
6 years, 3 months ago (2014-09-15 01:50:16 UTC) #36
yurys
On 2014/09/15 01:50:16, Weiliang wrote: > On 2014/09/12 13:46:28, yurys wrote: > > On 2014/09/11 ...
6 years, 3 months ago (2014-09-15 06:25:38 UTC) #37
Denis Pravdin
On 2014/09/12 13:46:28, yurys wrote: > On 2014/09/11 08:14:44, Denis Pravdin wrote: > > > ...
6 years, 3 months ago (2014-09-15 09:52:06 UTC) #38
Weiliang
On 2014/09/15 06:25:38, yurys wrote: > On 2014/09/15 01:50:16, Weiliang wrote: > > On 2014/09/12 ...
6 years, 3 months ago (2014-09-16 06:48:30 UTC) #39
yurys
On 2014/09/15 09:52:06, Denis Pravdin wrote: > On 2014/09/12 13:46:28, yurys wrote: > > On ...
6 years, 3 months ago (2014-09-16 10:09:44 UTC) #40
yurys
lgtm
6 years, 3 months ago (2014-09-16 10:10:39 UTC) #41
Weiliang
On 2014/09/16 10:10:39, yurys wrote: > lgtm Hi Yurys Please see again the patch set ...
6 years, 3 months ago (2014-09-17 03:14:12 UTC) #42
yurys
I will take care of landing the cl. On 2014/09/17 03:14:12, Weiliang wrote: > On ...
6 years, 3 months ago (2014-09-17 10:04:11 UTC) #43
Weiliang
On 2014/09/17 10:04:11, yurys wrote: > I will take care of landing the cl. > ...
6 years, 3 months ago (2014-09-17 13:15:54 UTC) #44
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patchset/424973004/320001
6 years, 3 months ago (2014-09-17 13:48:19 UTC) #46
commit-bot: I haz the power
No LGTM from a valid reviewer yet. Only full committers are accepted. Even if an ...
6 years, 3 months ago (2014-09-17 13:48:21 UTC) #48
Weiliang
On 2014/09/17 13:48:21, I haz the power (commit-bot) wrote: > No LGTM from a valid ...
6 years, 3 months ago (2014-09-18 13:59:24 UTC) #49
yurys
On 2014/09/18 13:59:24, Weiliang wrote: > On 2014/09/17 13:48:21, I haz the power (commit-bot) wrote: ...
6 years, 3 months ago (2014-09-18 16:09:30 UTC) #50
Weiliang
On 2014/09/18 16:09:30, yurys wrote: > On 2014/09/18 13:59:24, Weiliang wrote: > > On 2014/09/17 ...
6 years, 2 months ago (2014-09-26 14:03:10 UTC) #52
Denis Pravdin
On 2014/09/26 14:03:10, Weiliang wrote: > On 2014/09/18 16:09:30, yurys wrote: > > On 2014/09/18 ...
6 years, 2 months ago (2014-10-02 07:26:28 UTC) #53
yurys
On 2014/10/02 07:26:28, Denis Pravdin wrote: > On 2014/09/26 14:03:10, Weiliang wrote: > > On ...
6 years, 2 months ago (2014-10-02 07:42:55 UTC) #54
yurys
I applied the patch locally and getting the following error when building x64.debug: $ make ...
6 years, 2 months ago (2014-10-02 07:54:52 UTC) #55
Denis Pravdin
On 2014/10/02 07:54:52, yurys wrote: > I applied the patch locally and getting the following ...
6 years, 2 months ago (2014-10-02 08:26:38 UTC) #56
yurys
The linker error looks like a bug in gcc as the following change fixes it: ...
6 years, 2 months ago (2014-10-02 08:31:30 UTC) #57
yurys
On 2014/10/02 08:26:38, Denis Pravdin wrote: > On 2014/10/02 07:54:52, yurys wrote: > > I ...
6 years, 2 months ago (2014-10-02 08:41:26 UTC) #58
Denis Pravdin
On 2014/10/02 08:41:26, yurys wrote: > On 2014/10/02 08:26:38, Denis Pravdin wrote: > > On ...
6 years, 2 months ago (2014-10-02 08:52:41 UTC) #59
yurys
6 years, 2 months ago (2014-10-02 09:21:36 UTC) #60
On 2014/10/02 08:41:26, yurys wrote:
> On 2014/10/02 08:26:38, Denis Pravdin wrote:
> > On 2014/10/02 07:54:52, yurys wrote:
> > > I applied the patch locally and getting the following error when building
> > > x64.debug:
> > > 
> > > $ make x64.debug.check -j300
> > > make[1]: Entering directory `/sources/chromium/src/v8/out'
> > >   LINK(target) /sources/chromium/src/v8/out/x64.debug/mksnapshot
> > >
> /sources/chromium/src/v8/out/x64.debug/obj.target/v8_base/src/cpu-profiler.o:
> > In
> > > function `v8::internal::JITLineInfoTable::GetSourceLineNumber(int) const':
> > > /sources/chromium/src/v8/out/.././src/profile-generator.h:67: undefined
> > > reference to `v8::CpuProfileNode::kNoLineNumberInfo'
> > > collect2: ld returned 1 exit status
> > > make[1]: *** [/sources/chromium/src/v8/out/x64.debug/mksnapshot] Error 1
> > > make[1]: Leaving directory `/sources/chromium/src/v8/out'
> > > make: *** [x64.debug] Error 2
> > > 
> > > Could you please fix that?
> > > 
> > > Also it might make sense to move implementation of JITLineInfoTable
methods
> > into
> > > profile-generator.cc for better readability. But it is up to you.
> > 
> > 
> > Yeah, I saw this linker error on Linux debug configuration only after I
> applied
> > my patch. But it seems that the problem is there even before my patch.
> > The include/v8-profiler.h file includes a constant initializer for
> > kNoLineNumberInfo. I know that class static const integral member is not
> > required to be defined out of class. But it's better to define
> > CpuProfileNode::kNoLineNumberInfo somewhere.
> > 
> > I fixed it locally, just for testing.
> > src/cpu_profiler.cc:
> > namespace v8 {
> > const int CpuProfileNode::kNoLineNumberInfo;
> > }
> > 
> > I can't permissions to upload the patch (that's a reason I am asking
Weiliang
> to
> > help me with the patch) for review. Weiliang is OOO to Oct 7 due to PRC
> national
> > Holiday.
> > 
> > Can you fix the linker error and then apply my patch or you prefer to wait
for
> > one more patch?
> > 
> Done. Uploaded your patch and a fix on top of it as
> https://codereview.chromium.org/616963005/
> 
> 
> > Thanks,
> > Denis

The change was committed as https://code.google.com/p/v8/source/detail?r=24389,
closing this issue.

Powered by Google App Engine
This is Rietveld 408576698