Win32 API 日本語リファレンス
ホームStorage.Nvme › NVME_LATENCY_MONITORING_ENTRY

NVME_LATENCY_MONITORING_ENTRY

構造体
サイズx64: 4096 バイト / x86: 4096 バイトパッキング1

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

フィールド

フィールドサイズx64x86説明
ActiveBucketTimerThresholdWORD2+0+0アクティブバケットタイマのしきい値。
ActiveThresholdABYTE1+2+2アクティブバケットAのレイテンシしきい値。
ActiveThresholdBBYTE1+3+3アクティブバケットBのレイテンシしきい値。
ActiveThresholdCBYTE1+4+4アクティブバケットCのレイテンシしきい値。
ActiveThresholdDBYTE1+5+5アクティブバケットDのレイテンシしきい値。
ActiveLatencyConfigWORD2+6+6アクティブレイテンシ監視の設定値。
ActiveLatencyMinimumWindowBYTE1+8+8アクティブレイテンシ計測の最小ウィンドウ幅。
DebugLogTriggerEnableWORD2+9+9デバッグログトリガの有効化ビット群。
DiscardDebugLogBYTE1+11+11デバッグログを破棄するかを示すフラグ。
LatencyMonitorFeatureEnableBYTE1+12+12レイテンシ監視機能を有効化するフラグ。
Reserved0BYTE4083+13+13予約領域。将来拡張用で0とする。

各言語での定義

#include <windows.h>

// NVME_LATENCY_MONITORING_ENTRY  (x64 4096 / x86 4096 バイト)
#pragma pack(push, 1)
typedef struct NVME_LATENCY_MONITORING_ENTRY {
    WORD ActiveBucketTimerThreshold;
    BYTE ActiveThresholdA;
    BYTE ActiveThresholdB;
    BYTE ActiveThresholdC;
    BYTE ActiveThresholdD;
    WORD ActiveLatencyConfig;
    BYTE ActiveLatencyMinimumWindow;
    WORD DebugLogTriggerEnable;
    BYTE DiscardDebugLog;
    BYTE LatencyMonitorFeatureEnable;
    BYTE Reserved0[4083];
} NVME_LATENCY_MONITORING_ENTRY;
#pragma pack(pop)
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)]
public struct NVME_LATENCY_MONITORING_ENTRY
{
    public ushort ActiveBucketTimerThreshold;
    public byte ActiveThresholdA;
    public byte ActiveThresholdB;
    public byte ActiveThresholdC;
    public byte ActiveThresholdD;
    public ushort ActiveLatencyConfig;
    public byte ActiveLatencyMinimumWindow;
    public ushort DebugLogTriggerEnable;
    public byte DiscardDebugLog;
    public byte LatencyMonitorFeatureEnable;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4083)] public byte[] Reserved0;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, Pack:=1, CharSet:=CharSet.Unicode)>
Public Structure NVME_LATENCY_MONITORING_ENTRY
    Public ActiveBucketTimerThreshold As UShort
    Public ActiveThresholdA As Byte
    Public ActiveThresholdB As Byte
    Public ActiveThresholdC As Byte
    Public ActiveThresholdD As Byte
    Public ActiveLatencyConfig As UShort
    Public ActiveLatencyMinimumWindow As Byte
    Public DebugLogTriggerEnable As UShort
    Public DiscardDebugLog As Byte
    Public LatencyMonitorFeatureEnable As Byte
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=4083)> Public Reserved0() As Byte
End Structure
import ctypes
from ctypes import wintypes

class NVME_LATENCY_MONITORING_ENTRY(ctypes.Structure):
    _pack_ = 1
    _fields_ = [
        ("ActiveBucketTimerThreshold", ctypes.c_ushort),
        ("ActiveThresholdA", ctypes.c_ubyte),
        ("ActiveThresholdB", ctypes.c_ubyte),
        ("ActiveThresholdC", ctypes.c_ubyte),
        ("ActiveThresholdD", ctypes.c_ubyte),
        ("ActiveLatencyConfig", ctypes.c_ushort),
        ("ActiveLatencyMinimumWindow", ctypes.c_ubyte),
        ("DebugLogTriggerEnable", ctypes.c_ushort),
        ("DiscardDebugLog", ctypes.c_ubyte),
        ("LatencyMonitorFeatureEnable", ctypes.c_ubyte),
        ("Reserved0", ctypes.c_ubyte * 4083),
    ]
#[repr(C, packed(1))]
pub struct NVME_LATENCY_MONITORING_ENTRY {
    pub ActiveBucketTimerThreshold: u16,
    pub ActiveThresholdA: u8,
    pub ActiveThresholdB: u8,
    pub ActiveThresholdC: u8,
    pub ActiveThresholdD: u8,
    pub ActiveLatencyConfig: u16,
    pub ActiveLatencyMinimumWindow: u8,
    pub DebugLogTriggerEnable: u16,
    pub DiscardDebugLog: u8,
    pub LatencyMonitorFeatureEnable: u8,
    pub Reserved0: [u8; 4083],
}
import "golang.org/x/sys/windows"

