Profiling with Linux perf tool

You are viewing an old version of this article. View the current version here.

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

h2. Adding dynamic tracepoints

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

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

h2. Viewing the tracepoints

sudo perf probe -l 

h2. 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?)

h2. Examining the trace

perf script

Comments

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.