Check out my first novel, midnight's simulacra!

Perf

From dankwiki

For those put off by the baroque interface and daunting learning curve of Oprofile, Ingo Molnár's perf tool (included with the linux kernel since at least version 2.6.30 in tools/perf) is a quick and easy way to get data from x86's performance counters.

You need to have CONFIG_LOCKDEP and CONFIG_LOCK_STAT enabled to use perf lock.

perf stat

  • -r num can be used to run the pass num times, displaying a standard deviation:
 Performance counter stats for './notcurses-demo -k -c ww' (3 runs):

    23,153,745,413      cycles                                                        ( +-  0.64% )
    67,109,369,279      instructions              #    2.90  insn per cycle           ( +-  0.35% )
        86,574,323      cache-misses                                                  ( +-  1.79% )
    10,555,354,499      branches                                                      ( +-  0.35% )

           11.0698 +- 0.0119 seconds time elapsed  ( +-  0.11% )

See Also