ホーム › System.Performance › PERF_COUNTER_IDENTIFIER
PERF_COUNTER_IDENTIFIER
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| CounterSetGuid | GUID | 16 | +0 | +0 | 対象カウンタセットのGUIDである。 |
| Status | DWORD | 4 | +16 | +16 | 問い合わせ結果のステータスコードである。 |
| Size | DWORD | 4 | +20 | +20 | この識別子構造体のバイトサイズである。 |
| CounterId | DWORD | 4 | +24 | +24 | 対象カウンタの識別子である。全カウンタ指定時はPERF_WILDCARD_COUNTER。 |
| InstanceId | DWORD | 4 | +28 | +28 | 対象インスタンスの識別子である。 |
| Index | DWORD | 4 | +32 | +32 | 結果配列内のインデックスである。 |
| Reserved | DWORD | 4 | +36 | +36 | 予約フィールドである。0となる。 |
各言語での定義
#include <windows.h>
// PERF_COUNTER_IDENTIFIER (x64 40 / x86 40 バイト)
typedef struct PERF_COUNTER_IDENTIFIER {
GUID CounterSetGuid;
DWORD Status;
DWORD Size;
DWORD CounterId;
DWORD InstanceId;
DWORD Index;
DWORD Reserved;
} PERF_COUNTER_IDENTIFIER;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct PERF_COUNTER_IDENTIFIER
{
public Guid CounterSetGuid;
public uint Status;
public uint Size;
public uint CounterId;
public uint InstanceId;
public uint Index;
public uint Reserved;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure PERF_COUNTER_IDENTIFIER
Public CounterSetGuid As Guid
Public Status As UInteger
Public Size As UInteger
Public CounterId As UInteger
Public InstanceId As UInteger
Public Index As UInteger
Public Reserved As UInteger
End Structureimport ctypes
from ctypes import wintypes
class PERF_COUNTER_IDENTIFIER(ctypes.Structure):
_fields_ = [
("CounterSetGuid", GUID),
("Status", wintypes.DWORD),
("Size", wintypes.DWORD),
("CounterId", wintypes.DWORD),
("InstanceId", wintypes.DWORD),
("Index", wintypes.DWORD),
("Reserved", wintypes.DWORD),
]#[repr(C)]
pub struct PERF_COUNTER_IDENTIFIER {
pub CounterSetGuid: GUID,
pub Status: u32,
pub Size: u32,
pub CounterId: u32,
pub InstanceId: u32,
pub Index: u32,
pub Reserved: u32,
}import "golang.org/x/sys/windows"
type PERF_COUNTER_IDENTIFIER struct {
CounterSetGuid windows.GUID
Status uint32
Size uint32
CounterId uint32
InstanceId uint32
Index uint32
Reserved uint32
}type
PERF_COUNTER_IDENTIFIER = record
CounterSetGuid: TGUID;
Status: DWORD;
Size: DWORD;
CounterId: DWORD;
InstanceId: DWORD;
Index: DWORD;
Reserved: DWORD;
end;const PERF_COUNTER_IDENTIFIER = extern struct {
CounterSetGuid: GUID,
Status: u32,
Size: u32,
CounterId: u32,
InstanceId: u32,
Index: u32,
Reserved: u32,
};type
PERF_COUNTER_IDENTIFIER {.bycopy.} = object
CounterSetGuid: GUID
Status: uint32
Size: uint32
CounterId: uint32
InstanceId: uint32
Index: uint32
Reserved: uint32struct PERF_COUNTER_IDENTIFIER
{
GUID CounterSetGuid;
uint Status;
uint Size;
uint CounterId;
uint InstanceId;
uint Index;
uint Reserved;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; PERF_COUNTER_IDENTIFIER サイズ: 40 バイト(x64)
dim st, 10 ; 4byte整数×10(構造体サイズ 40 / 4 切り上げ)
; CounterSetGuid : GUID (+0, 16byte) varptr(st)+0 を基点に操作(16byte:入れ子/配列)
; Status : DWORD (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; Size : DWORD (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; CounterId : DWORD (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; InstanceId : DWORD (+28, 4byte) st.7 = 値 / 値 = st.7 (lpoke/lpeek も可)
; Index : DWORD (+32, 4byte) st.8 = 値 / 値 = st.8 (lpoke/lpeek も可)
; Reserved : DWORD (+36, 4byte) st.9 = 値 / 値 = st.9 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global GUID, pack=1
#field int Data1
#field short Data2
#field short Data3
#field byte Data4 8
#endstruct
#defstruct global PERF_COUNTER_IDENTIFIER
#field GUID CounterSetGuid
#field int Status
#field int Size
#field int CounterId
#field int InstanceId
#field int Index
#field int Reserved
#endstruct
stdim st, PERF_COUNTER_IDENTIFIER ; NSTRUCT 変数を確保
st->Status = 100
mes "Status=" + st->Status