andikleen / pmu-tools

Intel PMU profiling tools
GNU General Public License v2.0
2.02k stars 336 forks source link

events not counted. #377

Closed hailingluo closed 3 years ago

hailingluo commented 3 years ago

Hi, Andi, I try to use pum-tools to collect PMU events, but I got some errors. My CPU is GenuineIntel-6-55-7 (Intel(R) Xeon(R) Gold 5218N CPU @ 2.30GHz), and it supports HyperThreads.

  1. When I use "python toplev.py -l1 --pid PID sleep 10", I got "-p/--pid mode not compatible with SMT. Use sleep in global mode."
  2. Then, I use another command "python toplev.py -l1 --cpu x-y --global sleep 10", I got another error "events not counted". And we use "perf stat -e code (which get from the option --perf)", and the events are . But, when I use "perf stat -e CPU_CLK_UNHALTED.THREAD (for example)", we can get the count value.

How can I get the top-down from this pmu-tools?

Thanks for your help.

andikleen commented 3 years ago

On 2021-05-24 19:23, Hailing Luo wrote:

Hi, Andi, I try to use pum-tools to collect PMU events, but I got some errors. My CPU is GenuineIntel-6-55-7 (Intel(R) Xeon(R) Gold 5218N CPU @ 2.30GHz), and it supports HyperThreads.

  • When I use "python toplev.py -l1 --pid PID sleep 10", I got "-p/--pid mode not compatible with SMT. Use sleep in global mode."
  • Then, I use another command "python toplev.py -l1 --cpu x-y --global sleep 10", I got another error "events not counted". And we use "perf stat -e code (which get from the option --perf)", and the events are . But, when I use "perf stat -e CPU_CLK_UNHALTED.THREAD (for example)", we can get the count value.

How can I get the top-down from this pmu-tools?

Does it help when you add -a ?

I think in all these cases you need global counting due to SMT

hailingluo commented 3 years ago

On 2021-05-24 19:23, Hailing Luo wrote: Hi, Andi, I try to use pum-tools to collect PMU events, but I got some errors. My CPU is GenuineIntel-6-55-7 (Intel(R) Xeon(R) Gold 5218N CPU @ 2.30GHz), and it supports HyperThreads. When I use "python toplev.py -l1 --pid PID sleep 10", I got "-p/--pid mode not compatible with SMT. Use sleep in global mode." Then, I use another command "python toplev.py -l1 --cpu x-y --global sleep 10", I got another error "events not counted". And we use "perf stat -e code (which get from the option --perf)", and the events are not counted. But, when I use "perf stat -e CPU_CLK_UNHALTED.THREAD (for example)", we can get the count value. How can I get the top-down from this pmu-tools? Does it help when you add -a ? I think in all these cases you need global counting due to SMT

The option "-a" will be added automatically by the pmu-tools. I add "--perf" in my command, and I got "perf stat -x\; -e '{r19c,r20003c,r2c2,r10e},emulation-faults,{r10e,r2c2,r120030d,r20003c}' -A -a --cpu 0 sleep 10".

My perf version is 3.10. Something wrong with the transformation from events_name to events_code?

andikleen commented 3 years ago

On 2021-05-25 18:53, Hailing Luo wrote:

On 2021-05-24 19:23, Hailing Luo wrote: Hi, Andi, I try to use pum-tools to collect PMU events, but I got some errors. My CPU is GenuineIntel-6-55-7 (Intel(R) Xeon(R) Gold 5218N CPU @ 2.30GHz), and it supports HyperThreads. When I use "python toplev.py -l1 --pid PID sleep 10", I got "-p/--pid mode not compatible with SMT. Use sleep in global mode." Then, I use another command "python toplev.py -l1 --cpu x-y --global sleep 10", I got another error "events not counted". And we use "perf stat -e code (which get from the option --perf)", and the events are not counted. But, when I use "perf stat -e CPU_CLK_UNHALTED.THREAD (for example)", we can get the count value. How can I get the top-down from this pmu-tools? Does it help when you add -a ? I think in all these cases you need global counting due to SMT

The option "-a" will be added automatically by the pmu-tools. I add "--perf" in my command, and I got "perf stat -x; -e '{r19c,r20003c,r2c2,r10e},emulation-faults,{r10e,r2c2,r120030d,r20003c}' -A -a --cpu 0 sleep 10".

My perf version is 3.10. Something wrong with the transform from events_name to events_code?

Yes could be that the code paths handling rXXX have regressed. I haven't tested this for a long time because it's so outdated.

I guess open an issue.

Likely a newer perf/kernel would work.

hailingluo commented 3 years ago

On 2021-05-25 18:53, Hailing Luo wrote: > On 2021-05-24 19:23, Hailing Luo wrote: Hi, Andi, I try to use > pum-tools to collect PMU events, but I got some errors. My CPU is > GenuineIntel-6-55-7 (Intel(R) Xeon(R) Gold 5218N CPU @ 2.30GHz), and > it supports HyperThreads. When I use "python toplev.py -l1 --pid > PID sleep 10", I got "-p/--pid mode not compatible with SMT. Use > sleep in global mode." Then, I use another command "python > toplev.py -l1 --cpu x-y --global sleep 10", I got another error > "events not counted". And we use "perf stat -e code (which get from > the option --perf)", and the events are not counted. But, when I use > "perf stat -e CPU_CLK_UNHALTED.THREAD (for example)", we can get the > count value. How can I get the top-down from this pmu-tools? > Does it help when you add -a ? I think in all these cases you need > global counting due to SMT The option "-a" will be added automatically by the pmu-tools. I add "--perf" in my command, and I got "perf stat -x; -e '{r19c,r20003c,r2c2,r10e},emulation-faults,{r10e,r2c2,r120030d,r20003c}' -A -a --cpu 0 sleep 10". My perf version is 3.10. Something wrong with the transform from events_name to events_code? Yes could be that the code paths handling rXXX have regressed. I haven't tested this for a long time because it's so outdated. I guess open an issue. Likely a newer perf/kernel would work.

Yes, I use this tool in perf/kernel 4.1x, it works well. But I couldn't change the kernel or perf version for collecting events.

hailingluo commented 3 years ago

The reason is because of the PMC module of our CPU. Removing it can solve my problem.