Heads up!

spall isn't mobile-friendly due to the serious memory and screen constraints most mobile devices have. If you're not on a desktop, you should use one for this instead!

What is Spall?

Spall is a tool for viewing traces that runs in your browser, and a small header-only C library for tracing your projects.

The Short Notes

  • Supports chrome, dtrace and C/C++ backends
  • Runs as fast as your monitor does
  • Can handle up to 2 GB JSON traces
  • Supports chrome devtools sampling data
  • Gives you handy runtime stats

Getting Started With Spall

For Web-Profiler Vets

If you're an old-hat with chrome://tracing, speedscope, or perfetto, you should feel right at home. Spall supports most of the chrome://tracing/speedscope/perfetto JSON format. You should be able to get off and running with your existing files and JSON trace dumping code. If you use chrome's sampling profiler for bigger captures and you're struggling to view them, Spall can ingest and display those files too!

For Everybody Else

If you want to learn to use Spall and get a quick briefer on profilers, keep reading!

Profilers typically come in two flavors, sampling and tracing. Spall is a frontend with support for both tracing and sampling profiler libraries. Spall is mostly used for tracing, where function begin and ends get timed and written to a file. Sampling, where the profiler takes a snapshot of your program on an interval, can be a little easier to configure but can miss shorter-lived functions completely, and provides very little data for programs with short runtimes.

Spall includes a small, single-header C library, to make tracing easy. For relatively simple programs using clang or gcc, you can use -finstrument-functions to instrument your whole program quickly. For more complex programs, you might want to manually instrument specific parts of your code to reduce your trace sizes and keep your runtimes a little more accurate.

The common advice for profilers is to sample first, and then trace sparingly to narrow in on the problem, but if your traces are cheap enough (Spall's traces are around ~12 ns per function for coffeelake-mobile CPUs when configured correctly), with auto-tracing you can often skip right to tracing and get far more useful data. Hopefully Spall's native version will be shippable soon, so you'll be able to trace bigger programs happily. With the native version prototype as-is, along with `-finstrument-functions` instrumentation, Spall's library can push and display least 8 million functions per second, tracing all of the Odin compiler's 100 million function-calls that get run while compiling Spall itself.

There are some very simple examples to get started with tracing! (If you can't bind against the C header in your project, don't worry, more language support is planned soon!)

If you want to sample and you're on a platform with dtrace support, there's a lovely community supported library, dtrace2spall, that you can use to get started without changing your code.

If you're a webdev, you've used the chrome devtools performance tab to profile your website before, and you wanted to get a *little* more information out of that trace, or just not have it stutter when you zoom, you can export it and drop it into spall! Just hit the Save Profile button in the top left, and then drag and drop it into the interface

Spall demoed live at the Handmade Seattle conference, going head-to-head against perfetto, and handily won, with buttery smooth frames and tiny load-times for huge files!

Check out more excellent talks and demos like Spall over at Handmade Seattle's Video Guide

Basic Features

Once you've got your program instrumented, you can drag-and-drop or click "open file" at the top left, and select your spall or json file, and get started.

Navigation

Clicking and dragging moves the view around and scrolling zooms in and out

Event Selection

Clicking on an event brings up some basic information about it

Event Multiselection

Shift-click allows you to select a chunk of events to run stats on

Get All Stats

Clicking on the "get stats for the whole file" button at the top left runs stats for your whole program

That's All!

You've got the basics at this point, go have fun!

Extra Goodies

The web-version of Spall is available on github if you want to go play with the source yourself!