Skip to contentSkip to conversation

recording rapl/power events

DISCUSSION Adrien BAK 4 participants 6 messages Apr 21, 2014 – Apr 30, 2014

lore
Share & tools
lore

Adrien BAK

author
#0 lore raw

Hi everyone,

I am looking into the power (rapl) events introduced in the kernel in version 3.14.

Right now, I can access those events through perf stat :

perf stat -a -e power/energy-pkg/ sleep 1

Performance counter stats for 'system wide':

             17.16 Joules power/energy-pkg/

       1.002808169 seconds time elapsed

However, it seems that I can't record a sequence of power events :

perf record -a -e power/energy-pkg/ sleep 1
Error:
The sys_perf_event_open() syscall returned with 22 (Invalid argument) for event (power/energy-pkg/). /bin/dmesg may provide additional information.
No CONFIG_PERF_EVENTS=y kernel support configured?

dmesg does not give any information, and, as far as I know, perf_events are fully supported by my kernel (

Is there some limitation of the power events (or kernel support) I am unaware of that could explain this behaviour, or is there something wrong with my setup/configuration ? How would one procede to record a sequence of power events ?

Thanks in advance
A.

#1 lore raw
Quoted 8 lines · Adrien BAK

However, it seems that I can't record a sequence of power events :

perf record -a -e power/energy-pkg/ sleep 1
Error:
The sys_perf_event_open() syscall returned with 22 (Invalid argument) for event (power/energy-pkg/).
/bin/dmesg may provide additional information.
No CONFIG_PERF_EVENTS=y kernel support configured?

RAPL events cannot generate interrupts, so I don't think you can sample like this.

You can possibly sample using some other event (like one of the software clock events) and include the RAPL event in the list of events to record, not sure if that will accomplish what you're trying to do.

Vince

author
#2 lore raw
Quoted 10 lines · Vince Weaver
Quoted 8 lines · Adrien BAK

However, it seems that I can't record a sequence of power events :

perf record -a -e power/energy-pkg/ sleep 1
Error:
The sys_perf_event_open() syscall returned with 22 (Invalid argument) for event (power/energy-pkg/).
/bin/dmesg may provide additional information.
No CONFIG_PERF_EVENTS=y kernel support configured?

Quoted 8 lines

RAPL events cannot generate interrupts, so I don't think you can sample like this.

You can possibly sample using some other event (like one of the software clock events) and include the RAPL event in the list of events to record, not sure if that will accomplish what you're trying to do.

Vince

This looks promising, although I couldn't find any useful documentation on this. Do you know if the perf userland tool allows for this kind of slave-sampling or if I have to build my own tool around the perf_event API ?

#3 lore raw
Quoted 5 lines · Adrien BAK

This looks promising, although I couldn't find any useful documentation on this. Do you know if the perf userland tool allows for this kind of slave-sampling or if I have to build my own tool around the perf_event API ?

perf record supports it (with :S), but none of the reporting tools unfortunately.

However keep in mind that very rapid sampling of RAPL is not likely to give useful results. The data only really makes sense over longer intervals.

-Andi

Signature · 1 line
[email protected] -- Speaking for myself only
#4 lore raw

Hi Andi,

Quoted 9 lines · Andi Kleen
Quoted 5 lines · Adrien BAK

This looks promising, although I couldn't find any useful documentation on this. Do you know if the perf userland tool allows for this kind of slave-sampling or if I have to build my own tool around the perf_event API ?

perf record supports it (with :S), but none of the reporting tools unfortunately.

It seems it's what --group option of perf report is for?

  $ perf record -e '{cycles,power/energy-pkg/}:S' -a sleep 1
  $ perf report --group --stdio

Thanks,
Namhyung

Quoted 6 lines

However keep in mind that very rapid sampling of RAPL is not likely to give useful results. The data only really makes sense over longer intervals.

-Andi

author
#5 lore raw

hi Namhyung,

yes it seems. However, when I run what you suggest, I get the following :

perf record -a -e '{cycles,power/energy-pkg/}:S' sleep 1
Error:
The sys_perf_event_open() syscall returned with 22 (Invalid argument) for event (power/energy-pkg/). /bin/dmesg may provide additional information.
No CONFIG_PERF_EVENTS=y kernel support configured?

Once again, I'm pretty sure my kernel is correctly configured, as I can get power measurement using perf stat. Is this a bug somewhere ? Can you confirm that this works for you and that I should investigate what can go wrong with my system ?

A.

Quoted 29 lines · Namhyung Kim

Hi Andi,

Quoted 7 lines · Andi Kleen
Quoted 4 lines · Adrien BAK

This looks promising, although I couldn't find any useful documentation on this. Do you know if the perf userland tool allows for this kind of slave-sampling or if I have to build my own tool around the perf_event API ?

perf record supports it (with :S), but none of the reporting tools unfortunately.

It seems it's what --group option of perf report is for?

   $ perf record -e '{cycles,power/energy-pkg/}:S' -a sleep 1
   $ perf report --group --stdio

Thanks,
Namhyung

Quoted 5 lines

However keep in mind that very rapid sampling of RAPL is not likely to give useful results. The data only really makes sense over longer intervals.

-Andi

--
To unsubscribe from this list: send the line "unsubscribe linux-perf-users" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html