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

PERF_COUNTERSET_INSTANCE

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

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

フィールド

フィールドサイズx64x86説明
CounterSetGuidGUID16+0+0このインスタンスが属するカウンタセットのGUIDである。
dwSizeDWORD4+16+16このインスタンス構造体全体のバイトサイズである。
InstanceIdDWORD4+20+20カウンタセット内でインスタンスを識別するIDである。
InstanceNameOffsetDWORD4+24+24構造体先頭からインスタンス名文字列までのオフセットである。
InstanceNameSizeDWORD4+28+28インスタンス名のバイトサイズ(終端含む)である。

各言語での定義

#include <windows.h>

// PERF_COUNTERSET_INSTANCE  (x64 32 / x86 32 バイト)
typedef struct PERF_COUNTERSET_INSTANCE {
    GUID CounterSetGuid;
    DWORD dwSize;
    DWORD InstanceId;
    DWORD InstanceNameOffset;
    DWORD InstanceNameSize;
} PERF_COUNTERSET_INSTANCE;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct PERF_COUNTERSET_INSTANCE
{
    public Guid CounterSetGuid;
    public uint dwSize;
    public uint InstanceId;
    public uint InstanceNameOffset;
    public uint InstanceNameSize;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure PERF_COUNTERSET_INSTANCE
    Public CounterSetGuid As Guid
    Public dwSize As UInteger
    Public InstanceId As UInteger
    Public InstanceNameOffset As UInteger
    Public InstanceNameSize As UInteger
End Structure
import ctypes
from ctypes import wintypes

class PERF_COUNTERSET_INSTANCE(ctypes.Structure):
    _fields_ = [
        ("CounterSetGuid", GUID),
        ("dwSize", wintypes.DWORD),
        ("InstanceId", wintypes.DWORD),
        ("InstanceNameOffset", wintypes.DWORD),
        ("InstanceNameSize", wintypes.DWORD),
    ]
#[repr(C)]
pub struct PERF_COUNTERSET_INSTANCE {
    pub CounterSetGuid: GUID,
    pub dwSize: u32,
    pub InstanceId: u32,
    pub InstanceNameOffset: u32,
    pub InstanceNameSize: u32,
}
import "golang.org/x/sys/windows"

type PERF_COUNTERSET_INSTANCE struct {
	CounterSetGuid windows.GUID
	dwSize uint32
	InstanceId uint32
	InstanceNameOffset uint32
	InstanceNameSize uint32
}
type
  PERF_COUNTERSET_INSTANCE = record
    CounterSetGuid: TGUID;
    dwSize: DWORD;
    InstanceId: DWORD;
    InstanceNameOffset: DWORD;
    InstanceNameSize: DWORD;
  end;
const PERF_COUNTERSET_INSTANCE = extern struct {
    CounterSetGuid: GUID,
    dwSize: u32,
    InstanceId: u32,
    InstanceNameOffset: u32,
    InstanceNameSize: u32,
};
type
  PERF_COUNTERSET_INSTANCE {.bycopy.} = object
    CounterSetGuid: GUID
    dwSize: uint32
    InstanceId: uint32
    InstanceNameOffset: uint32
    InstanceNameSize: uint32
struct PERF_COUNTERSET_INSTANCE
{
    GUID CounterSetGuid;
    uint dwSize;
    uint InstanceId;
    uint InstanceNameOffset;
    uint InstanceNameSize;
}

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_INSTANCE サイズ: 32 バイト(x64)
dim st, 8    ; 4byte整数×8(構造体サイズ 32 / 4 切り上げ)
; CounterSetGuid : GUID (+0, 16byte)  varptr(st)+0 を基点に操作(16byte:入れ子/配列)
; dwSize : DWORD (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; InstanceId : DWORD (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; InstanceNameOffset : DWORD (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; InstanceNameSize : 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_INSTANCE
    #field GUID CounterSetGuid
    #field int dwSize
    #field int InstanceId
    #field int InstanceNameOffset
    #field int InstanceNameSize
#endstruct

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