4 ms·
I use explicit instrumenting APIs to generate flamegraphs a lot - useful for a lot of niches in gamedev - where we care about individual frames exceeding their
by MaulingMonkey 9y ago
I use explicit instrumenting APIs to generate flamegraphs a lot - useful for a lot of niches in gamedev - where we care about individual frames exceeding their frame budget. Being able to capture several thousand frames worth of flame graphs and then being able to drill down into the individual outliers is absolutely killer in this context. Sampling profilers are great for getting a broad idea of where problems might be, but not nearly as good as instrumented options when you really want detail. For example:
- Finding where we checked a file for modification on the main thread every few seconds, to consider reloading resources, causing us a 5ms spike that would sometimes cause us to miss vsync.
- Spotting a framerate hitch caused by the main thread stalling out on a contested logging lock under some specific set of circumstances for a frame or two.
- Spotting frames where overly aggressive background jobs simply starved the main thread out of CPU cycles.
- Which specific subanimations of a set (complete with names because I'm using an explicit API that lets me annotate them) are causing our optimization code to exhibit O(scary) behavior.
There's nothing here that you couldn't eventually figure out and solve with a debugger and a sampling profiler, but instrumenting profilers - and profiler APIs that let you add your own annotations - make the job way easier in my experience.
- blt 9y agoThis is a great answer, thanks!