nikademus79 / psutil

Automatically exported from code.google.com/p/psutil
Other
0 stars 0 forks source link

(Windows) psutil.disk_io_counters(perdisk=True) returns disks instead of partitions #235

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1.run psutil.disk_io_counters(perdisk=True) on Windows
2.run psutil.disk_io_counters(perdisk=True) on Linux

What is the expected output?

Windows:
{'C:': iostat(blablabla), 'D':iostat(blablabla)}

Linux:
{'sda1:': iostat(blablabla), 'sda2':iostat(blablabla)} 

What do you see instead?

Windows:
{'PhysicalDrive0': iostat(blablabla)}

Linux:
{'sda1:': iostat(blablabla), 'sda2':iostat(blablabla)} 

What version of psutil are you using? What Python version?
psutil 0.4
python 2.7

On what operating system? Is it 32bit or 64bit version?
Ubuntu Linux 11.10 64bit, Windows XP 32bit

Please provide any additional information below.

Original issue reported on code.google.com by kotsifi on 6 Dec 2011 at 12:05

GoogleCodeExporter commented 8 years ago
I don't think it's possible to differentiate between partitions, as the 
screenshot you attached in issue 234 suggests:
http://dl.dropbox.com/u/1320617/Linux_Photos/win_psutil_winobj.jpeg
This is basically what DeviceIoControl() [1] lets us do.

[1] 
http://msdn.microsoft.com/en-us/library/windows/desktop/aa363216(v=vs.85).aspx

Original comment by g.rodola on 6 Dec 2011 at 7:28

GoogleCodeExporter commented 8 years ago
On the link of msdn that you posted writes:

------------------------------------------
Remarks

To retrieve a handle to the device, you must call the CreateFile function with 
either the name of a device or the name of the driver associated with a device. 
To specify a device name, use the following format:

\\.\DeviceName

DeviceIoControl can accept a handle to a specific device. For example, to open 
a handle to the logical drive A: with CreateFile, specify \\.\a:. 
Alternatively, you can use the names \\.\PhysicalDrive0, \\.\PhysicalDrive1, 
and so on, to open handles to the physical drives on a system.
-----------------------------------------

Is it possible to use the characters of the logical volumes (A,C,D, etc) 
instead of names (PhysicalDrive0,PhysicalDrive1, etc)?

I can't understand very well how it works so forgive me if i wrote something 
wrong.

Original comment by kotsifi on 6 Dec 2011 at 8:40

GoogleCodeExporter commented 8 years ago
No, because "A", "C", "D" etc. are partitions, and on Windows there's 
apparently no way to extract IO statistics for a certain partition only.
What we can do is providing IO stats of a certain *disk*, and they are 
represented as 'PhysicalDrive0', 'PhysicalDrive1', etc.
I'm closing this out as WontFix.

Original comment by g.rodola on 6 Mar 2012 at 12:43