v8/tools/turbolizer
Alexander.Gilday2 6e01fe20da [turbolizer] Fixed naming of turbolizer perf script.
Change was meant to be in previous patch but was accidentally reverted.
README.md updated with new filename, also.

BUG=

Review-Url: https://codereview.chromium.org/2184223005
Cr-Commit-Position: refs/heads/master@{#38134}
2016-07-28 12:38:00 +00:00
..
code-view.js [turbolizer] Improve code comments in disassembly 2016-07-11 08:28:22 +00:00
constants.js [turbolizer] Add support for showing perf profiling information. 2016-07-28 09:42:38 +00:00
disassembly-view.js [turbolizer] Add support for showing perf profiling information. 2016-07-28 09:42:38 +00:00
edge.js
empty-view.js
expand-all.jpg
graph-layout.js [turbolizer] Redetermine graph bounding box after dragging a node. 2016-07-25 14:22:23 +00:00
graph-view.js [turbolizer] Remember the last phase, search query, and pane expansions. 2016-07-26 11:47:24 +00:00
hide-selected.png
hide-unselected.png
index.html [turbolizer] Add support for showing perf profiling information. 2016-07-28 09:42:38 +00:00
lang-disassembly.js
layout-icon.png
left-arrow.png
monkey.js
node.js [turbolizer] Show a label with a shorter parameter for some opcodes. 2016-07-15 12:07:43 +00:00
OWNERS
README.md [turbolizer] Fixed naming of turbolizer perf script. 2016-07-28 12:38:00 +00:00
right-arrow.png
schedule-view.js [turbolizer] Fully parse schedule data. 2016-06-21 15:18:40 +00:00
search2.png
search.png
selection-broker.js
selection.js [turbolizer] Performance improvements for selection in graph & schedule 2016-06-22 10:11:39 +00:00
text-view.js [turbolizer] Improve code comments in disassembly 2016-07-11 08:28:22 +00:00
turbo-visualizer.css [turbolizer] Add support for showing perf profiling information. 2016-07-28 09:42:38 +00:00
turbo-visualizer.js [turbolizer] Add support for showing perf profiling information. 2016-07-28 09:42:38 +00:00
types.png
upload-icon.png
util.js [turbolizer] Factor out some user actions into methods of GraphView. 2016-07-25 14:25:46 +00:00
view.js [turbolizer] Add support for showing perf profiling information. 2016-07-28 09:42:38 +00: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.