Hi all,
I'm trying use perf tool from the linux kernel package to measure
several raw PMU events. In the manpage of perf-record there is an "-l"
option (Scale counter values), which is useful for my case because I
want to know the total counter value, not just sample count. However
it seems the -l is not recognized, is this expected? How can I get a
total count?
Another question is that how can I specify multiple events and use
different sample-after value for each of them? like perf record -c
10000,2000000,2000000 -e r2d4,r03c,r0c0
thank you
2012-02-22 10:59 AM, Yuanfang Chen wrote:
> Hi all,
>
Hi,
> I'm trying use perf tool from the linux kernel package to measure
> several raw PMU events. In the manpage of perf-record there is an "-l"
> option (Scale counter values), which is useful for my case because I
> want to know the total counter value, not just sample count. However
> it seems the -l is not recognized, is this expected? How can I get a
> total count?
>
"perf report --show-total-period" will be your friend.
BTW, it seems you were using old version of perf (and kernel too, maybe).
I have no idea if your perf wouldn't support the option. :)
The "-l" option was meaningful only if you specified events more than the
actual number of counters in the PMU.
> Another question is that how can I specify multiple events and use
> different sample-after value for each of them? like perf record -c
> 10000,2000000,2000000 -e r2d4,r03c,r0c0
>
It's not possible now. You should run a number of instances of perf for
that purpose AFAIK.
Thanks,
Namhyung
Namhyung Kim <[email protected]> wrote:
>
> 2012-02-22 10:59 AM, Yuanfang Chen wrote:
>> Hi all,
>>
>
> Hi,
>
>
>> I'm trying use perf tool from the linux kernel package to measure
>> several raw PMU events. In the manpage of perf-record there is an "-l"
>> option (Scale counter values), which is useful for my case because I
>> want to know the total counter value, not just sample count. However
>> it seems the -l is not recognized, is this expected? How can I get a
>> total count?
>>
>
> "perf report --show-total-period" will be your friend.
>
Or else, why not simply run "perf stat"?
Thanks,
Namhyung
On Wed, Feb 22, 2012 at 1:01 AM, Namhyung Kim <[email protected]> wrote:
> 2012-02-22 10:59 AM, Yuanfang Chen wrote:
>>
>> Hi all,
>>
>
> Hi,
>
>
>
>> I'm trying use perf tool from the linux kernel package to measure
>> several raw PMU events. In the manpage of perf-record there is an "-l"
>> option (Scale counter values), which is useful for my case because I
>> want to know the total counter value, not just sample count. However
>> it seems the -l is not recognized, is this expected? How can I get a
>> total count?
>>
>
> "perf report --show-total-period" will be your friend.
>
> BTW, it seems you were using old version of perf (and kernel too, maybe).
> I have no idea if your perf wouldn't support the option. :)
You are right. my perf version is 3.0.0, just updated to 3.3.0-rc4.
--show-total-period works now.
>
> The "-l" option was meaningful only if you specified events more than the
> actual number of counters in the PMU.
So -l is for multiplexing?
>
>
>
>> Another question is that how can I specify multiple events and use
>> different sample-after value for each of them? like perf record -c
>> 10000,2000000,2000000 -e r2d4,r03c,r0c0
>>
>
> It's not possible now. You should run a number of instances of perf for
> that purpose AFAIK.
>
>
> Thanks,
> Namhyung
On Wed, Feb 22, 2012 at 6:40 AM, Namhyung Kim <[email protected]> wrote:
> Namhyung Kim <[email protected]> wrote:
>>
>> 2012-02-22 10:59 AM, Yuanfang Chen wrote:
>>> Hi all,
>>>
>>
>> Hi,
>>
>>
>>> I'm trying use perf tool from the linux kernel package to measure
>>> several raw PMU events. In the manpage of perf-record there is an "-l"
>>> option (Scale counter values), which is useful for my case because I
>>> want to know the total counter value, not just sample count. However
>>> it seems the -l is not recognized, is this expected? How can I get a
>>> total count?
>>>
>>
>> "perf report --show-total-period" will be your friend.
>>
>
> Or else, why not simply run "perf stat"?
My purpose is to get some PMU counter value during each time interval,
only perf record can do this. When using perf record -F, I have to add
up all period value for some event in a some interval to get that
value. When perf record -c, things get a easier, just (sample count x
sample after value) will do, only hassle is to get sample count in
some time interval. However, perf record don't have an option to do
this.
>
> Thanks,
> Namhyung
2012-02-23 4:03 AM, Yuanfang Chen wrote:
> On Wed, Feb 22, 2012 at 6:40 AM, Namhyung Kim <[email protected]> wrote:
>> Namhyung Kim <[email protected]> wrote:
>>> 2012-02-22 10:59 AM, Yuanfang Chen wrote:
>>>> I'm trying use perf tool from the linux kernel package to measure
>>>> several raw PMU events. In the manpage of perf-record there is an "-l"
>>>> option (Scale counter values), which is useful for my case because I
>>>> want to know the total counter value, not just sample count. However
>>>> it seems the -l is not recognized, is this expected? How can I get a
>>>> total count?
>>>
>>> "perf report --show-total-period" will be your friend.
>>
>> Or else, why not simply run "perf stat"?
>
> My purpose is to get some PMU counter value during each time interval,
> only perf record can do this. When using perf record -F, I have to add
> up all period value for some event in a some interval to get that
> value. When perf record -c, things get a easier, just (sample count x
> sample after value) will do, only hassle is to get sample count in
> some time interval. However, perf record don't have an option to do
> this.
>
I still don't get it. Why "perf stat -e <events> -p <pid> -- sleep <interval>"
doesn't work for you? It will show you the value, won't it?
Thanks,
Namhyung
2012-02-23 3:57 AM, Yuanfang Chen wrote:
> On Wed, Feb 22, 2012 at 1:01 AM, Namhyung Kim <[email protected]> wrote:
>> 2012-02-22 10:59 AM, Yuanfang Chen wrote:
>> The "-l" option was meaningful only if you specified events more than the
>> actual number of counters in the PMU.
>
> So -l is for multiplexing?
>
The "-l" option is no longer supported in perf record/report and multiplexing
is always enabled by default, if needed. That would be the same even for old
versions AFAIK, and "-l" option just controlled whether it'd scale or not the
counter value which is taken from already multiplexed events.
Thanks,
Namhyung
On Thu, Feb 23, 2012 at 1:51 PM, Yuanfang Chen <[email protected]> wrote:
> On Thu, Feb 23, 2012 at 2:24 AM, Namhyung Kim <[email protected]> wrote:
>> 2012-02-23 4:03 AM, Yuanfang Chen wrote:
>>>
>>> On Wed, Feb 22, 2012 at 6:40 AM, Namhyung Kim <[email protected]> wrote:
>>>>
>>>> Namhyung Kim <[email protected]> wrote:
>>>>>
>>>>> 2012-02-22 10:59 AM, Yuanfang Chen wrote:
>>>>>>
>>>>>> I'm trying use perf tool from the linux kernel package to measure
>>>>>> several raw PMU events. In the manpage of perf-record there is an "-l"
>>>>>> option (Scale counter values), which is useful for my case because I
>>>>>> want to know the total counter value, not just sample count. However
>>>>>> it seems the -l is not recognized, is this expected? How can I get a
>>>>>> total count?
>>>>>
>>>>>
>>>>> "perf report --show-total-period" will be your friend.
>>>>
>>>>
>>>> Or else, why not simply run "perf stat"?
>>>
>>>
>>> My purpose is to get some PMU counter value during each time interval,
>>> only perf record can do this. When using perf record -F, I have to add
>>> up all period value for some event in a some interval to get that
>>> value. When perf record -c, things get a easier, just (sample count x
>>> sample after value) will do, only hassle is to get sample count in
>>> some time interval. However, perf record don't have an option to do
>>> this.
>>>
>>
>> I still don't get it. Why "perf stat -e <events> -p <pid> -- sleep
>> <interval>"
>> doesn't work for you? It will show you the value, won't it?
>
> say my application(not an existing process, so -p <pid> does not
> work.) run for 10 seconds. I want the r03c, r2d4 value during each
> second. So there will be two values for each event in one second.
oops, forgot to forward. :-)
>
>>
>> Thanks,
>> Namhyung
On Thu, Feb 23, 2012 at 2:40 AM, Namhyung Kim <[email protected]> wrote:
> 2012-02-23 3:57 AM, Yuanfang Chen wrote:
>>
>> On Wed, Feb 22, 2012 at 1:01 AM, Namhyung Kim <[email protected]>
>> wrote:
>>>
>>> 2012-02-22 10:59 AM, Yuanfang Chen wrote:
>>> The "-l" option was meaningful only if you specified events more than the
>>> actual number of counters in the PMU.
>>
>>
>> So -l is for multiplexing?
>>
>
> The "-l" option is no longer supported in perf record/report and
> multiplexing is always enabled by default, if needed. That would be the same
> even for old versions AFAIK, and "-l" option just controlled whether it'd
> scale or not the counter value which is taken from already multiplexed
> events.
>
My question may sounds silly, but why to scale the counter value? Why
it is deprecated now?
Thank you,
yuanfang
>
> Thanks,
> Namhyung
On 2/23/12 11:52 AM, Yuanfang Chen wrote:
>>
>> say my application(not an existing process, so -p<pid> does not
>> work.) run for 10 seconds. I want the r03c, r2d4 value during each
>> second. So there will be two values for each event in one second.
>
> oops, forgot to forward. :-)
you are looking for something like this?
http://www.spinics.net/lists/linux-perf-users/msg00211.html
David
On Thu, Feb 23, 2012 at 2:08 PM, David Ahern <[email protected]> wrote:
> On 2/23/12 11:52 AM, Yuanfang Chen wrote:
>>>
>>>
>>> say my application(not an existing process, so -p<pid> does not
>>> work.) run for 10 seconds. I want the r03c, r2d4 value during each
>>> second. So there will be two values for each event in one second.
>>
>>
>> oops, forgot to forward. :-)
>
>
> you are looking for something like this?
> http://www.spinics.net/lists/linux-perf-users/msg00211.html
Exactly !!
I think I'll settle with perf record for now. Still, unlike trace
event, sample count is not meaningful for PMU event. Output of "perf
script" does not include period value. One line of code will do the
work.
lude 17342 750118.202915: raw 0x3c: 86754 ffffffff8115f6b9
__mem_cgroup_commit_char
lude 17342 750118.203025: raw 0x3c: 1027634 ffffffff811344b9
__mem_cgroup_commit_char
86754, 1027634 is the period value. But I'm not sure which is the PMU
value, is it just period value, or period x sample after. If so, what
is the sample after value?
thank you,
yuanfang
>
> David
>
On 2/24/12 3:41 PM, Yuanfang Chen wrote:
> I think I'll settle with perf record for now. Still, unlike trace
> event, sample count is not meaningful for PMU event. Output of "perf
> script" does not include period value. One line of code will do the
> work.
>
> lude 17342 750118.202915: raw 0x3c: 86754 ffffffff8115f6b9
> __mem_cgroup_commit_char
> lude 17342 750118.203025: raw 0x3c: 1027634 ffffffff811344b9
> __mem_cgroup_commit_char
>
> 86754, 1027634 is the period value. But I'm not sure which is the PMU
> value, is it just period value, or period x sample after. If so, what
> is the sample after value?
You lost me. You modified perf-script to print the period?
Are you asking for the PMU counter value for 0x3c?
What perf commands are you running?
David
On Mon, Feb 27, 2012 at 8:56 AM, Yuanfang Chen <[email protected]> wrote:
>
> On Feb 26, 2012 10:23 PM, "David Ahern" <[email protected]> wrote:
>>
>> On 2/24/12 3:41 PM, Yuanfang Chen wrote:
>>>
>>> I think I'll settle with perf record for now. Still, unlike trace
>>> event, sample count is not meaningful for PMU event. Output of "perf
>>> script" does not include period value. One line of code will do the
>>> work.
>>>
>>> lude 17342 750118.202915: raw 0x3c: 86754 ffffffff8115f6b9
>>> __mem_cgroup_commit_char
>>> lude 17342 750118.203025: raw 0x3c: 1027634 ffffffff811344b9
>>> __mem_cgroup_commit_char
>>>
>>> 86754, 1027634 is the period value. But I'm not sure which is the PMU
>>> value, is it just period value, or period x sample after. If so, what
>>> is the sample after value?
>>
>>
>> You lost me. You modified perf-script to print the period?
>>
>> Are you asking for the PMU counter value for 0x3c?
yes
>>
>> What perf commands are you running?
perf script
(with no options)
>
>>
>> David
On 2/27/12 6:58 AM, Yuanfang Chen wrote:
> On Mon, Feb 27, 2012 at 8:56 AM, Yuanfang Chen<[email protected]> wrote:
>>
>> On Feb 26, 2012 10:23 PM, "David Ahern"<[email protected]> wrote:
>>>
>>> On 2/24/12 3:41 PM, Yuanfang Chen wrote:
>>>>
>>>> I think I'll settle with perf record for now. Still, unlike trace
>>>> event, sample count is not meaningful for PMU event. Output of "perf
>>>> script" does not include period value. One line of code will do the
>>>> work.
>>>>
>>>> lude 17342 750118.202915: raw 0x3c: 86754 ffffffff8115f6b9
>>>> __mem_cgroup_commit_char
>>>> lude 17342 750118.203025: raw 0x3c: 1027634 ffffffff811344b9
>>>> __mem_cgroup_commit_char
>>>>
>>>> 86754, 1027634 is the period value. But I'm not sure which is the PMU
>>>> value, is it just period value, or period x sample after. If so, what
>>>> is the sample after value?
>>>
>>>
>>> You lost me. You modified perf-script to print the period?
>>>
>>> Are you asking for the PMU counter value for 0x3c?
>
> yes
perf-record does not get counter values when samples are genereated.
>
>>>
>>> What perf commands are you running?
>
> perf script
> (with no options)
record command?
I don't see what the 86754 and 1902764 values are in your example output
above.
David