ホーム › System.Performance › PDH_RAW_LOG_RECORD
PDH_RAW_LOG_RECORD
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| dwStructureSize | DWORD | 4 | +0 | +0 | このレコード構造体全体のバイトサイズである。 |
| dwRecordType | PDH_LOG_TYPE | 4 | +4 | +4 | ログレコードの種別(PDH_LOG_TYPE)である。 |
| dwItems | DWORD | 4 | +8 | +8 | レコードに含まれる項目数である。 |
| RawBytes | BYTE | 1 | +12 | +12 | ログレコードの生バイトデータ(可変長)である。 |
各言語での定義
#include <windows.h>
// PDH_RAW_LOG_RECORD (x64 16 / x86 16 バイト)
typedef struct PDH_RAW_LOG_RECORD {
DWORD dwStructureSize;
PDH_LOG_TYPE dwRecordType;
DWORD dwItems;
BYTE RawBytes[1];
} PDH_RAW_LOG_RECORD;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct PDH_RAW_LOG_RECORD
{
public uint dwStructureSize;
public uint dwRecordType;
public uint dwItems;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public byte[] RawBytes;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure PDH_RAW_LOG_RECORD
Public dwStructureSize As UInteger
Public dwRecordType As UInteger
Public dwItems As UInteger
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=1)> Public RawBytes() As Byte
End Structureimport ctypes
from ctypes import wintypes
class PDH_RAW_LOG_RECORD(ctypes.Structure):
_fields_ = [
("dwStructureSize", wintypes.DWORD),
("dwRecordType", wintypes.DWORD),
("dwItems", wintypes.DWORD),
("RawBytes", ctypes.c_ubyte * 1),
]#[repr(C)]
pub struct PDH_RAW_LOG_RECORD {
pub dwStructureSize: u32,
pub dwRecordType: u32,
pub dwItems: u32,
pub RawBytes: [u8; 1],
}import "golang.org/x/sys/windows"
type PDH_RAW_LOG_RECORD struct {
dwStructureSize uint32
dwRecordType uint32
dwItems uint32
RawBytes [1]byte
}type
PDH_RAW_LOG_RECORD = record
dwStructureSize: DWORD;
dwRecordType: DWORD;
dwItems: DWORD;
RawBytes: array[0..0] of Byte;
end;const PDH_RAW_LOG_RECORD = extern struct {
dwStructureSize: u32,
dwRecordType: u32,
dwItems: u32,
RawBytes: [1]u8,
};type
PDH_RAW_LOG_RECORD {.bycopy.} = object
dwStructureSize: uint32
dwRecordType: uint32
dwItems: uint32
RawBytes: array[1, uint8]struct PDH_RAW_LOG_RECORD
{
uint dwStructureSize;
uint dwRecordType;
uint dwItems;
ubyte[1] RawBytes;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; PDH_RAW_LOG_RECORD サイズ: 16 バイト(x64)
dim st, 4 ; 4byte整数×4(構造体サイズ 16 / 4 切り上げ)
; dwStructureSize : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; dwRecordType : PDH_LOG_TYPE (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; dwItems : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; RawBytes : BYTE (+12, 1byte) varptr(st)+12 を基点に操作(1byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global PDH_RAW_LOG_RECORD
#field int dwStructureSize
#field int dwRecordType
#field int dwItems
#field byte RawBytes 1
#endstruct
stdim st, PDH_RAW_LOG_RECORD ; NSTRUCT 変数を確保
st->dwStructureSize = 100
mes "dwStructureSize=" + st->dwStructureSize