breadcrumbs: Chromium OS >
Warning: The profiling infrastructure in Chromium OS is new and experimental. You may hit bugs.
The perf_events (aka perf) profiling tools can be used to collect profiles in Chromium OS. This page describes how to run perf on standalone programs, or on autotests.
dev-utils/perf
should be installed by default in the chroot host (NOTE: it may be in /usr/local/sbin instead of /usr/sbin):
$ /usr/sbin/perf --version perf version 2.6.38.1720.g564bb7e
It should also be installed by default on the target board when building a developer image for Chromium OS. If it isn't, you can emerge it manually:
$ sudo emerge-${BOARD} perf
Some things to note:
/build/${BOARD}/usr/lib/debug
.Profiling autotests can be done using run_remote_tests.sh. There are two options you should be interested in:
--profiler: What profiler to use? Example: cros_perf. --profiler_args: Arguments to pass to the profiler. Example: options=\"-e instructions -g\"
For example, to get a profile of AesThroughput using the default perf options, simply do:
$ ./run_remote_tests.sh --remote=172.18.221.163 AesThroughput --profiler=cros_perf
The perf data file will be placed in the autotest results directory when the test completes:
>>> Details stored under /tmp/run_remote_tests.WBFE $ ls /tmp/run_remote_tests.WBFE/platform_AesThroughput/platform_AesThroughput/profiling/iteration.1/ perf.data
You can also pass custom arguments to perf. E.g. to collect instruction events and call graph information:
$ ./run_remote_tests.sh --remote=172.18.221.163 AesThroughput --profile --profiler_args="options=\"-e instructions -g\""
Some things to note:
SSH to your Chromium OS device and run perf record
:
$ sudo perf record -g -a -e cycles -- sleep 5 [ perf record: Woken up 1 times to write data ] [ perf record: Captured and wrote 0.186 MB perf.data (~8115 samples) ]
You can replace sleep with any binary you want to profile. Use perf help record
to see the various options for recording data.
Now copy the data file back to your chroot:
$ scp chronos@chromeos-box:/tmp/perf.data .
Use perf report
to display the profile:
$ /usr/sbin/perf report -i perf.data --symfs /build/${BOARD}/ --kallsyms /build/${BOARD}/boot/System.map-3.3.0
You can pass --tui for a more interactive interface (buggy), or --stdio for text output. Use perf help report
to see the various options for reporting data.
File it: http://crbug.com/new, cc: sonnyrao.