Skip to content

Commit

Permalink
Merge pull request #530 from airekans/master
Browse files Browse the repository at this point in the history
Fix the disk_io_counter bug in kernel 2.6 to 2.6.25
  • Loading branch information
giampaolo committed Sep 15, 2014
2 parents 1e5dc37 + 1cb3605 commit dac9954
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions psutil/_pslinux.py
Original file line number Diff line number Diff line change
Expand Up @@ -638,8 +638,13 @@ def disk_io_counters():
f.close()
for line in lines:
# http://www.mjmwired.net/kernel/Documentation/iostats.txt
_, _, name, reads, _, rbytes, rtime, writes, _, wbytes, wtime = \
line.split()[:11]
fields = line.split()
if len(fields) > 7:
_, _, name, reads, _, rbytes, rtime, writes, _, wbytes, wtime = \
fields[:11]
else: # from kernel 2.6 to 2.6.25
_, _, name, reads, rbytes, writes, wbytes = fields
rtime, wtime = 0, 0
if name in partitions:
rbytes = int(rbytes) * SECTOR_SIZE
wbytes = int(wbytes) * SECTOR_SIZE
Expand Down

0 comments on commit dac9954

Please sign in to comment.