type NVME_LATENCY_MONITORING_ENTRY struct {
	ActiveBucketTimerThreshold uint16
	ActiveThresholdA byte
	ActiveThresholdB byte
	ActiveThresholdC byte
	ActiveThresholdD byte
	ActiveLatencyConfig uint16
	ActiveLatencyMinimumWindow byte
	DebugLogTriggerEnable uint16
	DiscardDebugLog byte
	LatencyMonitorFeatureEnable byte
	Reserved0 [4083]byte
}
type
  NVME_LATENCY_MONITORING_ENTRY = packed record
    ActiveBucketTimerThreshold: Word;
    ActiveThresholdA: Byte;
    ActiveThresholdB: Byte;
    ActiveThresholdC: Byte;
    ActiveThresholdD: Byte;
    ActiveLatencyConfig: Word;
    ActiveLatencyMinimumWindow: Byte;
    DebugLogTriggerEnable: Word;
    DiscardDebugLog: Byte;
    LatencyMonitorFeatureEnable: Byte;
    Reserved0: array[0..4082] of Byte;
  end;
const NVME_LATENCY_MONITORING_ENTRY = extern struct {
    ActiveBucketTimerThreshold: u16,
    ActiveThresholdA: u8,
    ActiveThresholdB: u8,
    ActiveThresholdC: u8,
    ActiveThresholdD: u8,
    ActiveLatencyConfig: u16,
    ActiveLatencyMinimumWindow: u8,
    DebugLogTriggerEnable: u16,
    DiscardDebugLog: u8,
    LatencyMonitorFeatureEnable: u8,
    Reserved0: [4083]u8,
};
type
  NVME_LATENCY_MONITORING_ENTRY {.packed.} = object
    ActiveBucketTimerThreshold: uint16
    ActiveThresholdA: uint8
    ActiveThresholdB: uint8
    ActiveThresholdC: uint8
    ActiveThresholdD: uint8
    ActiveLatencyConfig: uint16
    ActiveLatencyMinimumWindow: uint8
    DebugLogTriggerEnable: uint16
    DiscardDebugLog: uint8
    LatencyMonitorFeatureEnable: uint8
    Reserved0: array[4083, uint8]
align(1)
struct NVME_LATENCY_MONITORING_ENTRY
{
    ushort ActiveBucketTimerThreshold;
    ubyte ActiveThresholdA;
    ubyte ActiveThresholdB;
    ubyte ActiveThresholdC;
    ubyte ActiveThresholdD;
    ushort ActiveLatencyConfig;
    ubyte ActiveLatencyMinimumWindow;
    ushort DebugLogTriggerEnable;
    ubyte DiscardDebugLog;
    ubyte LatencyMonitorFeatureEnable;
    ubyte[4083] Reserved0;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; NVME_LATENCY_MONITORING_ENTRY サイズ: 4096 バイト(x64)
dim st, 1024    ; 4byte整数×1024(構造体サイズ 4096 / 4 切り上げ)
; ActiveBucketTimerThreshold : WORD (+0, 2byte)  wpoke st,0,値  /  値 = wpeek(st,0)
; ActiveThresholdA : BYTE (+2, 1byte)  poke st,2,値  /  値 = peek(st,2)
; ActiveThresholdB : BYTE (+3, 1byte)  poke st,3,値  /  値 = peek(st,3)
; ActiveThresholdC : BYTE (+4, 1byte)  poke st,4,値  /  値 = peek(st,4)
; ActiveThresholdD : BYTE (+5, 1byte)  poke st,5,値  /  値 = peek(st,5)
; ActiveLatencyConfig : WORD (+6, 2byte)  wpoke st,6,値  /  値 = wpeek(st,6)
; ActiveLatencyMinimumWindow : BYTE (+8, 1byte)  poke st,8,値  /  値 = peek(st,8)
; DebugLogTriggerEnable : WORD (+9, 2byte)  wpoke st,9,値  /  値 = wpeek(st,9)
; DiscardDebugLog : BYTE (+11, 1byte)  poke st,11,値  /  値 = peek(st,11)
; LatencyMonitorFeatureEnable : BYTE (+12, 1byte)  poke st,12,値  /  値 = peek(st,12)
; Reserved0 : BYTE (+13, 4083byte)  varptr(st)+13 を基点に操作(4083byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global NVME_LATENCY_MONITORING_ENTRY, pack=1
    #field short ActiveBucketTimerThreshold
    #field byte ActiveThresholdA
    #field byte ActiveThresholdB
    #field byte ActiveThresholdC
    #field byte ActiveThresholdD
    #field short ActiveLatencyConfig
    #field byte ActiveLatencyMinimumWindow
    #field short DebugLogTriggerEnable
    #field byte DiscardDebugLog
    #field byte LatencyMonitorFeatureEnable
    #field byte Reserved0 4083
#endstruct

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