From: "Martin Liška" <mliska@suse.cz>
To: Andi Kleen <andi@firstfloor.org>
Cc: linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org,
Arnaldo Carvalho de Melo <acme@kernel.org>
Subject: Re: [RFC] Add --show-total-period for perf annotate
Date: Wed, 27 May 2015 11:04:39 +0200 [thread overview]
Message-ID: <556588A7.5070003@suse.cz> (raw)
In-Reply-To: <55658462.1000605@suse.cz>
On 05/27/2015 10:46 AM, Martin Liška wrote:
> On 05/26/2015 07:03 PM, Andi Kleen wrote:
>>> Anyway, attached patch is capable of displaying milliseconds approximation for each instruction.
>>
>> You realize that the events perf is not counting do not directly map to
>> wall time? Even if you count cycles, the cycles are either stopping in idle
>> or changing unit as the CPU's frequencies change. For other events the
>> relationship is even more remote, think what happens when counting cache or
>> TLB misses.
>>
>> Also even if it was mapping to time somehow, it's just a hit, not a
>> duration, so it cannot say how long a individual instruction took.
>>
>> So you cannot map a sample event to time.
>>
>> To do what you want you would need to use something like processor
>> trace, which can do exact accounting.
>>
>> I think the only thing that makes sense is to account it relative to
>> the event counts.
>>
>> -Andi
>>
>
> Hello Andi.
>
> I realize all aspects and capabilities of perf infrastructure. Even though
> these numbers are not precise, I helped me a lot with debugging of a benchmark
> which heavily utilizes a single CPU and runs in magnitude of seconds.
>
> Ok, so let's convert the patch to feature that we can map an instruction
> to a percentage number of events (cycles) it takes.
>
> If I understand correctly, is it just about division of the number of events
> related to an instruction and total number of events?
>
> Thanks,
> Martin
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-perf-users" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
Hi.
Sample output to verify that we have the same idea in mind:
$ perf annotate --show-total-period
Disassembly of section .text:
:
: 0000000000038890 <random_r>:
: __random_r():
1695 : 38890: test %rdi,%rdi
0 : 38893: je 38918 <random_r+0x88>
1 : 38899: test %rsi,%rsi
0 : 3889c: je 38918 <random_r+0x88>
9 : 3889e: mov 0x18(%rdi),%eax
1833 : 388a1: mov 0x10(%rdi),%rdx
2 : 388a5: test %eax,%eax
0 : 388a7: je 388f8 <random_r+0x68>
168 : 388a9: mov (%rdi),%rcx
8 : 388ac: mov 0x8(%rdi),%r8
1325 : 388b0: mov 0x28(%rdi),%r9
Where:
$ perf report | head
# To display the perf.data header info, please use --header/--header-only options.
#
# Samples: 44K of event 'cycles'
# Event count (approx.): 42988831618
Thank for ideas,
Martin
next prev parent reply other threads:[~2015-05-27 9:04 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-22 14:39 [RFC] Add --show-total-period for perf annotate Martin Liška
2015-05-23 4:08 ` Andi Kleen
2015-05-25 7:46 ` Martin Liška
2015-05-25 15:14 ` Andi Kleen
2015-05-26 12:34 ` Martin Liška
2015-05-26 17:03 ` Andi Kleen
2015-05-27 8:46 ` Martin Liška
2015-05-27 9:04 ` Martin Liška [this message]
2015-05-27 14:04 ` Andi Kleen
2015-05-29 12:58 ` Martin Liška
2015-05-29 15:55 ` Andi Kleen
2015-06-01 11:08 ` Martin Liška
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=556588A7.5070003@suse.cz \
--to=mliska@suse.cz \
--cc=acme@kernel.org \
--cc=andi@firstfloor.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).