• No replies
1 Post

Pinned topic Quick & simple performance gathering

‏2013-10-01T14:17:25Z | oprofile


I'm sharing a simple script to easily gather some data that could give insight into the bottlenecks of a workload.  There are tons of tools (and scripts) available for performance monitoring on linux, feel free to share what you use.

To gather CPI for some heavily-used system-wide symbols:

# run as root, or modify with sudo/su -c

$CMD="workload to run"

opcontrol  -c 0  --vmlinux=/path/to/vmlinux  --separate=kernel

opcontrol -e PM_RUN_INST_CMPL_GRP1:1000000 -e PM_RUN_CYC_GRP1:1000000

opcontrol --reset                                 #  overwrite existing oprofile data

opcontrol --start-daemon

opcontrol -s; $CMD; opcontrol -h                  # run workload

opreport -p /lib/modules/2.6.32-...  -gl > oprof.out  # grab report, link module debuginfo

awk 'BEGIN {print "Top offenders:\n \
CPI\t% cyc.\t% instr.\timage\t\t\tsymbol"} \
$1 ~ /[0-9]+/ && $4>=1 \
{printf(" %.2f\t %.2f\t %.2f\t\t%s\t\t\t%s\n", $1/$3, $2, $4, $(NF-2), $NF)}' \
oprof.out                            # parse output, show only symbols using > 1% of run cycles


Updated on 2013-10-01T14:17:59Z at 2013-10-01T14:17:59Z by victorvp