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

PERF_COUNTERSET_REG_INFO

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

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

フィールド

フィールドサイズx64x86説明
CounterSetGuidGUID16+0+0登録するカウンタセットのGUIDである。
CounterSetTypeDWORD4+16+16カウンタセットの種別フラグである。
DetailLevelDWORD4+20+20カウンタセットの詳細レベル(PERF_DETAIL値)である。
NumCountersDWORD4+24+24このカウンタセットに含まれるカウンタの個数である。
InstanceTypeDWORD4+28+28カウンタセットのインスタンス種別(単一/複数集約等)である。

各言語での定義

#include <windows.h>

// PERF_COUNTERSET_REG_INFO  (x64 32 / x86 32 バイト)
typedef struct PERF_COUNTERSET_REG_INFO {
    GUID CounterSetGuid;
    DWORD CounterSetType;
    DWORD DetailLevel;
    DWORD NumCounters;
    DWORD InstanceType;
} PERF_COUNTERSET_REG_INFO;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct PERF_COUNTERSET_REG_INFO
{
    public Guid CounterSetGuid;
    public uint CounterSetType;
    public uint DetailLevel;
    public uint NumCounters;
    public uint InstanceType;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure PERF_COUNTERSET_REG_INFO
    Public CounterSetGuid As Guid
    Public CounterSetType As UInteger
    Public DetailLevel As UInteger
    Public NumCounters As UInteger
    Public InstanceType As UInteger
End Structure
import ctypes
from ctypes import wintypes

class PERF_COUNTERSET_REG_INFO(ctypes.Structure):
    _fields_ = [
        ("CounterSetGuid", GUID),
        ("CounterSetType", wintypes.DWORD),
        ("DetailLevel", wintypes.DWORD),
        ("NumCounters", wintypes.DWORD),
        ("InstanceType", wintypes.DWORD),
    ]
#[repr(C)]
pub struct PERF_COUNTERSET_REG_INFO {
    pub CounterSetGuid: GUID,
    pub CounterSetType: u32,
    pub DetailLevel: u32,
    pub NumCounters: u32,
    pub InstanceType: u32,
}
import "golang.org/x/sys/windows"

type PERF_COUNTERSET_REG_INFO struct {
	CounterSetGuid windows.GUID
	CounterSetType uint32
	DetailLevel uint32
	NumCounters uint32
	InstanceType uint32
}
type
  PERF_COUNTERSET_REG_INFO = record
    CounterSetGuid: TGUID;
    CounterSetType: DWORD;
    DetailLevel: DWORD;
    NumCounters: DWORD;
    InstanceType: DWORD;
  end;
const PERF_COUNTERSET_REG_INFO = extern struct {
    CounterSetGuid: GUID,
    CounterSetType: u32,
    DetailLevel: u32,
    NumCounters: u32,
    InstanceType: u32,
};
type
  PERF_COUNTERSET_REG_INFO {.bycopy.} = object
    CounterSetGuid: GUID
    CounterSetType: uint32
    DetailLevel: uint32
    NumCounters: uint32
    InstanceType: uint32
struct PERF_COUNTERSET_REG_INFO
{
    GUID CounterSetGuid;
    uint CounterSetType;
    uint DetailLevel;
    uint NumCounters;
    uint InstanceType;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; PERF_COUNTERSET_REG_INFO サイズ: 32 バイト(x64)
dim st, 8    ; 4byte整数×8(構造体サイズ 32 / 4 切り上げ)
; CounterSetGuid : GUID (+0, 16byte)  varptr(st)+0 を基点に操作(16byte:入れ子/配列)
; CounterSetType : DWORD (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; DetailLevel : DWORD (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; NumCounters : DWORD (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; InstanceType : DWORD (+28, 4byte)  st.7 = 値  /  値 = st.7   (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_COUNTERSET_REG_INFO
    #field GUID CounterSetGuid
    #field int CounterSetType
    #field int DetailLevel
    #field int NumCounters
    #field int InstanceType
#endstruct

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