Win32 API 日本語リファレンス
ホームSystem.Ioctl › DISK_PERFORMANCE

DISK_PERFORMANCE

構造体
サイズx64: 88 バイト / x86: 88 バイト

サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。

フィールド

フィールドサイズx64x86説明
BytesReadLONGLONG8+0+0読み取られた総バイト数。
BytesWrittenLONGLONG8+8+8書き込まれた総バイト数。
ReadTimeLONGLONG8+16+16読み取りに費やした累積時間。100ナノ秒単位。
WriteTimeLONGLONG8+24+24書き込みに費やした累積時間。100ナノ秒単位。
IdleTimeLONGLONG8+32+32アイドル状態の累積時間。100ナノ秒単位。
ReadCountDWORD4+40+40読み取り操作の回数。
WriteCountDWORD4+44+44書き込み操作の回数。
QueueDepthDWORD4+48+48現在のI/Oキューの深さ。
SplitCountDWORD4+52+52分割されたI/O要求の回数。
QueryTimeLONGLONG8+56+56統計を取得した時刻。
StorageDeviceNumberDWORD4+64+64ストレージデバイスの番号。
StorageManagerNameWCHAR16+68+68ストレージマネージャの名前。ワイド文字列。

各言語での定義

#include <windows.h>

// DISK_PERFORMANCE  (x64 88 / x86 88 バイト)
typedef struct DISK_PERFORMANCE {
    LONGLONG BytesRead;
    LONGLONG BytesWritten;
    LONGLONG ReadTime;
    LONGLONG WriteTime;
    LONGLONG IdleTime;
    DWORD ReadCount;
    DWORD WriteCount;
    DWORD QueueDepth;
    DWORD SplitCount;
    LONGLONG QueryTime;
    DWORD StorageDeviceNumber;
    WCHAR StorageManagerName[8];
} DISK_PERFORMANCE;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DISK_PERFORMANCE
{
    public long BytesRead;
    public long BytesWritten;
    public long ReadTime;
    public long WriteTime;
    public long IdleTime;
    public uint ReadCount;
    public uint WriteCount;
    public uint QueueDepth;
    public uint SplitCount;
    public long QueryTime;
    public uint StorageDeviceNumber;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 8)] public string StorageManagerName;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DISK_PERFORMANCE
    Public BytesRead As Long
    Public BytesWritten As Long
    Public ReadTime As Long
    Public WriteTime As Long
    Public IdleTime As Long
    Public ReadCount As UInteger
    Public WriteCount As UInteger
    Public QueueDepth As UInteger
    Public SplitCount As UInteger
    Public QueryTime As Long
    Public StorageDeviceNumber As UInteger
    <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=8)> Public StorageManagerName As String
End Structure
import ctypes
from ctypes import wintypes

class DISK_PERFORMANCE(ctypes.Structure):
    _fields_ = [
        ("BytesRead", ctypes.c_longlong),
        ("BytesWritten", ctypes.c_longlong),
        ("ReadTime", ctypes.c_longlong),
        ("WriteTime", ctypes.c_longlong),
        ("IdleTime", ctypes.c_longlong),
        ("ReadCount", wintypes.DWORD),
        ("WriteCount", wintypes.DWORD),
        ("QueueDepth", wintypes.DWORD),
        ("SplitCount", wintypes.DWORD),
        ("QueryTime", ctypes.c_longlong),
        ("StorageDeviceNumber", wintypes.DWORD),
        ("StorageManagerName", ctypes.c_wchar * 8),
    ]
#[repr(C)]
pub struct DISK_PERFORMANCE {
    pub BytesRead: i64,
    pub BytesWritten: i64,
    pub ReadTime: i64,
    pub WriteTime: i64,
    pub IdleTime: i64,
    pub ReadCount: u32,
    pub WriteCount: u32,
    pub QueueDepth: u32,
    pub SplitCount: u32,
    pub QueryTime: i64,
    pub StorageDeviceNumber: u32,
    pub StorageManagerName: [u16; 8],
}
import "golang.org/x/sys/windows"

