node/deps/v8/tools/turbolizer
Michaël Zasso ec02b811a8 deps: update V8 to 5.4.500.27
Pick up latest commit from the 5.4-lkgr branch.

deps: edit V8 gitignore to allow trace event copy
deps: update V8 trace event to 315bf1e2d45be7d53346c31cfcc37424a32c30c8
deps: edit V8 gitignore to allow gtest_prod.h copy
deps: update V8 gtest to 6f8a66431cb592dad629028a50b3dd418a408c87

PR-URL: https://github.com/nodejs/node/pull/8317
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com>
2016-09-22 09:51:19 +02:00
..
code-view.js deps: update V8 to 5.4.500.27 2016-09-22 09:51:19 +02:00
constants.js deps: update V8 to 5.4.500.27 2016-09-22 09:51:19 +02:00
disassembly-view.js deps: update V8 to 5.4.500.27 2016-09-22 09:51:19 +02:00
edge.js deps: update V8 to 5.4.500.27 2016-09-22 09:51:19 +02:00
empty-view.js deps: update V8 to 5.4.500.27 2016-09-22 09:51:19 +02:00
expand-all.jpg deps: update V8 to 5.4.500.27 2016-09-22 09:51:19 +02:00
graph-layout.js deps: update V8 to 5.4.500.27 2016-09-22 09:51:19 +02:00
graph-view.js deps: update V8 to 5.4.500.27 2016-09-22 09:51:19 +02:00
hide-selected.png deps: update V8 to 5.4.500.27 2016-09-22 09:51:19 +02:00
hide-unselected.png deps: update V8 to 5.4.500.27 2016-09-22 09:51:19 +02:00
index.html deps: update V8 to 5.4.500.27 2016-09-22 09:51:19 +02:00
lang-disassembly.js deps: update V8 to 5.4.500.27 2016-09-22 09:51:19 +02:00
layout-icon.png deps: update V8 to 5.4.500.27 2016-09-22 09:51:19 +02:00
left-arrow.png deps: update V8 to 5.4.500.27 2016-09-22 09:51:19 +02:00
live.png deps: update V8 to 5.4.500.27 2016-09-22 09:51:19 +02:00
monkey.js deps: update V8 to 5.4.500.27 2016-09-22 09:51:19 +02:00
node.js deps: update V8 to 5.4.500.27 2016-09-22 09:51:19 +02:00
OWNERS deps: update V8 to 5.4.500.27 2016-09-22 09:51:19 +02:00
README.md deps: update V8 to 5.4.500.27 2016-09-22 09:51:19 +02:00
right-arrow.png deps: update V8 to 5.4.500.27 2016-09-22 09:51:19 +02:00
schedule-view.js deps: update V8 to 5.4.500.27 2016-09-22 09:51:19 +02:00
search2.png deps: update V8 to 5.4.500.27 2016-09-22 09:51:19 +02:00
search.png deps: update V8 to 5.4.500.27 2016-09-22 09:51:19 +02:00
selection-broker.js deps: update V8 to 5.4.500.27 2016-09-22 09:51:19 +02:00
selection.js deps: update V8 to 5.4.500.27 2016-09-22 09:51:19 +02:00
text-view.js deps: update V8 to 5.4.500.27 2016-09-22 09:51:19 +02:00
turbo-visualizer.css deps: update V8 to 5.4.500.27 2016-09-22 09:51:19 +02:00
turbo-visualizer.js deps: update V8 to 5.4.500.27 2016-09-22 09:51:19 +02:00
types.png deps: update V8 to 5.4.500.27 2016-09-22 09:51:19 +02:00
upload-icon.png deps: update V8 to 5.4.500.27 2016-09-22 09:51:19 +02:00
util.js deps: update V8 to 5.4.500.27 2016-09-22 09:51:19 +02:00
view.js deps: update V8 to 5.4.500.27 2016-09-22 09:51:19 +02:00

Turbolizer

Turbolizer is a HTML-based tool that visualizes optimized code along the various phases of Turbofan's optimization pipeline, allowing easy navigation between source code, Turbofan IR graphs, scheduled IR nodes and generated assembly code.

Turbolizer consumes .json files that are generated per-function by d8 by passing the '--trace-turbo' command-line flag.

Host the turbolizer locally by starting a web server that serves the contents of the turbolizer directory, e.g.:

cd src/tools/turbolizer
python -m SimpleHTTPServer 8000

Optionally, profiling data generated by the perf tools in linux can be merged with the .json files using the turbolizer-perf.py file included. The following command is an example of using the perf script:

perf script -i perf.data.jitted -s turbolizer-perf.py turbo-main.json

The output of the above command is a json object that can be piped to a file which, when uploaded to turbolizer, will display the event counts from perf next to each instruction in the disassembly. Further detail can be found in the bottom of this document under "Using Perf with Turbo."

Using the python interface in perf script requires python-dev to be installed and perf be recompiled with python support enabled. Once recompiled, the variable PERF_EXEC_PATH must be set to the location of the recompiled perf binaries.

Graph visualization and manipulation based on Mike Bostock's sample code for an interactive tool for creating directed graphs. Original source is at https://github.com/metacademy/directed-graph-creator and released under the MIT/X license.

Icons derived from the "White Olive Collection" created by Breezi released under the Creative Commons BY license.

Using Perf with Turbo

In order to generate perf data that matches exactly with the turbofan trace, you must use either a debug build of v8 or a release build with the flag 'disassembler=on'. This flag ensures that the '--trace-turbo' will output the necessary disassembly for linking with the perf profile.

The basic example of generating the required data is as follows:

perf record -k mono /path/to/d8 --turbo --trace-turbo --perf-prof main.js
perf inject -j -i perf.data -o perf.data.jitted
perf script -i perf.data.jitted -s turbolizer-perf.py turbo-main.json

These commands combined will run and profile d8, merge the output into a single 'perf.data.jitted' file, then take the event data from that and link them to the disassembly in the 'turbo-main.json'. Note that, as above, the output of the script command must be piped to a file for uploading to turbolizer.

There are many options that can be added to the first command, for example '-e' can be used to specify the counting of specific events (default: cycles), as well as '--cpu' to specify which CPU to sample.