Work on a monitoring application to monitor the performance of the processor and the hard disk
The processor performance check part was simple using psutil
But it is difficult to get information about the performance of the hard disk from this library
I tried to go to the traditional methods, but the cost was great in performance
I want to get something like this
Disk in/out: XX MB/s
and Disk active time: XX%
like in Windows resources monitor
psutil
return sdiskio contain
(read_count=xxxx, write_count=xxxx, read_bytes=xxxx, write_bytes=xxx, read_time=xxxx, write_time=xxx)
I cannot determine through these numbers the active time of the hard drive
#update
what I'm tried so far
while(True):
disk_io_counter = psutil.disk_io_counters(perdisk=True)['PhysicalDrive1']
disk_read_bytes = disk_io_counter[2] # read_bytes
disk_write_bytes = disk_io_counter[3] # write_byte
disk_read_time = disk_io_counter[4] # read_time
disk_write_time = disk_io_counter[5] # write_time
time.sleep(1)
disk_io_counter = psutil.disk_io_counters(perdisk=True)['PhysicalDrive1']
disk_read_bytes1 = disk_io_counter[2] # read_bytes
disk_write_bytes1 = disk_io_counter[3] # write_byte
disk_read_time1 = disk_io_counter[4] # read_time
disk_write_time1 = disk_io_counter[5] # write_time
total_read = disk_read_bytes1 -disk_read_bytes
total_write = disk_write_bytes1 - disk_write_bytes
total_read_time = disk_read_time1 -disk_read_time
total_write_time = disk_write_time1 - disk_write_time
print("Read : ",bytes2human( total_read) )
print("Write : ",bytes2human( total_write) )
print("Time_Read : ",total_read_time )
print("Time_Write : ",total_write_time )
that gives me the right read and write speed but still nothing about the actual percentage