Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what's the difference between perf command and perfmon2 or libpfm4

recently I am digging things around performance counter. And I googled up the perfmon2 and libpfm4 http://perfmon2.sourceforge.net/ and I also found perf command https://perf.wiki.kernel.org/index.php/Main_Page and shipped out with linux's kernel source code. the perf source code link I played both libpfm4 and perf command, and libpfm4 seems can only provide cpu's cycles count or instructions count.

I can't found any example code or runnable example of how to retrieve information like L1-dcache-loads which seems obtainable by using perf, I looked it up on stackoverflow and found articles discussing the relationship between perf command and libpfm4 :Using Hardware Performance Counters in Linux People said the author of libpfm4 was angry with one of the perf command's contributor Ingo but later on he actually helping review the perf's code.

So can some one explain what's relationship between perfmon2 or libpfm4 with perf command. And can I retrieve information like L1-dcache using libpfm4 just like use perf command. Thank you very much!

like image 436
dotcomXY Avatar asked Oct 02 '12 03:10

dotcomXY


1 Answers

The perf command provides a subset of common performance counter events to measure such as processor clock cycles, instructions counts, and cache event metrics. However, most processors provide many other implementation specific hardware events such a floating point operations and microarchitecture events (such as stalls due to hardware resource limits). To access those implementation specific events one needs to use the raw event in perf (http://lxr.linux.no/#linux+v3.6/tools/perf/Documentation/perf-record.txt#L33), which can be tedious. libpfm4 provides a mapping mechanism to refer to those implementation specific hardware events by name. libpfm is used by papi. You might take a look to see how papi uses libpfm to access those implementation specific events (http://icl.cs.utk.edu/projects/papi/)

like image 128
William Cohen Avatar answered Oct 25 '22 18:10

William Cohen