Sample based - These are profilers that run without modifying the binaries they gather measurementation on. Typically time (cpu cycles) are used to determine when to take a sample. A sample can be a stack trace, current performance counters, or anything else for that matter. Sampling can also be done on events other than time like system calls, L2 cache miss, … When the preset value of time expires or the set number of L2 cache misses happens a sample is taken.

Instrumentation based profilers - These profilers will modify your binary typically around function entry / exit to gather call stacks. Just like sample based profilers other information can be collected as well.

When to use sample vs instrumenation based profilers:

  • Sample based - Good for CPU bound problems,
  • Instrumentation based profilers - Good for I/O, idle wait, memory, …
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License