nwinfo icon indicating copy to clipboard operation
nwinfo copied to clipboard

Provide disk performance information

Open a1ive opened this issue 1 month ago • 0 comments

https://learn.microsoft.com/en-us/windows/win32/api/winioctl/ni-winioctl-ioctl_disk_performance

BOOL DeviceIoControl(
  (HANDLE) hDevice,             // handle to device
  IOCTL_DISK_PERFORMANCE,       // dwIoControlCode
  NULL,                         // lpInBuffer
  0,                            // nInBufferSize
  (LPVOID) lpOutBuffer,         // output buffer
  (DWORD) nOutBufferSize,       // size of output buffer
  (LPDWORD) lpBytesReturned,    // number of bytes returned
  (LPOVERLAPPED) lpOverlapped   // OVERLAPPED structure
);

https://learn.microsoft.com/en-us/windows/win32/api/winioctl/ni-winioctl-ioctl_disk_performance_off

BOOL DeviceIoControl(
  (HANDLE) hDevice,            	// handle to device
  IOCTL_DISK_PERFORMANCE_OFF,	// dwIoControlCode
  NULL,                        	// lpInBuffer
  0,                           	// nInBufferSize
  NULL,                        	// lpOutBuffer
  0,                           	// nOutBufferSize
  (LPDWORD) lpBytesReturned,   	// number of bytes returned
  (LPOVERLAPPED) lpOverlapped  	// OVERLAPPED structure
);

https://learn.microsoft.com/en-us/windows/win32/api/winioctl/ns-winioctl-disk_performance

typedef struct _DISK_PERFORMANCE {
  LARGE_INTEGER BytesRead;
  LARGE_INTEGER BytesWritten;
  LARGE_INTEGER ReadTime;
  LARGE_INTEGER WriteTime;
  LARGE_INTEGER IdleTime;
  DWORD         ReadCount;
  DWORD         WriteCount;
  DWORD         QueueDepth;
  DWORD         SplitCount;
  LARGE_INTEGER QueryTime;
  DWORD         StorageDeviceNumber;
  WCHAR         StorageManagerName[8];
} DISK_PERFORMANCE, *PDISK_PERFORMANCE;

BytesRead

The number of bytes read.

BytesWritten

The number of bytes written.

ReadTime

The time it takes to complete a read.

WriteTime

The time it takes to complete a write.

IdleTime

The idle time.

ReadCount

The number of read operations.

WriteCount

The number of write operations.

QueueDepth

The depth of the queue.

SplitCount

The cumulative count of I/Os that are associated I/Os.

An associated I/O is a fragmented I/O, where multiple I/Os to a disk are required to fulfill the original logical I/O request. The most common example of this scenario is a file that is fragmented on a disk. The multiple I/Os are counted as split I/O counts.

QueryTime

The system time stamp when a query for this structure is returned.

Use this member to synchronize between the file system driver and a caller.

StorageDeviceNumber

The unique number for a device that identifies it to the storage manager that is indicated in the StorageManagerName member.

StorageManagerName[8]

The name of the storage manager that controls this device.

Examples of storage managers are "PhysDisk," "FTDISK," and "DMIO".

a1ive avatar Jan 17 '26 04:01 a1ive