ホーム › System.Performance › PERF_DATA_HEADER
PERF_DATA_HEADER
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| dwTotalSize | DWORD | 4 | +0 | +0 | この問い合わせ結果データ全体のバイトサイズである。 |
| dwNumCounters | DWORD | 4 | +4 | +4 | 結果に含まれるカウンタの個数である。 |
| PerfTimeStamp | LONGLONG | 8 | +8 | +8 | データ収集時のパフォーマンスタイムスタンプである。 |
| PerfTime100NSec | LONGLONG | 8 | +16 | +16 | 100ナノ秒単位のシステム時刻である。 |
| PerfFreq | LONGLONG | 8 | +24 | +24 | パフォーマンスカウンタの周波数である。 |
| SystemTime | SYSTEMTIME | 16 | +32 | +32 | データ収集時のシステム時刻を表すSYSTEMTIMEである。 |
各言語での定義
#include <windows.h>
// SYSTEMTIME (x64 16 / x86 16 バイト)
typedef struct SYSTEMTIME {
WORD wYear;
WORD wMonth;
WORD wDayOfWeek;
WORD wDay;
WORD wHour;
WORD wMinute;
WORD wSecond;
WORD wMilliseconds;
} SYSTEMTIME;
// PERF_DATA_HEADER (x64 48 / x86 48 バイト)
typedef struct PERF_DATA_HEADER {
DWORD dwTotalSize;
DWORD dwNumCounters;
LONGLONG PerfTimeStamp;
LONGLONG PerfTime100NSec;
LONGLONG PerfFreq;
SYSTEMTIME SystemTime;
} PERF_DATA_HEADER;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct SYSTEMTIME
{
public ushort wYear;
public ushort wMonth;
public ushort wDayOfWeek;
public ushort wDay;
public ushort wHour;
public ushort wMinute;
public ushort wSecond;
public ushort wMilliseconds;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct PERF_DATA_HEADER
{
public uint dwTotalSize;
public uint dwNumCounters;
public long PerfTimeStamp;
public long PerfTime100NSec;
public long PerfFreq;
public SYSTEMTIME SystemTime;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure SYSTEMTIME
Public wYear As UShort
Public wMonth As UShort
Public wDayOfWeek As UShort
Public wDay As UShort
Public wHour As UShort
Public wMinute As UShort
Public wSecond As UShort
Public wMilliseconds As UShort
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure PERF_DATA_HEADER
Public dwTotalSize As UInteger
Public dwNumCounters As UInteger
Public PerfTimeStamp As Long
Public PerfTime100NSec As Long
Public PerfFreq As Long
Public SystemTime As SYSTEMTIME
End Structureimport ctypes
from ctypes import wintypes
class SYSTEMTIME(ctypes.Structure):
_fields_ = [
("wYear", ctypes.c_ushort),
("wMonth", ctypes.c_ushort),
("wDayOfWeek", ctypes.c_ushort),
("wDay", ctypes.c_ushort),
("wHour", ctypes.c_ushort),
("wMinute", ctypes.c_ushort),
("wSecond", ctypes.c_ushort),
("wMilliseconds", ctypes.c_ushort),
]
class PERF_DATA_HEADER(ctypes.Structure):
_fields_ = [
("dwTotalSize", wintypes.DWORD),
("dwNumCounters", wintypes.DWORD),
("PerfTimeStamp", ctypes.c_longlong),
("PerfTime100NSec", ctypes.c_longlong),
("PerfFreq", ctypes.c_longlong),
("SystemTime", SYSTEMTIME),
]#[repr(C)]
pub struct SYSTEMTIME {
pub wYear: u16,
pub wMonth: u16,
pub wDayOfWeek: u16,
pub wDay: u16,
pub wHour: u16,
pub wMinute: u16,
pub wSecond: u16,
pub wMilliseconds: u16,
}
#[repr(C)]
pub struct PERF_DATA_HEADER {
pub dwTotalSize: u32,
pub dwNumCounters: u32,
pub PerfTimeStamp: i64,
pub PerfTime100NSec: i64,
pub PerfFreq: i64,
pub SystemTime: SYSTEMTIME,
}import "golang.org/x/sys/windows"
type SYSTEMTIME struct {
wYear uint16
wMonth uint16
wDayOfWeek uint16
wDay uint16
wHour uint16
wMinute uint16
wSecond uint16
wMilliseconds uint16
}
type PERF_DATA_HEADER struct {
dwTotalSize uint32
dwNumCounters uint32
PerfTimeStamp int64
PerfTime100NSec int64
PerfFreq int64
SystemTime SYSTEMTIME
}type
SYSTEMTIME = record
wYear: Word;
wMonth: Word;
wDayOfWeek: Word;
wDay: Word;
wHour: Word;
wMinute: Word;
wSecond: Word;
wMilliseconds: Word;
end;
PERF_DATA_HEADER = record
dwTotalSize: DWORD;
dwNumCounters: DWORD;
PerfTimeStamp: Int64;
PerfTime100NSec: Int64;
PerfFreq: Int64;
SystemTime: SYSTEMTIME;
end;const SYSTEMTIME = extern struct {
wYear: u16,
wMonth: u16,
wDayOfWeek: u16,
wDay: u16,
wHour: u16,
wMinute: u16,
wSecond: u16,
wMilliseconds: u16,
};
const PERF_DATA_HEADER = extern struct {
dwTotalSize: u32,
dwNumCounters: u32,
PerfTimeStamp: i64,
PerfTime100NSec: i64,
PerfFreq: i64,
SystemTime: SYSTEMTIME,
};type
SYSTEMTIME {.bycopy.} = object
wYear: uint16
wMonth: uint16
wDayOfWeek: uint16
wDay: uint16
wHour: uint16
wMinute: uint16
wSecond: uint16
wMilliseconds: uint16
PERF_DATA_HEADER {.bycopy.} = object
dwTotalSize: uint32
dwNumCounters: uint32
PerfTimeStamp: int64
PerfTime100NSec: int64
PerfFreq: int64
SystemTime: SYSTEMTIMEstruct SYSTEMTIME
{
ushort wYear;
ushort wMonth;
ushort wDayOfWeek;
ushort wDay;
ushort wHour;
ushort wMinute;
ushort wSecond;
ushort wMilliseconds;
}
struct PERF_DATA_HEADER
{
uint dwTotalSize;
uint dwNumCounters;
long PerfTimeStamp;
long PerfTime100NSec;
long PerfFreq;
SYSTEMTIME SystemTime;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; PERF_DATA_HEADER サイズ: 48 バイト(x64)
dim st, 12 ; 4byte整数×12(構造体サイズ 48 / 4 切り上げ)
; dwTotalSize : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; dwNumCounters : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; PerfTimeStamp : LONGLONG (+8, 8byte) qpoke st,8,値 / qpeek(st,8) ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; PerfTime100NSec : LONGLONG (+16, 8byte) qpoke st,16,値 / qpeek(st,16) ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; PerfFreq : LONGLONG (+24, 8byte) qpoke st,24,値 / qpeek(st,24) ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; SystemTime : SYSTEMTIME (+32, 16byte) varptr(st)+32 を基点に操作(16byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global SYSTEMTIME
#field short wYear
#field short wMonth
#field short wDayOfWeek
#field short wDay
#field short wHour
#field short wMinute
#field short wSecond
#field short wMilliseconds
#endstruct
#defstruct global PERF_DATA_HEADER
#field int dwTotalSize
#field int dwNumCounters
#field int64 PerfTimeStamp
#field int64 PerfTime100NSec
#field int64 PerfFreq
#field SYSTEMTIME SystemTime
#endstruct
stdim st, PERF_DATA_HEADER ; NSTRUCT 変数を確保
st->dwTotalSize = 100
mes "dwTotalSize=" + st->dwTotalSize