Skip to content

Prior art

Clark Gaebel edited this page Apr 19, 2022 · 7 revisions

magic-trace mostly steals great ideas from other people. In this page, we list previous attempts by others to do similar things, and discuss how their approach differs from magic-trace's.

You can use perf directly to view Intel PT traces. This is what magic-trace does under the hood, it just displays it differently.

The main advantage of using perf over magic-trace is that it does more than magic-trace, and more reliably. magic-trace uses perf so all of perf's bugs are magic-trace's, and only some of perf's functionality is exposed to magic-trace. The disadvantage is that you don't get the cool trace viewer, and the UI is less accessible to non-experts.

Flame Graphs are the first attempt I know of to translate linear profiles results into call stacks. To say they're an inspiration is an understatement; they've been an inspiration for basically every performance tool since.

They work natively with perf, and are based on sampling call stacks. One key distinction from magic-trace is that the X axis is not time. You can still easily see what your application did in aggregate, but not a timeline of what happened.

RAD Telemetry is what we wish we had to visualize these traces. This tool is extremely responsive and the traces are space efficient. RAD Telemetry is something we aspire to; it's just beautiful.

The main distinction from magic-trace, other than the slick UI, is:

  • You either need to sample or manually instrument your code. It doesn't discover all control flow automatically like magic-trace does.
  • It's probably expensive? Their licensing story is "email us".

We deeply regret that magic-trace doesn't work on Windows, if only because it means game-devs don't get to easily use it.

Speedscope allows users to visualize a timeline of stack frames, just like magic-trace. The main distinction between the two is that magic-trace uses Intel PT to trace all control flow, whereas speedscope uses perf to periodically sample stack frames.

The advantages of speedscope are:

  • it works everywhere perf works
  • you see the complete stack frame instead of just stack frames that had active control flow during the trace
  • the data rate is lower, so it's feasible to collect traces over longer periods of time

pprof is a tool for visualizing profiles, generated from any source. One source is perf profiles, but it defines a flexible protobuffer format for profiles (roughly, repeated samples with data and stack traces) which any profiling tool can generate.

It takes these profiles and visualizes them with an innovative DAG format, giving much better visibility than perf report into the weight of various sections of a profile, and allows powerful filtering.

Its primary downside relative to magic-trace is that it works on sampled profiles, not traces.