Access The Performance-Counter On Ubuntu Linux
Access The Performance-Counter On Ubuntu Linux
Performance Counters for Linux (PCL) is a new kernel-based subsystem that provides a framework for
collecting and analyzing performance data. These events will vary based on the performance
monitoring hardware and the software configuration of the system. Linux includes this kernel
subsystem to collect data and the user-space tool perf to analyze the collected performance data.
Profiling is achieved by instrumenting either the program source code or its binary executable form
using a tool called a profiler (or code profiler).
Linux support many profiling tools like perf, trace-cmd, blktrace, strace and oprofile.
target
target
Enable PMU setting in Device tree Perf events can be enable in the exynos5422_evt0.dtsi.
target
+ arm-pmu {
+ /* compatible = "arm,cortex-a15-pmu";
+ interrupt-parent = <&combiner>;
+ interrupts = <1 2>, <7 0>, <16 6>, <19 2>;
+ */
+ ompatible = "arm,cortex-a7-pmu";
+ interrupt-parent = <&gic>;
+ interrupts = <0 192 4>, <0 193 4>, <0 194 4>, <0 195
4>;
+ };
+
watchdog@10020000 {
compatible = "samsung,s3c2410-wdt";
reg = <0x101D0000 0x100>;
Note: Perf counters for arm,cotrex-a7-pmu is supported in the kernel. But not for arm,cortex-a15-pmu.
Once kernel is build using above config flags. Perf could be install using following command. If the
distribution supports it.
target
Otherwise you need to build the took from the kernel source code tree.
target
target
$ cp perf /usr/bin/
target
$ perf list
perf tool measures the performance of the application and trace down to the kernel event that got
triggers.
perf help
target
(latencies)
script Read perf.data (created by perf record) and display
trace out
put
stat Run a command and gather performance counter
statistics
test Runs sanity tests.
timechart Tool to visualize total system behavior during a
workload
top System profiling tool.
trace strace inspired tool
probe Define new dynamic tracepoints
Perf Example
Perf stats:
target
Perf top:
Suppose we want to run-time analyses of the kernel events just like user space top/htop use below
command.
perf top -z
target
~# perf top -z
Samples: 127K of event 'cpu-clock', Event count (approx.): 3315322731
98.92% [kernel].head.text [k] 0xc0023f10
0.08% perf [.] sort__dso_cmp
0.07% perf [.] perf_top__mmap_read_idx
0.06% perf [.] perf_evsel__parse_sample
0.06% libc-2.21.so [.] memset
0.06% perf [.] perf_evlist__mmap_read
0.05% perf [.] add_hist_entry.isra.8
0.05% libpthread-2.21.so [.] pthread_mutex_lock
0.05% libslang.so.2.3.0 [.] 0x000630ce
0.04% perf [.] perf_event__preprocess_sample
0.03% libpthread-2.21.so [.] __pthread_mutex_unlock_usercnt
0.03% libslang.so.2.3.0 [.] SLsmg_write_chars
0.03% perf [.] symbols__insert
0.03% libc-2.21.so [.] __libc_calloc
0.03% perf [.] maps__find
0.03% libc-2.21.so [.] strstr
0.02% libc-2.21.so [.] strcmp
0.02% perf [.] dump_printf
0.02% perf [.] dso__find_symbol
0.01% perf [.] symbol_filter
Note: You can watch all the supported list events on the perf top.
target
Perf record
perf record is use to record the kernel event into perf.data, that file can then be analyzed, possibly on
another machine, using the perf report and perf annotate commands.
target
Perf report
Samples collected by perf record are saved into a binary file called, by default, perf.data. The perf
report command reads this file and generates a concise execution profile.
</code>
External Links
https://perf.wiki.kernel.org/index.php/Tutorial
http://www.brendangregg.com/perf.html
http://forum.odroid.com/viewtopic.php?f=61&t=2393
From:
https://wiki.odroid.com/ - ODROID Wiki
Permanent link:
https://wiki.odroid.com/odroid-xu4/application_note/software/linux_performance_counter