• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..--

src/23-Nov-2023-4,0433,516

OWNERSD22-Nov-202319 21

README.mdD23-Nov-20233.2 KiB7655

deploy.shD23-Nov-2023297 1912

expand-all.jpgD22-Nov-20232.8 KiB

hide-selected.pngD22-Nov-20233.6 KiB

hide-unselected.pngD22-Nov-20233.6 KiB

index.htmlD23-Nov-20233.2 KiB6463

layout-icon.pngD22-Nov-20234.5 KiB

left-arrow.pngD22-Nov-20234.1 KiB

live.pngD22-Nov-20233.6 KiB

package-lock.jsonD23-Nov-202338.1 KiB1,0061,005

package.jsonD23-Nov-2023674 3029

right-arrow.pngD22-Nov-20232.7 KiB

rollup.config.jsD23-Nov-2023427 148

search.pngD22-Nov-20233.7 KiB

search2.pngD22-Nov-2023689

tsconfig.jsonD23-Nov-2023846 3332

tsfmt.jsonD23-Nov-2023697 1616

turbo-visualizer.cssD23-Nov-20239 KiB604492

turbolizer.pngD23-Nov-202377.4 KiB

types.pngD22-Nov-2023753

upload-icon.pngD22-Nov-20234.6 KiB

README.md

1Turbolizer
2==========
3
4Turbolizer is a HTML-based tool that visualizes optimized code along the various
5phases of Turbofan's optimization pipeline, allowing easy navigation between
6source code, Turbofan IR graphs, scheduled IR nodes and generated assembly code.
7
8Turbolizer consumes .json files that are generated per-function by d8 by passing
9the '--trace-turbo' command-line flag.
10
11Turbolizer is build using npm:
12
13  npm i
14  npm run-script build
15
16Afterwards, turbolizer can be hosted locally by starting a web server that serve
17the contents of the turbolizer directory, e.g.:
18
19    cd src/tools/turbolizer
20    python -m SimpleHTTPServer 8000
21
22Optionally, profiling data generated by the perf tools in linux can be merged
23with the .json files using the turbolizer-perf.py file included. The following
24command is an example of using the perf script:
25
26    perf script -i perf.data.jitted -s turbolizer-perf.py turbo-main.json
27
28The output of the above command is a json object that can be piped to a file
29which, when uploaded to turbolizer, will display the event counts from perf next
30to each instruction in the disassembly. Further detail can be found in the
31bottom of this document under "Using Perf with Turbo."
32
33Using the python interface in perf script requires python-dev to be installed
34and perf be recompiled with python support enabled. Once recompiled, the
35variable PERF_EXEC_PATH must be set to the location of the recompiled perf
36binaries.
37
38Graph visualization and manipulation based on Mike Bostock's sample code for an
39interactive tool for creating directed graphs. Original source is at
40https://github.com/metacademy/directed-graph-creator and released under the
41MIT/X license.
42
43Icons derived from the "White Olive Collection" created by Breezi released under
44the Creative Commons BY license.
45
46Using Perf with Turbo
47---------------------
48
49In order to generate perf data that matches exactly with the turbofan trace, you
50must use either a debug build of v8 or a release build with the flag
51'disassembler=on'. This flag ensures that the '--trace-turbo' will output the
52necessary disassembly for linking with the perf profile.
53
54The basic example of generating the required data is as follows:
55
56    perf record -k mono /path/to/d8 --trace-turbo --perf-prof main.js
57    perf inject -j -i perf.data -o perf.data.jitted
58    perf script -i perf.data.jitted -s turbolizer-perf.py turbo-main.json
59
60These commands combined will run and profile d8, merge the output into a single
61'perf.data.jitted' file, then take the event data from that and link them to the
62disassembly in the 'turbo-main.json'. Note that, as above, the output of the
63script command must be piped to a file for uploading to turbolizer.
64
65There are many options that can be added to the first command, for example '-e'
66can be used to specify the counting of specific events (default: cycles), as
67well as '--cpu' to specify which CPU to sample.
68
69Turbolizer build process
70------------------------
71
72Turbolizer is currently migrating to TypeScript. The typescript sources reside in
73tools/turbolizer/src, and the typescript compiler will put the JavaScript output
74into tools/turbolizer/build/. The index.html file is set up to load the JavaScript
75from that directory.
76