interpret the result of perf stat

Zheng Da zhengda1936 at gmail.com
Mon Oct 10 15:24:18 EDT 2011


The link below gives a very good user guide of perf.
http://code.google.com/p/kernel/wiki/PerfUserGuide#Sampling_with_perf_record

Da

On Sun, Oct 9, 2011 at 10:11 PM, Peter Teoh <htmldeveloper at gmail.com> wrote:
> This is from LinuxKongress 2010:
>
> The New Linux 'perf' Tools - Vger
>
> http://vger.kernel.org/~acme/perf/lk2010-perf-paper.pdf
>
> http://www.linux-kongress.org/2010/slides/lk2010-perf-acme.pdf
>
> Enjoy....
>
> On Sun, Oct 9, 2011 at 2:42 AM, Zheng Da <zhengda1936 at gmail.com> wrote:
>> Hey Peter,
>>
>> If you are talking about the documentation of performance counters, we
>> can find very complete reference
>> http://software.intel.com/sites/products/documentation/hpc/amplifierxe/en-us/lin/ug_docs/reference/index.htm
>>
>> Thanks,
>> Da
>>
>> On Sat, Oct 8, 2011 at 11:18 AM, Peter Teoh <htmldeveloper at gmail.com> wrote:
>>>
>>>
>>> On Thu, Oct 6, 2011 at 10:39 PM, Zheng Da <zhengda1936 at gmail.com> wrote:
>>>>
>>>> Thank you, Peter. I didn't realize Intel has explained all performance
>>>> counters in its manual, and I was desperately looking for more
>>>> detailed explanation on the Internet.
>>>>
>>>> On Mon, Oct 3, 2011 at 11:19 PM, Peter Teoh <htmldeveloper at gmail.com>
>>>> wrote:
>>>> >
>>>> >
>>>> > On Tue, Oct 4, 2011 at 9:53 AM, Peter Teoh <htmldeveloper at gmail.com>
>>>> > wrote:
>>>> >>
>>>> >> On Sun, Oct 2, 2011 at 5:07 AM, Zheng Da <zhengda1936 at gmail.com> wrote:
>>>> >> > Hello,
>>>> >> >
>>>> >> > I start to use perf to profile my program, but I'm not quite sure if
>>>> >> > I
>>>> >> > understand some events.
>>>> >>
>>>> >> Firstly perf is using hardware to read these performance information.
>>>> >> So
>>>> >> for intel CPU, depending on the different model, u can find the
>>>> >> relevant
>>>> >> information in the reference manual from Intel here:
>>>> >>
>>>> >> http://www.intel.com/Assets/en_US/PDF/manual/248966.pdf
>>>> >>
>>>> >> In particular, the various model of Intel CPU is listed in page xvii,
>>>> >> and
>>>> >> along with it are the various performance information u can extract out
>>>> >> -
>>>> >> the last item is the BUS information (B.6.10).
>>>> >>
>>>> >> > First, perf can profile bus cycles. Is it the bus cycles of FSB?
>>>> >> > Second, what is task clock? It seems to me that task clock is the
>>>> >
>>>> > task clock, from reading the implementation in kernel/events/core.c, i
>>>> > suspect is a software event, not hardware.   Ie, it counts upon each
>>>> > task
>>>> > switch.   To quote from core.c:
>>>> > /*
>>>> >  * Software event: task time clock
>>>> >  */
>>>> > static void task_clock_event_update(struct perf_event *event, u64 now)
>>>> > {
>>>> >
>>>> > More details here:
>>>> > http://lwn.net/Articles/312720/
>>>> >
>>>> >>
>>>> >> > ticks used by a process. It should include the ticks used in the
>>>> >> > kernel mode and the user space mode, as long as it is used in the
>>>> >> > context of the process. I suppose it doesn't count the cycles used by
>>>> >> > the interrupts such as page faults and softirq, even though the irqs
>>>> >> > are caused by the process. Is it correct?
>>>> >
>>>> > on the contrary, i think it should include, as to exclude these cycles
>>>> > does
>>>> > entail stopping the hrtimer.....read into core.c further.
>>>> I'm disappointed that the information isn't documented somewhere. The
>>>> developers shouldn't expect users to read the code to understand how
>>>> to use the tool :(
>>>>
>>>
>>> i suspect it is documented in many places, at here is one good one:
>>> http://developer.apple.com/library/IOS/#documentation/DeveloperTools/Conceptual/SharkUserGuide/MiscellaneousTopics/MiscellaneousTopics.html#//apple_ref/doc/uid/TP40005233-CH14-SW3
>>> and from the side, looking at Appendix A, u can see a table of all the
>>> PerfCounters for ARM11, and then another section will list out for Intel,
>>> and then PPC etc.....
>>>
>>>>
>>>> BTW, is there any wiki where people can share what they found in the
>>>> kernel?
>>>>
>>>> Thanks,
>>>> Da
>>>
>>>
>>>
>>> --
>>> Regards,
>>> Peter Teoh
>>>
>>
>
>
>
> --
> Regards,
> Peter Teoh
>



More information about the Kernelnewbies mailing list