Re: [PATCH] perf record: enable multiplexing scaling via -R

From: Stephane Eranian
Date: Mon Aug 28 2017 - 15:28:04 EST


Hi,

On Tue, Aug 22, 2017 at 12:24 AM, Stephane Eranian <eranian@xxxxxxxxxx> wrote:
> On Tue, Aug 22, 2017 at 12:03 AM, Jiri Olsa <jolsa@xxxxxxxxxx> wrote:
>>
>> On Mon, Aug 21, 2017 at 06:25:45PM -0700, Andi Kleen wrote:
>> > On Mon, Aug 21, 2017 at 05:13:29PM -0700, Stephane Eranian wrote:
>> > > On Mon, Aug 21, 2017 at 4:02 PM, Andi Kleen <andi@xxxxxxxxxxxxxx> wrote:
>> > > >
>> > > > Stephane Eranian <eranian@xxxxxxxxxx> writes:
>> > > > >
>> > > > > To activate, the user must use:
>> > > > > $ perf record -a -R ....
>> > > >
>> > > > I don't know why you're overloading the existing raw mode?
>> > > >
>> > > > It has nothing to do with that.
>> > > >
>> > > I explained this in the changelog. So that is does not change any of
>> > > the processing in perf report, i.e., no faced with data it does not
>> > > know how to handle.
>> > > Also trying to avoid adding yet another option.
>> >
>> > But raw is needed for some of the non Intel PMUs. I believe it's
>> > the only way to use AMD IBS. You may as well break their usage.
>> >
>> > You'll need a new option.
>>
>> I agree with Andi, I don't think we should mix those,
>> we should have a way to switch it on/off
>>
> Ok, then. I will add an option to turn this on. This is a useful mode
> for many advanced users.
>
I looked at the perf source code again over the weekend. It seems
there is no need for a new patch.
Whatever is needed to capture time_running/time_enabled is already
there. The kernel can only
record the timings when PERF_SAMPLE_READ is set. The way to enable
this with current perf
is to use the S modified on events:

$ perf record -e cycles:S .....
That captures the timings, though they are in a read struct inside the
record. But this is exactly
what my earlier patch was doing.
The modifier also works with the more developed syntax:
$ perf record -e cpu/event=0xc0,umask=1/S ....

So I think we are good to go. to capture multiplexing scaling factor
when sampling simply use the S
modifier.
But to my surprise, newer kernels are not happy with the cmdline:
$ perf record -e cycles:S noploop 1
Error:
The sys_perf_event_open() syscall returned with 22 (Invalid argument)
for event (cycles:Su).
/bin/dmesg may provide additional information.
No CONFIG_PERF_EVENTS=y kernel support configured?

That looks like a bug to me. Why would that not work?
I have not yet had the time to look into this. Jiri?

Thanks.




>>
>> jirka