ホーム › System.Performance › PERF_COUNTER_INFO
PERF_COUNTER_INFO
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| CounterId | DWORD | 4 | +0 | +0 | カウンタセット内のカウンタ識別子である。 |
| Type | DWORD | 4 | +4 | +4 | カウンタの種類(PERF_COUNTER_系)を示す。 |
| Attrib | ULONGLONG | 8 | +8 | +8 | カウンタの属性を示すビットフラグ(PERF_ATTRIB値)である。 |
| Size | DWORD | 4 | +16 | +16 | カウンタデータのバイトサイズである。 |
| DetailLevel | DWORD | 4 | +20 | +20 | このカウンタの詳細レベル(PERF_DETAIL値)である。 |
| Scale | INT | 4 | +24 | +24 | カウンタ値表示のスケール(10のべき乗指数)である。 |
| Offset | DWORD | 4 | +28 | +28 | カウンタデータブロック内のこのカウンタへのオフセットである。 |
各言語での定義
#include <windows.h>
// PERF_COUNTER_INFO (x64 32 / x86 32 バイト)
typedef struct PERF_COUNTER_INFO {
DWORD CounterId;
DWORD Type;
ULONGLONG Attrib;
DWORD Size;
DWORD DetailLevel;
INT Scale;
DWORD Offset;
} PERF_COUNTER_INFO;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct PERF_COUNTER_INFO
{
public uint CounterId;
public uint Type;
public ulong Attrib;
public uint Size;
public uint DetailLevel;
public int Scale;
public uint Offset;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure PERF_COUNTER_INFO
Public CounterId As UInteger
Public Type As UInteger
Public Attrib As ULong
Public Size As UInteger
Public DetailLevel As UInteger
Public Scale As Integer
Public Offset As UInteger
End Structureimport ctypes
from ctypes import wintypes
class PERF_COUNTER_INFO(ctypes.Structure):
_fields_ = [
("CounterId", wintypes.DWORD),
("Type", wintypes.DWORD),
("Attrib", ctypes.c_ulonglong),
("Size", wintypes.DWORD),
("DetailLevel", wintypes.DWORD),
("Scale", ctypes.c_int),
("Offset", wintypes.DWORD),
]#[repr(C)]
pub struct PERF_COUNTER_INFO {
pub CounterId: u32,
pub Type: u32,
pub Attrib: u64,
pub Size: u32,
pub DetailLevel: u32,
pub Scale: i32,
pub Offset: u32,
}import "golang.org/x/sys/windows"
type PERF_COUNTER_INFO struct {
CounterId uint32
Type uint32
Attrib uint64
Size uint32
DetailLevel uint32
Scale int32
Offset uint32
}type
PERF_COUNTER_INFO = record
CounterId: DWORD;
Type: DWORD;
Attrib: UInt64;
Size: DWORD;
DetailLevel: DWORD;
Scale: Integer;
Offset: DWORD;
end;const PERF_COUNTER_INFO = extern struct {
CounterId: u32,
Type: u32,
Attrib: u64,
Size: u32,
DetailLevel: u32,
Scale: i32,
Offset: u32,
};type
PERF_COUNTER_INFO {.bycopy.} = object
CounterId: uint32
Type: uint32
Attrib: uint64
Size: uint32
DetailLevel: uint32
Scale: int32
Offset: uint32struct PERF_COUNTER_INFO
{
uint CounterId;
uint Type;
ulong Attrib;
uint Size;
uint DetailLevel;
int Scale;
uint Offset;
}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_INFO サイズ: 32 バイト(x64)
dim st, 8 ; 4byte整数×8(構造体サイズ 32 / 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,上位
; Size : DWORD (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; DetailLevel : DWORD (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; Scale : INT (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; Offset : DWORD (+28, 4byte) st.7 = 値 / 値 = st.7 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global PERF_COUNTER_INFO
#field int CounterId
#field int Type
#field int64 Attrib
#field int Size
#field int DetailLevel
#field int Scale
#field int Offset
#endstruct
stdim st, PERF_COUNTER_INFO ; NSTRUCT 変数を確保
st->CounterId = 100
mes "CounterId=" + st->CounterId