-
-
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
Avoid counting disk io twice for NVMe SSD block device #1244
Conversation
Here is the output from current
|
Any suggestion about this pull request? |
Sorry, been busy. I briefly took a look at this and it seems more complex. Looking for a number is not enough, see:
In the case above |
0816763
to
c3af7d0
Compare
@giampaolo I dived into the Linux's source code tonight, and found the There are three combinations of the name part in
I have updated my code as a result of this new discovery. |
partitions.append(name) | ||
else: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this incorrectly assumes the last disk it a partition.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kportertx
get_partitions
returns both partitions and disk without any partitions. If the last disk is not a partition, it will be a disk without partition.
psutil/_pslinux.py
Outdated
@@ -1017,23 +1017,24 @@ def disk_io_counters(): | |||
system as a dict of raw tuples. | |||
""" | |||
# determine partitions we want to look for | |||
partition_suffix = re.compile(r'p*\d+') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't this still match nvme0n1? It is looking for 0 or more 'p's followed by one or more digits.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kportertx
The partition_suffix
is used to match partition suffix, not the whole partition name. Certainly, it will be better to write r'^p*\d+$'
to avoid confusing. I will change it in the new commit.
Note: #1305 (comment) states that we can have read/write loads also for disks with no partition, which complicates things even more. |
The first NVMe block device will be named as nvme0n1, and its partitions are nvme0n1p1, nvme0n1p2, etc. Therefore we could not use the last letter to identify if the name is a partition or not.
c3af7d0
to
3af5e95
Compare
Update: it turns out |
I filed a bug on |
My 2 cents: I think the magic you're looking for is here: https://github.com/sysstat/sysstat/blob/master/iostat.c#L719 (Note 1: in https://github.com/giampaolo/psutil/blob/master/psutil/_pslinux.py#L1076 psutil says if |
@wiggin15 thanks a lot man, that's exactly what I was looking for |
@giampaolo FYI I started working on a new (bigger) patch here: |
The first NVMe block device will be named as nvme0n1,
and its partitions are nvme0n1p1, nvme0n1p2, etc.
Therefore we could not use the last letter to identify if the name is a
partition or not.