ホーム › Storage.Nvme › BUCKET_COUNTER
BUCKET_COUNTER
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| Reserved | DWORD | 4 | +0 | +0 | 予約領域。将来拡張用で0とする。 |
| Trim | DWORD | 4 | +4 | +4 | このバケットでのTrim(Deallocate)操作の発生回数。 |
| Write | DWORD | 4 | +8 | +8 | このバケットでの書き込み操作の発生回数。 |
| Read | DWORD | 4 | +12 | +12 | このバケットでの読み取り操作の発生回数。 |
各言語での定義
#include <windows.h>
// BUCKET_COUNTER (x64 16 / x86 16 バイト)
#pragma pack(push, 1)
typedef struct BUCKET_COUNTER {
DWORD Reserved;
DWORD Trim;
DWORD Write;
DWORD Read;
} BUCKET_COUNTER;
#pragma pack(pop)using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)]
public struct BUCKET_COUNTER
{
public uint Reserved;
public uint Trim;
public uint Write;
public uint Read;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, Pack:=1, CharSet:=CharSet.Unicode)>
Public Structure BUCKET_COUNTER
Public Reserved As UInteger
Public Trim As UInteger
Public Write As UInteger
Public Read As UInteger
End Structureimport ctypes
from ctypes import wintypes
class BUCKET_COUNTER(ctypes.Structure):
_pack_ = 1
_fields_ = [
("Reserved", wintypes.DWORD),
("Trim", wintypes.DWORD),
("Write", wintypes.DWORD),
("Read", wintypes.DWORD),
]#[repr(C, packed(1))]
pub struct BUCKET_COUNTER {
pub Reserved: u32,
pub Trim: u32,
pub Write: u32,
pub Read: u32,
}import "golang.org/x/sys/windows"
type BUCKET_COUNTER struct {
Reserved uint32
Trim uint32
Write uint32
Read uint32
}type
BUCKET_COUNTER = packed record
Reserved: DWORD;
Trim: DWORD;
Write: DWORD;
Read: DWORD;
end;const BUCKET_COUNTER = extern struct {
Reserved: u32,
Trim: u32,
Write: u32,
Read: u32,
};type
BUCKET_COUNTER {.packed.} = object
Reserved: uint32
Trim: uint32
Write: uint32
Read: uint32align(1)
struct BUCKET_COUNTER
{
uint Reserved;
uint Trim;
uint Write;
uint Read;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; BUCKET_COUNTER サイズ: 16 バイト(x64)
dim st, 4 ; 4byte整数×4(構造体サイズ 16 / 4 切り上げ)
; Reserved : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; Trim : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; Write : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; Read : DWORD (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global BUCKET_COUNTER, pack=1
#field int Reserved
#field int Trim
#field int Write
#field int Read
#endstruct
stdim st, BUCKET_COUNTER ; NSTRUCT 変数を確保
st->Reserved = 100
mes "Reserved=" + st->Reserved