Get the latest tech news

Profiling with Ctrl-C


I once wrote about how profiler output can be misleading. Someone commented that you don’t need profilers - just Ctrl-C your program in a debugger instead, and you’ll see the call stack where your program probably spends most of its time.

But as my outlook on life worsened with age, I came to think that Ctrl-C profiling deserves a shout-out, because it’s very effective against stupid problems encountered by lazy people operating in unfriendly environments. So I Ctrl-C the thing, and what do you know, there’s one billion stack frames from the nlohmann JSON parser, I guess it all gets inlined in the release build; must be what they call “zero-cost abstraction”. Simulation-based profilers don’t have the problem of losing data to a low sampling frequency - they analyze full instruction traces - but they’re too slow for anything like a production environment.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of profiling

profiling

Photo of Ctrl-C

Ctrl-C

Related news:

News photo

Red Hat Developing "eu-stacktrace" For Profiling Without Frame Pointers

News photo

The right not to be subjected to AI profiling based on publicly available data

News photo

Intel NPU Driver Preparing Hardware Scheduler & Profiling Support