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

Issue 3831002: Support profiling based on linux kernel performance events. (Closed)

Created:
10 years, 2 months ago by Vitaly Repeshko
Modified:
9 years, 7 months ago
CC:
v8-dev
Visibility:
Public.

Description

Support profiling based on linux kernel performance events. Since 2.6.31 perf_events interface has been available in the kernel. There's a nice tool called "perf" (linux-2.6/tools/perf) that uses this interface and provides capabilities similar to oprofile. The simplest form of its usage is just dumping the raw log (trace) of events generated by the kernel. In this patch I'm adding a script (tools/ll_prof.py) to build profiles based on perf trace and our code log. All the heavy-lifting is done by perf. Compared to oprofile agent this approach does not require recompilation and supports code moving garbage collections. Expected usage is documented in the ll_prof's help. Basically one should run V8 under perf passing --ll-prof flag and then the produced logs can be analyzed by tools/ll_prof.py. The new --ll-prof flag enables logging of generated code object locations and names (like --log-code), and also of their bodies, which can be later disassembled and annotated by the script. Committed: http://code.google.com/p/v8/source/detail?r=5663

Patch Set 1 #

Patch Set 2 : Removed --arch #

Total comments: 22

Patch Set 3 : Review fixes #

Total comments: 9

Patch Set 4 : More fixes #

Unified diffs Side-by-side diffs Delta from patch set Stats (+1097 lines, -3 lines) Patch
M src/cpu-profiler.h View 1 chunk +1 line, -0 lines 0 comments Download
M src/flag-definitions.h View 1 chunk +1 line, -0 lines 0 comments Download
M src/heap.cc View 1 chunk +4 lines, -0 lines 0 comments Download
M src/log.h View 1 2 3 chunks +8 lines, -0 lines 0 comments Download
M src/log.cc View 1 2 9 chunks +52 lines, -0 lines 0 comments Download
M src/log-utils.h View 1 2 2 chunks +4 lines, -0 lines 0 comments Download
M src/log-utils.cc View 1 2 3 chunks +15 lines, -0 lines 0 comments Download
M src/platform.h View 1 2 3 1 chunk +8 lines, -3 lines 0 comments Download
M src/platform-freebsd.cc View 1 chunk +4 lines, -0 lines 0 comments Download
M src/platform-linux.cc View 1 2 3 1 chunk +24 lines, -0 lines 0 comments Download
M src/platform-macos.cc View 1 chunk +4 lines, -0 lines 0 comments Download
M src/platform-nullos.cc View 1 chunk +5 lines, -0 lines 0 comments Download
M src/platform-openbsd.cc View 1 chunk +4 lines, -0 lines 0 comments Download
M src/platform-solaris.cc View 1 chunk +4 lines, -0 lines 0 comments Download
M src/platform-win32.cc View 1 chunk +4 lines, -0 lines 0 comments Download
A tools/ll_prof.py View 1 2 1 chunk +955 lines, -0 lines 0 comments Download

Messages

Total messages: 7 (0 generated)
Vitaly Repeshko
10 years, 2 months ago (2010-10-15 17:01:32 UTC) #1
mnaganov (inactive)
Excellent job, Vitaly! Having this code in place, we can drop OProfile support (as it's ...
10 years, 2 months ago (2010-10-17 19:51:11 UTC) #2
Vitaly Repeshko
Thanks for the comments! Please take another look. -- Vitaly http://codereview.chromium.org/3831002/diff/3001/4004 File src/log-utils.cc (right): http://codereview.chromium.org/3831002/diff/3001/4004#newcode157 ...
10 years, 2 months ago (2010-10-18 10:48:54 UTC) #3
mnaganov (inactive)
LGTM Please provide a documentation page in V8 Wiki also. http://codereview.chromium.org/3831002/diff/3001/4004 File src/log-utils.cc (right): http://codereview.chromium.org/3831002/diff/3001/4004#newcode158 ...
10 years, 2 months ago (2010-10-18 12:38:09 UTC) #4
Vitaly Repeshko
http://codereview.chromium.org/3831002/diff/3001/4004 File src/log-utils.cc (right): http://codereview.chromium.org/3831002/diff/3001/4004#newcode158 src/log-utils.cc:158: memcpy(code_name, name, name_len); On 2010/10/18 12:38:09, Michail Naganov wrote: ...
10 years, 2 months ago (2010-10-18 12:57:31 UTC) #5
fschneider
This is really cool! I'm looking forward to trying this out. some minor drive-by comments: ...
10 years, 2 months ago (2010-10-18 13:09:41 UTC) #6
Vitaly Repeshko
10 years, 2 months ago (2010-10-19 16:44:00 UTC) #7
Mikhail, Florian, thanks for reviewing this! I'm submitting and writing a howto.


-- Vitaly

http://codereview.chromium.org/3831002/diff/10001/11009
File src/platform-linux.cc (right):

http://codereview.chromium.org/3831002/diff/10001/11009#newcode407
src/platform-linux.cc:407: // Linux profiler built into the kernel logs all
mmap's with
On 2010/10/18 13:09:42, fschneider wrote:
> The Linux profiler...

Fixed.

http://codereview.chromium.org/3831002/diff/10001/11015
File src/platform.h (right):

http://codereview.chromium.org/3831002/diff/10001/11015#newcode265
src/platform.h:265: // Support for profiler.  Notifies the external profiling
process
On 2010/10/18 13:09:42, fschneider wrote:
> Support for _the_ profiler.

Fixed (also above).

http://codereview.chromium.org/3831002/diff/10001/11015#newcode268
src/platform.h:268: // --never-compact) if accurate profiling is desired .
On 2010/10/18 13:09:42, fschneider wrote:
> Extra space before .

Fixed.

Powered by Google App Engine
This is Rietveld 408576698