ホーム › System.Performance › PDH_COUNTER_PATH_ELEMENTS_A
PDH_COUNTER_PATH_ELEMENTS_A
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| szMachineName | LPSTR | 8/4 | +0 | +0 | マシン名(ANSI)である。ローカルはNULL可。 |
| szObjectName | LPSTR | 8/4 | +8 | +4 | パフォーマンスオブジェクト名(ANSI)である。 |
| szInstanceName | LPSTR | 8/4 | +16 | +8 | インスタンス名(ANSI)である。インスタンス無しはNULL可。 |
| szParentInstance | LPSTR | 8/4 | +24 | +12 | 親インスタンス名(ANSI)である。無ければNULL可。 |
| dwInstanceIndex | DWORD | 4 | +32 | +16 | 同名インスタンスを区別するインデックスである。 |
| szCounterName | LPSTR | 8/4 | +40 | +20 | カウンタ名(ANSI)である。 |
各言語での定義
#include <windows.h>
// PDH_COUNTER_PATH_ELEMENTS_A (x64 48 / x86 24 バイト)
typedef struct PDH_COUNTER_PATH_ELEMENTS_A {
LPSTR szMachineName;
LPSTR szObjectName;
LPSTR szInstanceName;
LPSTR szParentInstance;
DWORD dwInstanceIndex;
LPSTR szCounterName;
} PDH_COUNTER_PATH_ELEMENTS_A;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct PDH_COUNTER_PATH_ELEMENTS_A
{
public IntPtr szMachineName;
public IntPtr szObjectName;
public IntPtr szInstanceName;
public IntPtr szParentInstance;
public uint dwInstanceIndex;
public IntPtr szCounterName;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure PDH_COUNTER_PATH_ELEMENTS_A
Public szMachineName As IntPtr
Public szObjectName As IntPtr
Public szInstanceName As IntPtr
Public szParentInstance As IntPtr
Public dwInstanceIndex As UInteger
Public szCounterName As IntPtr
End Structureimport ctypes
from ctypes import wintypes
class PDH_COUNTER_PATH_ELEMENTS_A(ctypes.Structure):
_fields_ = [
("szMachineName", ctypes.c_void_p),
("szObjectName", ctypes.c_void_p),
("szInstanceName", ctypes.c_void_p),
("szParentInstance", ctypes.c_void_p),
("dwInstanceIndex", wintypes.DWORD),
("szCounterName", ctypes.c_void_p),
]#[repr(C)]
pub struct PDH_COUNTER_PATH_ELEMENTS_A {
pub szMachineName: *mut core::ffi::c_void,
pub szObjectName: *mut core::ffi::c_void,
pub szInstanceName: *mut core::ffi::c_void,
pub szParentInstance: *mut core::ffi::c_void,
pub dwInstanceIndex: u32,
pub szCounterName: *mut core::ffi::c_void,
}import "golang.org/x/sys/windows"
type PDH_COUNTER_PATH_ELEMENTS_A struct {
szMachineName uintptr
szObjectName uintptr
szInstanceName uintptr
szParentInstance uintptr
dwInstanceIndex uint32
szCounterName uintptr
}type
PDH_COUNTER_PATH_ELEMENTS_A = record
szMachineName: Pointer;
szObjectName: Pointer;
szInstanceName: Pointer;
szParentInstance: Pointer;
dwInstanceIndex: DWORD;
szCounterName: Pointer;
end;const PDH_COUNTER_PATH_ELEMENTS_A = extern struct {
szMachineName: ?*anyopaque,
szObjectName: ?*anyopaque,
szInstanceName: ?*anyopaque,
szParentInstance: ?*anyopaque,
dwInstanceIndex: u32,
szCounterName: ?*anyopaque,
};type
PDH_COUNTER_PATH_ELEMENTS_A {.bycopy.} = object
szMachineName: pointer
szObjectName: pointer
szInstanceName: pointer
szParentInstance: pointer
dwInstanceIndex: uint32
szCounterName: pointerstruct PDH_COUNTER_PATH_ELEMENTS_A
{
void* szMachineName;
void* szObjectName;
void* szInstanceName;
void* szParentInstance;
uint dwInstanceIndex;
void* szCounterName;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; PDH_COUNTER_PATH_ELEMENTS_A サイズ: 24 バイト(x86)
dim st, 6 ; 4byte整数×6(構造体サイズ 24 / 4 切り上げ)
; szMachineName : LPSTR (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; szObjectName : LPSTR (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; szInstanceName : LPSTR (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; szParentInstance : LPSTR (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; dwInstanceIndex : DWORD (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; szCounterName : LPSTR (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; PDH_COUNTER_PATH_ELEMENTS_A サイズ: 48 バイト(x64)
dim st, 12 ; 4byte整数×12(構造体サイズ 48 / 4 切り上げ)
; szMachineName : LPSTR (+0, 8byte) qpoke st,0,値 / qpeek(st,0) ※IronHSPのみ。3.7/3.8は lpoke st,0,下位 : lpoke st,4,上位
; szObjectName : LPSTR (+8, 8byte) qpoke st,8,値 / qpeek(st,8) ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; szInstanceName : LPSTR (+16, 8byte) qpoke st,16,値 / qpeek(st,16) ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; szParentInstance : LPSTR (+24, 8byte) qpoke st,24,値 / qpeek(st,24) ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; dwInstanceIndex : DWORD (+32, 4byte) st.8 = 値 / 値 = st.8 (lpoke/lpeek も可)
; szCounterName : LPSTR (+40, 8byte) qpoke st,40,値 / qpeek(st,40) ※IronHSPのみ。3.7/3.8は lpoke st,40,下位 : lpoke st,44,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global PDH_COUNTER_PATH_ELEMENTS_A
#field intptr szMachineName
#field intptr szObjectName
#field intptr szInstanceName
#field intptr szParentInstance
#field int dwInstanceIndex
#field intptr szCounterName
#endstruct
stdim st, PDH_COUNTER_PATH_ELEMENTS_A ; NSTRUCT 変数を確保
st->dwInstanceIndex = 100
mes "dwInstanceIndex=" + st->dwInstanceIndex