intel / PerfSpect

System performance characterization tool based on linux perf
https://intel.github.io/PerfSpect/
BSD 3-Clause "New" or "Revised" License
333 stars 30 forks source link

WARNING: PMU in use. And the CPU utilization is inaccurate #29

Closed changzhi1990 closed 1 year ago

changzhi1990 commented 1 year ago

I try to use perf-collect.py to collect the metrics of "stress" process.

But I meet a warning like this:

ubuntu@inspur-icx-1:~/zhi/PerfSpect$ sudo python perf-collect.py -a "stress --vm 1 -c 1 --vm-bytes 1024M"
2023-05-10 16:57:37,423 INFO: nmi_watchdog disabled
2023-05-10 16:57:37,776 WARNING: PMU in use: cpu cycles
2023-05-10 16:57:37,815 WARNING: output could be inaccurate
2023-05-10 16:57:37,815 INFO: Collecting perf stat for events in : /home/ubuntu/zhi/PerfSpect/events/icx.txt
stress: info: [832408] dispatching hogs: 1 cpu, 0 io, 1 vm, 0 hdd
^C2023-05-10 16:58:18,853 INFO: Collection stopped! Caculating TSC frequency now
2023-05-10 16:58:19,903 INFO: nmi_watchdog re-enabled
2023-05-10 16:58:19,905 INFO: perf stat dumped to perfstat.csv

ubuntu@inspur-icx-1:~/zhi/PerfSpect$ sudo python perf-postprocess.py -r perfstat.csv --html cpu.html
2023-05-10 16:57:17,006 INFO: Generated results file(s) in: /home/ubuntu/zhi/PerfSpect
2023-05-10 16:57:17,467 INFO: static HTML file written at cpu.html
2023-05-10 16:57:17,467 INFO: Done!

If I ignore these warnings, the CPU utilization is inaccurate in the cpu.html file. image

Is there any relationship between the warning info and the inaccurate problem?

Thanks!

harp-intel commented 1 year ago

@changzhi1990 What is the expected CPU utilization?

changzhi1990 commented 1 year ago

@changzhi1990 What is the expected CPU utilization?

The expected utilization is 100%

changzhi1990 commented 1 year ago

@changzhi1990 What is the expected CPU utilization?

The expected utilization is 100%

Because I use the stress process and I can see the CPU utilization is almost 100% by htop of the specific core.

harp-intel commented 1 year ago

@changzhi1990 The CPU utilization presented by PerfSpect is the average utilization across all cores/threads. The stress-ng command you are running is running only 2 threads.

changzhi1990 commented 1 year ago

@changzhi1990 The CPU utilization presented by PerfSpect is the average utilization across all cores/threads. The stress-ng command you are running is running only 2 threads.

Thanks for your reply. I try to add a new feature to collcet the perf events of the specific CPU cores, like this image

But the CPU utilization is almost 0% in the html file. So I think maybe I need to modify the code further.

hilldani commented 1 year ago

there's two things you could do here.

  1. Run PerfSpect in thread mode sudo ./perf-collect --thread. This cannot generate an HTML file yet
  2. Run PerfSpect in PID mode sudo ./perf-collect --pid <your-stress-ng-process-id>. I also don't think this can generate an HTML file

since these aren't supported in the HTML report yet you'll have to look in the csv for metric_CPU utilization %

hilldani commented 1 year ago

closing because PerfSpect is functioning as intended. It shows system-wide cpu utilization which is very low in this case (given that only one thread is occupied at 100%)