Re: Oprofile vs. perf vs. gperf
Michael Petlan <[email protected]>
| Newsgroups | gmane.linux.oprofile |
|---|---|
| Organization | Red Hat |
| Message-ID | <1433415662.15036.313.camel@Rudolf-RHEL-7> |
On Thu, 2015-06-04 at 07:10 +0000, Mahmood N wrote: > Hi, > What is the difference among Oprofile, perf-tools and gperf-tools? I > didn't find an study comparing them. Which one is mostly accurate for > AMD processors? Hi, I don't know much about gprof, so maybe someone should add some more information... The aim of OProfile is counting, profiling (sampling), code annotation and callgraph generation, all that based on PMU events generated by CPU. Historically, it supported some software TIMER interrupts, but now, since opcontrol legacy mode has been replaced by operf/ocount tools, the oprofile's source of events is PMU only. OProfile now uses kernel backend for it, it's the same backend as perf uses. Perf tool came later as a part of kernel. Before that oprofile worked in the legacy mode (opcontrol), so some daemon and kernel module had to be enabled before the profiling may have started, etc. When perf came with the kernel backend, oprofile switched to using it as well. Which one is more accurate? Hard to say, in my opinion they should be almost at the same level. Perf can use PMU as well, but it is not the main aim of it. So it has some events predefined (see `perf list hw hwcache` command) and the rest has to be specified by raw numbers like "-e r410e". So that means, that perf can use all the events oprofile can, but many of them are unfriendly to use and you just have to go through your CPU vendor's documentation to see what numbers to put there. Perf can also use so called "tracepoint" events (see `perf list tracepoint` (you have to be root to run it)), which are mapped to some kernel trace points. You can also probe functions (similar to systemtap), trace syscalls (like strace), do some NUMA benchmarking and many other things. Compare the following: ocount ls perf stat -e cycles ls The numbers should be similar. If you see differences there, it's not because perf or oprofile are imprecise compared to the other tool, but the reason is rather that in each run is a bit different and CPU can pre-cache something, etc. As I understand, gprof is a bit different tool which needs to be used also at the compilation time, so the application is instrumented by it before it is built. When you are profiling with `operf` or `perf record` you don't need anything special, just if you have the debuginfo, you can see the symbols in the report, otherwise you will see addresses... I hope I have explained it a bit. Regards, Michael > > Regards, > Mahmood > ------------------------------------------------------------------------------ > _______________________________________________ > oprofile-list mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/oprofile-list ------------------------------------------------------------------------------