TraceVis is a performance visualization system for TraceMonkey. If TraceMonkey is built with TraceVis, and run with TraceVis enabled, then TraceMonkey will output a log of all its activity transitions. The log can be postprocessed into a visualization that can be used to rapidly diagnose many tracing-related performance issues.

So far, most of the documentation on TraceVis is contained in the announcement blog post.

Prerequisites

The visualization scripts require PIL (Python Imaging Library).

Building with TraceVis

These are the steps to build a JS shell with TraceVis, starting from a Mozilla source directory. These directions create an optimized build, because optimized builds are usually better for performance analysis.

cd js/src
autoconf213
mkdir opt-tracevis
cd opt-tracevis
../configure --enable-tracevis
make -j2

The resulting binary will be at dist/bin/js relative to the current directory.

Running with TraceVis

To run a shell with TraceVis:

dist/bin/js -j -T /tmp/tracevis.log myprogram.js

The TraceVis log file is a binary file consisting of a sequence of 8-byte records. There are two scripts for postprocessing the log files in js/src/tracevis.

Text Summary

python binlog.py /tmp/tracevis.log

This prints a summary of the log. The first part lists the time TraceMonkey spent in each major tracing activity. The second part lists the reasons TraceMonkey transitioned to the interpreter, and the amount of interpreter time charged to each reason.

Visualization

python vis.py /tmp/tracevis.log /tmp/tracevis.png

This creates a PNG format visualization of TraceMonkey activities. There is a color for each activity. Time goes forward down each column of pixels, then to the column on the right. The blog post linked above has examples of this output and how to analyze it.