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読み取りの完了に要する時間です。
WriteTimeLONGLONG8+24+24書き込みの完了に要する時間です。
IdleTimeLONGLONG8+32+32アイドル時間です。
ReadCountDWORD4+40+40読み取り操作の回数です。
WriteCountDWORD4+44+44書き込み操作の回数です。
QueueDepthDWORD4+48+48キューの深さです。
SplitCountDWORD4+52+52

関連付けられた I/O である I/O の累積数です。

関連付けられた I/O とは分割された I/O のことで、元の論理 I/O 要求を満たすためにディスクへの複数の I/O が必要となるものを指します。このシナリオの最も一般的な例は、ディスク上で断片化しているファイルです。これらの複数の I/O は分割 I/O 数としてカウントされます。

QueryTimeLONGLONG8+56+56

この構造体に対するクエリが返されたときのシステム タイム スタンプです。

このメンバーは、ファイル システム ドライバーと呼び出し元との間の同期に使用します。

StorageDeviceNumberDWORD4+64+64StorageManagerName メンバーで示されるストレージ マネージャーがデバイスを識別するための、一意の番号です。
StorageManagerNameWCHAR16+68+68

このデバイスを制御するストレージ マネージャーの名前です。

ストレージ マネージャーの例としては、"PhysDisk"、"FTDISK"、"DMIO" があります。

公式ドキュメント

ディスクのパフォーマンス情報を提供します。この構造体は IOCTL_DISK_PERFORMANCE 制御コードで使用されます。

出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)

各言語での定義

#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