-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add total time field to disk_io_counters() #523
Conversation
the total-time field is necessary to calculate a `util%` metric (0 - 100%) similar to what `iostat -x` prints.
fixed the failing test |
ping |
I don't understand the usefulness of this. What's the number returned by the kernel? Isn't it supposed to just be 'read_time' + 'write_time'? If that's the case then it is not necessary to complicate psutil API. If it's not the case then we need to know what that numbers refers to exactly (and whether we can extract it on other platforms as well, not only Linux). PS: sorry for the late reply but I've been travelling a lot lately and didn't have time to work on my personal projects |
It's been a while since I thought about this so I need to try to recall the details. Basically though, I could not find a useful way to get disk utilization (0-100%) with read_time + write_time. Only tot_time seemed to be useful to get anywhere near the %util as reported by Here is an example of how different the numbers are as well. The tot_time is much different than read+write_times. I'm not sure if there is some HZ/tick conversion happening on one but not the other. I was not able to back-in to getting tot_time from read+write with anything that I tried when I wrote this patch.
|
Here's the complete func I use to calculate a continuous util%, for additional context.
|
Here is a small test that illustrates what I was seeing when originally writing this PR:
Run using tot_time I am able to get near the 100% utilization I expect and that shows in
|
I want this feature as well. IO UTIL is an important metric I need to collection. Field name tot_time is not so specified, I suggest to rename it to busy_time or io_time. So why read_time + write_time >= busy_time? This is because disk devices can operate several read/write operations parallelly. That is, device is busy no matter how many operations it is operating. However, write_time will be n times if n operations. IO UTIL metric, measures how much time the device is busy. Solution on Linux is just show above. That is similar solutions on other platforms. For instance, on FreeBSD, we can use busy_time field in devstat struct(sys/devicestat.h)。 Hope busy_time to been included. I may share some of my code. |
Agreed this is necessary. We first need to figure out on what platforms this is retrievable though, especially OSX. |
All right. I will help to find out solutions for other platforms. |
It appears this info is available only on Linux and BSD. I only added FreeBSD implementation though because on OpenBSD and NetBSD I couldn't find a way to get the right metrics. Closing this out. |
the total-time field is necessary to calculate a
util%
metric (0 - 100%) similar to whatiostat -x
prints.