type DISK_PERFORMANCE struct {
	BytesRead int64
	BytesWritten int64
	ReadTime int64
	WriteTime int64
	IdleTime int64
	ReadCount uint32
	WriteCount uint32
	QueueDepth uint32
	SplitCount uint32
	QueryTime int64
	StorageDeviceNumber uint32
	StorageManagerName [8]uint16
}
type
  DISK_PERFORMANCE = record
    BytesRead: Int64;
    BytesWritten: Int64;
    ReadTime: Int64;
    WriteTime: Int64;
    IdleTime: Int64;
    ReadCount: DWORD;
    WriteCount: DWORD;
    QueueDepth: DWORD;
    SplitCount: DWORD;
    QueryTime: Int64;
    StorageDeviceNumber: DWORD;
    StorageManagerName: array[0..7] of WideChar;
  end;
const DISK_PERFORMANCE = extern struct {
    BytesRead: i64,
    BytesWritten: i64,
    ReadTime: i64,
    WriteTime: i64,
    IdleTime: i64,
    ReadCount: u32,
    WriteCount: u32,
    QueueDepth: u32,
    SplitCount: u32,
    QueryTime: i64,
    StorageDeviceNumber: u32,
    StorageManagerName: [8]u16,
};
type
  DISK_PERFORMANCE {.bycopy.} = object
    BytesRead: int64
    BytesWritten: int64
    ReadTime: int64
    WriteTime: int64
    IdleTime: int64
    ReadCount: uint32
    WriteCount: uint32
    QueueDepth: uint32
    SplitCount: uint32
    QueryTime: int64
    StorageDeviceNumber: uint32
    StorageManagerName: array[8, uint16]
struct DISK_PERFORMANCE
{
    long BytesRead;
    long BytesWritten;
    long ReadTime;
    long WriteTime;
    long IdleTime;
    uint ReadCount;
    uint WriteCount;
    uint QueueDepth;
    uint SplitCount;
    long QueryTime;
    uint StorageDeviceNumber;
    wchar[8] StorageManagerName;
}

HSP用 定義

HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DISK_PERFORMANCE サイズ: 88 バイト(x64)
dim st, 22    ; 4byte整数×22(構造体サイズ 88 / 4 切り上げ)
; BytesRead : LONGLONG (+0, 8byte)  qpoke st,0,値 / qpeek(st,0)  ※IronHSPのみ。3.7/3.8は lpoke st,0,下位 : lpoke st,4,上位
; BytesWritten : LONGLONG (+8, 8byte)  qpoke st,8,値 / qpeek(st,8)  ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; ReadTime : LONGLONG (+16, 8byte)  qpoke st,16,値 / qpeek(st,16)  ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; WriteTime : LONGLONG (+24, 8byte)  qpoke st,24,値 / qpeek(st,24)  ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; IdleTime : LONGLONG (+32, 8byte)  qpoke st,32,値 / qpeek(st,32)  ※IronHSPのみ。3.7/3.8は lpoke st,32,下位 : lpoke st,36,上位
; ReadCount : DWORD (+40, 4byte)  st.10 = 値  /  値 = st.10   (lpoke/lpeek も可)
; WriteCount : DWORD (+44, 4byte)  st.11 = 値  /  値 = st.11   (lpoke/lpeek も可)
; QueueDepth : DWORD (+48, 4byte)  st.12 = 値  /  値 = st.12   (lpoke/lpeek も可)
; SplitCount : DWORD (+52, 4byte)  st.13 = 値  /  値 = st.13   (lpoke/lpeek も可)
; QueryTime : LONGLONG (+56, 8byte)  qpoke st,56,値 / qpeek(st,56)  ※IronHSPのみ。3.7/3.8は lpoke st,56,下位 : lpoke st,60,上位
; StorageDeviceNumber : DWORD (+64, 4byte)  st.16 = 値  /  値 = st.16   (lpoke/lpeek も可)
; StorageManagerName : WCHAR (+68, 16byte)  varptr(st)+68 を基点に操作(16byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global DISK_PERFORMANCE
    #field int64 BytesRead
    #field int64 BytesWritten
    #field int64 ReadTime
    #field int64 WriteTime
    #field int64 IdleTime
    #field int ReadCount
    #field int WriteCount
    #field int QueueDepth
    #field int SplitCount
    #field int64 QueryTime
    #field int StorageDeviceNumber
    #field wchar StorageManagerName 8
#endstruct

stdim st, DISK_PERFORMANCE        ; NSTRUCT 変数を確保
st->BytesRead = 100
mes "BytesRead=" + st->BytesRead