ホーム › System.Performance › PERF_COUNTER_DEFINITION
PERF_COUNTER_DEFINITION
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| ByteLength | DWORD | 4 | +0 | +0 | このカウンタ定義構造体のバイト長である。 |
| CounterNameTitleIndex | DWORD | 4 | +4 | +4 | カウンタ名の文字列リソースインデックスである。 |
| CounterNameTitle | LPWSTR | 8/4 | +8 | +8 | カウンタ名文字列(DWORD予約または実行時設定のLPWSTR)である。 |
| CounterHelpTitleIndex | DWORD | 4 | +16 | +12 | カウンタのヘルプ文字列リソースインデックスである。 |
| CounterHelpTitle | LPWSTR | 8/4 | +24 | +16 | カウンタのヘルプ文字列(DWORD予約または実行時設定のLPWSTR)である。 |
| DefaultScale | INT | 4 | +32 | +20 | カウンタ値表示の既定スケール(10のべき乗指数)である。 |
| DetailLevel | DWORD | 4 | +36 | +24 | このカウンタの詳細レベル(PERF_DETAIL値)である。 |
| CounterType | DWORD | 4 | +40 | +28 | カウンタの種類(PERF_COUNTER_系)を示す。 |
| CounterSize | DWORD | 4 | +44 | +32 | カウンタデータのバイトサイズである。 |
| CounterOffset | DWORD | 4 | +48 | +36 | PERF_COUNTER_BLOCK先頭からこのカウンタデータまでのオフセットである。 |
各言語での定義
#include <windows.h>
// PERF_COUNTER_DEFINITION (x64 56 / x86 40 バイト)
typedef struct PERF_COUNTER_DEFINITION {
DWORD ByteLength;
DWORD CounterNameTitleIndex;
LPWSTR CounterNameTitle;
DWORD CounterHelpTitleIndex;
LPWSTR CounterHelpTitle;
INT DefaultScale;
DWORD DetailLevel;
DWORD CounterType;
DWORD CounterSize;
DWORD CounterOffset;
} PERF_COUNTER_DEFINITION;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct PERF_COUNTER_DEFINITION
{
public uint ByteLength;
public uint CounterNameTitleIndex;
public IntPtr CounterNameTitle;
public uint CounterHelpTitleIndex;
public IntPtr CounterHelpTitle;
public int DefaultScale;
public uint DetailLevel;
public uint CounterType;
public uint CounterSize;
public uint CounterOffset;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure PERF_COUNTER_DEFINITION
Public ByteLength As UInteger
Public CounterNameTitleIndex As UInteger
Public CounterNameTitle As IntPtr
Public CounterHelpTitleIndex As UInteger
Public CounterHelpTitle As IntPtr
Public DefaultScale As Integer
Public DetailLevel As UInteger
Public CounterType As UInteger
Public CounterSize As UInteger
Public CounterOffset As UInteger
End Structureimport ctypes
from ctypes import wintypes
class PERF_COUNTER_DEFINITION(ctypes.Structure):
_fields_ = [
("ByteLength", wintypes.DWORD),
("CounterNameTitleIndex", wintypes.DWORD),
("CounterNameTitle", ctypes.c_void_p),
("CounterHelpTitleIndex", wintypes.DWORD),
("CounterHelpTitle", ctypes.c_void_p),
("DefaultScale", ctypes.c_int),
("DetailLevel", wintypes.DWORD),
("CounterType", wintypes.DWORD),
("CounterSize", wintypes.DWORD),
("CounterOffset", wintypes.DWORD),
]#[repr(C)]
pub struct PERF_COUNTER_DEFINITION {
pub ByteLength: u32,
pub CounterNameTitleIndex: u32,
pub CounterNameTitle: *mut core::ffi::c_void,
pub CounterHelpTitleIndex: u32,
pub CounterHelpTitle: *mut core::ffi::c_void,
pub DefaultScale: i32,
pub DetailLevel: u32,
pub CounterType: u32,
pub CounterSize: u32,
pub CounterOffset: u32,
}import "golang.org/x/sys/windows"
type PERF_COUNTER_DEFINITION struct {
ByteLength uint32
CounterNameTitleIndex uint32
CounterNameTitle uintptr
CounterHelpTitleIndex uint32
CounterHelpTitle uintptr
DefaultScale int32
DetailLevel uint32
CounterType uint32
CounterSize uint32
CounterOffset uint32
}type
PERF_COUNTER_DEFINITION = record
ByteLength: DWORD;
CounterNameTitleIndex: DWORD;
CounterNameTitle: Pointer;
CounterHelpTitleIndex: DWORD;
CounterHelpTitle: Pointer;
DefaultScale: Integer;
DetailLevel: DWORD;
CounterType: DWORD;
CounterSize: DWORD;
CounterOffset: DWORD;
end;const PERF_COUNTER_DEFINITION = extern struct {
ByteLength: u32,
CounterNameTitleIndex: u32,
CounterNameTitle: ?*anyopaque,
CounterHelpTitleIndex: u32,
CounterHelpTitle: ?*anyopaque,
DefaultScale: i32,
DetailLevel: u32,
CounterType: u32,
CounterSize: u32,
CounterOffset: u32,
};type
PERF_COUNTER_DEFINITION {.bycopy.} = object
ByteLength: uint32
CounterNameTitleIndex: uint32
CounterNameTitle: pointer
CounterHelpTitleIndex: uint32
CounterHelpTitle: pointer
DefaultScale: int32
DetailLevel: uint32
CounterType: uint32
CounterSize: uint32
CounterOffset: uint32struct PERF_COUNTER_DEFINITION
{
uint ByteLength;
uint CounterNameTitleIndex;
void* CounterNameTitle;
uint CounterHelpTitleIndex;
void* CounterHelpTitle;
int DefaultScale;
uint DetailLevel;
uint CounterType;
uint CounterSize;
uint CounterOffset;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; PERF_COUNTER_DEFINITION サイズ: 40 バイト(x86)
dim st, 10 ; 4byte整数×10(構造体サイズ 40 / 4 切り上げ)
; ByteLength : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; CounterNameTitleIndex : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; CounterNameTitle : LPWSTR (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; CounterHelpTitleIndex : DWORD (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; CounterHelpTitle : LPWSTR (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; DefaultScale : INT (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; DetailLevel : DWORD (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; CounterType : DWORD (+28, 4byte) st.7 = 値 / 値 = st.7 (lpoke/lpeek も可)
; CounterSize : DWORD (+32, 4byte) st.8 = 値 / 値 = st.8 (lpoke/lpeek も可)
; CounterOffset : DWORD (+36, 4byte) st.9 = 値 / 値 = st.9 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; PERF_COUNTER_DEFINITION サイズ: 56 バイト(x64)
dim st, 14 ; 4byte整数×14(構造体サイズ 56 / 4 切り上げ)
; ByteLength : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; CounterNameTitleIndex : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; CounterNameTitle : LPWSTR (+8, 8byte) qpoke st,8,値 / qpeek(st,8) ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; CounterHelpTitleIndex : DWORD (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; CounterHelpTitle : LPWSTR (+24, 8byte) qpoke st,24,値 / qpeek(st,24) ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; DefaultScale : INT (+32, 4byte) st.8 = 値 / 値 = st.8 (lpoke/lpeek も可)
; DetailLevel : DWORD (+36, 4byte) st.9 = 値 / 値 = st.9 (lpoke/lpeek も可)
; CounterType : DWORD (+40, 4byte) st.10 = 値 / 値 = st.10 (lpoke/lpeek も可)
; CounterSize : DWORD (+44, 4byte) st.11 = 値 / 値 = st.11 (lpoke/lpeek も可)
; CounterOffset : DWORD (+48, 4byte) st.12 = 値 / 値 = st.12 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global PERF_COUNTER_DEFINITION
#field int ByteLength
#field int CounterNameTitleIndex
#field intptr CounterNameTitle
#field int CounterHelpTitleIndex
#field intptr CounterHelpTitle
#field int DefaultScale
#field int DetailLevel
#field int CounterType
#field int CounterSize
#field int CounterOffset
#endstruct
stdim st, PERF_COUNTER_DEFINITION ; NSTRUCT 変数を確保
st->ByteLength = 100
mes "ByteLength=" + st->ByteLength