1

I am writing a python script to get some basic system stats. I am using psutil for most of it and it is working fine except for one thing that I need.

I'd like to log the average cpu wait time at the moment. from top output it would be in CPU section under %wa.

I can't seem to find how to get that in psutil, does anyone know how to get it? I am about to go down a road I really don't want to go on....

That entire CPU row is rather nice, since it totals to 100 and it is easy to log and plot.

Thanks in advance.

nick_v1
  • 1,654
  • 1
  • 18
  • 29

1 Answers1

2

%wa is giving your the iowait of the CPU, and if you are using times = psutil.cpu_times() or times = psutil.cpu_times_percent() then it is under the times.iowait variable of the returned value (Assuming you are on a Linux system)

RyPeck
  • 7,830
  • 3
  • 38
  • 58
meiamsome
  • 2,876
  • 1
  • 17
  • 19