Profiling with Linux perf tool

Linux perf tool can be used to do non-intrusive profiling.

Adding dynamic tracepoints

One can add tracepoints at function entry/exit (and other locations too):

sudo perf probe -x /path/to/  --add rocksdb_prepare
sudo perf probe -x /path/to/  --add rocksdb_prepare%return

Viewing the tracepoints

sudo perf probe -l 

Running the profiler

Something like:

perf record -e 'probe_ha_rocksdb:*' -a  sleep 60

(TODO: -a means system-wide. There's also -p $PID option but one can't select it?)

Examining the trace

perf script


Comments loading...
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.