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

PERF_COUNTER_REG_INFO

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

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

フィールド

フィールドサイズx64x86説明
CounterIdDWORD4+0+0カウンタセット内のカウンタ識別子である。
TypeDWORD4+4+4カウンタの種類(PERF_COUNTER_系)を示す。
AttribULONGLONG8+8+8カウンタの属性を示すビットフラグ(PERF_ATTRIB値)である。
DetailLevelDWORD4+16+16このカウンタの詳細レベル(PERF_DETAIL値)である。
DefaultScaleINT4+20+20カウンタ値表示の既定スケール(10のべき乗指数)である。
BaseCounterIdDWORD4+24+24比率計算等で参照する基準カウンタのIDである。
PerfTimeIdDWORD4+28+28時刻計算に用いるカウンタのIDである。
PerfFreqIdDWORD4+32+32周波数計算に用いるカウンタのIDである。
MultiIdDWORD4+36+36マルチカウンタ計算で参照するカウンタのIDである。
AggregateFuncPERF_COUNTER_AGGREGATE_FUNC4+40+40複数インスタンス集約時の関数(PERF_COUNTER_AGGREGATE_FUNC)である。
ReservedDWORD4+44+44予約フィールドである。0となる。

各言語での定義

#include <windows.h>

// PERF_COUNTER_REG_INFO  (x64 48 / x86 48 バイト)
typedef struct PERF_COUNTER_REG_INFO {
    DWORD CounterId;
    DWORD Type;
    ULONGLONG Attrib;
    DWORD DetailLevel;
    INT DefaultScale;
    DWORD BaseCounterId;
    DWORD PerfTimeId;
    DWORD PerfFreqId;
    DWORD MultiId;
    PERF_COUNTER_AGGREGATE_FUNC AggregateFunc;
    DWORD Reserved;
} PERF_COUNTER_REG_INFO;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct PERF_COUNTER_REG_INFO
{
    public uint CounterId;
    public uint Type;
    public ulong Attrib;
    public uint DetailLevel;
    public int DefaultScale;
    public uint BaseCounterId;
    public uint PerfTimeId;
    public uint PerfFreqId;
    public uint MultiId;
    public uint AggregateFunc;
    public uint Reserved;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure PERF_COUNTER_REG_INFO
    Public CounterId As UInteger
    Public Type As UInteger
    Public Attrib As ULong
    Public DetailLevel As UInteger
    Public DefaultScale As Integer
    Public BaseCounterId As UInteger
    Public PerfTimeId As UInteger
    Public PerfFreqId As UInteger
    Public MultiId As UInteger
    Public AggregateFunc As UInteger
    Public Reserved As UInteger
End Structure
import ctypes
from ctypes import wintypes

class PERF_COUNTER_REG_INFO(ctypes.Structure):
    _fields_ = [
        ("CounterId", wintypes.DWORD),
        ("Type", wintypes.DWORD),
        ("Attrib", ctypes.c_ulonglong),
        ("DetailLevel", wintypes.DWORD),
        ("DefaultScale", ctypes.c_int),
        ("BaseCounterId", wintypes.DWORD),
        ("PerfTimeId", wintypes.DWORD),
        ("PerfFreqId", wintypes.DWORD),
        ("MultiId", wintypes.DWORD),
        ("AggregateFunc", wintypes.DWORD),
        ("Reserved", wintypes.DWORD),
    ]
#[repr(C)]
pub struct PERF_COUNTER_REG_INFO {
    pub CounterId: u32,
    pub Type: u32,
    pub Attrib: u64,
    pub DetailLevel: u32,
    pub DefaultScale: i32,
    pub BaseCounterId: u32,
    pub PerfTimeId: u32,
    pub PerfFreqId: u32,
    pub MultiId: u32,
    pub AggregateFunc: u32,
    pub Reserved: u32,
}
import "golang.org/x/sys/windows"

type PERF_COUNTER_REG_INFO struct {
	CounterId uint32
	Type uint32
	Attrib uint64
	DetailLevel uint32
	DefaultScale int32
	BaseCounterId uint32
	PerfTimeId uint32
	PerfFreqId uint32
	MultiId uint32
	AggregateFunc uint32
	Reserved uint32
}
type
  PERF_COUNTER_REG_INFO = record
    CounterId: DWORD;
    Type: DWORD;
    Attrib: UInt64;
    DetailLevel: DWORD;
    DefaultScale: Integer;
    BaseCounterId: DWORD;
    PerfTimeId: DWORD;
    PerfFreqId: DWORD;
    MultiId: DWORD;
    AggregateFunc: DWORD;
    Reserved: DWORD;
  end;
const PERF_COUNTER_REG_INFO = extern struct {
    CounterId: u32,
    Type: u32,
    Attrib: u64,
    DetailLevel: u32,
    DefaultScale: i32,
    BaseCounterId: u32,
    PerfTimeId: u32,
    PerfFreqId: u32,
    MultiId: u32,
    AggregateFunc: u32,
    Reserved: u32,
};
type
  PERF_COUNTER_REG_INFO {.bycopy.} = object
    CounterId: uint32
    Type: uint32
    Attrib: uint64
    DetailLevel: uint32
    DefaultScale: int32
    BaseCounterId: uint32
    PerfTimeId: uint32
    PerfFreqId: uint32
    MultiId: uint32
    AggregateFunc: uint32
    Reserved: uint32
struct PERF_COUNTER_REG_INFO
{
    uint CounterId;
    uint Type;
    ulong Attrib;
    uint DetailLevel;
    int DefaultScale;
    uint BaseCounterId;
    uint PerfTimeId;
    uint PerfFreqId;
    uint MultiId;
    uint AggregateFunc;
    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_REG_INFO サイズ: 48 バイト(x64)
dim st, 12    ; 4byte整数×12(構造体サイズ 48 / 4 切り上げ)
; CounterId : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; Type : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; Attrib : ULONGLONG (+8, 8byte)  qpoke st,8,値 / qpeek(st,8)  ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; DetailLevel : DWORD (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; DefaultScale : INT (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; BaseCounterId : DWORD (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; PerfTimeId : DWORD (+28, 4byte)  st.7 = 値  /  値 = st.7   (lpoke/lpeek も可)
; PerfFreqId : DWORD (+32, 4byte)  st.8 = 値  /  値 = st.8   (lpoke/lpeek も可)
; MultiId : DWORD (+36, 4byte)  st.9 = 値  /  値 = st.9   (lpoke/lpeek も可)
; AggregateFunc : PERF_COUNTER_AGGREGATE_FUNC (+40, 4byte)  st.10 = 値  /  値 = st.10   (lpoke/lpeek も可)
; Reserved : DWORD (+44, 4byte)  st.11 = 値  /  値 = st.11   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global PERF_COUNTER_REG_INFO
    #field int CounterId
    #field int Type
    #field int64 Attrib
    #field int DetailLevel
    #field int DefaultScale
    #field int BaseCounterId
    #field int PerfTimeId
    #field int PerfFreqId
    #field int MultiId
    #field int AggregateFunc
    #field int Reserved
#endstruct

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