How to get disk IO and network usage as a percentage of psutil
1 answer
You can get the percentage result if you follow this method:
import psutil
n_c = tuple(psutil.disk_io_counters())
n_c = [(100.0*n_c[i+1]) / n_c[i] for i in xrange(0, len(n_c), 2)]
print n_c
There was a way out for my system [18.154375810797326, 40.375844302056244, 40.33502202082432]
. Each index represents a percentage of the writing when reading data. For example n_c[0]
- percentage write_count/read_count
, and n_c[1]
- percentage write_bytes/read_bytes
Similarly, you can get the percentage data for net_io_counters (). Hope this helps!
0
source to share