ホーム › System.Performance › PDH_STATISTICS
PDH_STATISTICS
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| dwFormat | DWORD | 4 | +0 | +0 | データの形式。形式は、 PdhComputeCounterStatistics を呼び出すときに dwFormat で指定します。 |
| count | DWORD | 4 | +4 | +4 | 配列内の値の数。 |
| min | PDH_FMT_COUNTERVALUE | 16 | +8 | +8 | 値の最小値。 |
| max | PDH_FMT_COUNTERVALUE | 16 | +24 | +24 | 値の最大値。 |
| mean | PDH_FMT_COUNTERVALUE | 16 | +40 | +40 | 値の平均値。 |
公式ドキュメント
PDH_STATISTICS 構造体には、生のカウンター値の配列に対する最小値、最大値、および平均値が格納されます。
出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
各言語での定義
#include <windows.h>
// PDH_FMT_COUNTERVALUE (x64 16 / x86 16 バイト)
typedef struct PDH_FMT_COUNTERVALUE {
DWORD CStatus;
_Anonymous_e__Union Anonymous;
} PDH_FMT_COUNTERVALUE;
// PDH_STATISTICS (x64 56 / x86 56 バイト)
typedef struct PDH_STATISTICS {
DWORD dwFormat;
DWORD count;
PDH_FMT_COUNTERVALUE min;
PDH_FMT_COUNTERVALUE max;
PDH_FMT_COUNTERVALUE mean;
} PDH_STATISTICS;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct PDH_FMT_COUNTERVALUE
{
public uint CStatus;
public _Anonymous_e__Union Anonymous;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct PDH_STATISTICS
{
public uint dwFormat;
public uint count;
public PDH_FMT_COUNTERVALUE min;
public PDH_FMT_COUNTERVALUE max;
public PDH_FMT_COUNTERVALUE mean;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure PDH_FMT_COUNTERVALUE
Public CStatus As UInteger
Public Anonymous As _Anonymous_e__Union
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure PDH_STATISTICS
Public dwFormat As UInteger
Public count As UInteger
Public min As PDH_FMT_COUNTERVALUE
Public max As PDH_FMT_COUNTERVALUE
Public mean As PDH_FMT_COUNTERVALUE
End Structureimport ctypes
from ctypes import wintypes
class PDH_FMT_COUNTERVALUE(ctypes.Structure):
_fields_ = [
("CStatus", wintypes.DWORD),
("Anonymous", _Anonymous_e__Union),
]
class PDH_STATISTICS(ctypes.Structure):
_fields_ = [
("dwFormat", wintypes.DWORD),
("count", wintypes.DWORD),
("min", PDH_FMT_COUNTERVALUE),
("max", PDH_FMT_COUNTERVALUE),
("mean", PDH_FMT_COUNTERVALUE),
]#[repr(C)]
pub struct PDH_FMT_COUNTERVALUE {
pub CStatus: u32,
pub Anonymous: _Anonymous_e__Union,
}
#[repr(C)]
pub struct PDH_STATISTICS {
pub dwFormat: u32,
pub count: u32,
pub min: PDH_FMT_COUNTERVALUE,
pub max: PDH_FMT_COUNTERVALUE,
pub mean: PDH_FMT_COUNTERVALUE,
}import "golang.org/x/sys/windows"
type PDH_FMT_COUNTERVALUE struct {
CStatus uint32
Anonymous _Anonymous_e__Union
}
type PDH_STATISTICS struct {
dwFormat uint32
count uint32
min PDH_FMT_COUNTERVALUE
max PDH_FMT_COUNTERVALUE
mean PDH_FMT_COUNTERVALUE
}type
PDH_FMT_COUNTERVALUE = record
CStatus: DWORD;
Anonymous: _Anonymous_e__Union;
end;
PDH_STATISTICS = record
dwFormat: DWORD;
count: DWORD;
min: PDH_FMT_COUNTERVALUE;
max: PDH_FMT_COUNTERVALUE;
mean: PDH_FMT_COUNTERVALUE;
end;const PDH_FMT_COUNTERVALUE = extern struct {
CStatus: u32,
Anonymous: _Anonymous_e__Union,
};
const PDH_STATISTICS = extern struct {
dwFormat: u32,
count: u32,
min: PDH_FMT_COUNTERVALUE,
max: PDH_FMT_COUNTERVALUE,
mean: PDH_FMT_COUNTERVALUE,
};type
PDH_FMT_COUNTERVALUE {.bycopy.} = object
CStatus: uint32
Anonymous: _Anonymous_e__Union
PDH_STATISTICS {.bycopy.} = object
dwFormat: uint32
count: uint32
min: PDH_FMT_COUNTERVALUE
max: PDH_FMT_COUNTERVALUE
mean: PDH_FMT_COUNTERVALUEstruct PDH_FMT_COUNTERVALUE
{
uint CStatus;
_Anonymous_e__Union Anonymous;
}
struct PDH_STATISTICS
{
uint dwFormat;
uint count;
PDH_FMT_COUNTERVALUE min;
PDH_FMT_COUNTERVALUE max;
PDH_FMT_COUNTERVALUE mean;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; PDH_STATISTICS サイズ: 56 バイト(x64)
dim st, 14 ; 4byte整数×14(構造体サイズ 56 / 4 切り上げ)
; dwFormat : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; count : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; min : PDH_FMT_COUNTERVALUE (+8, 16byte) varptr(st)+8 を基点に操作(16byte:入れ子/配列)
; max : PDH_FMT_COUNTERVALUE (+24, 16byte) varptr(st)+24 を基点に操作(16byte:入れ子/配列)
; mean : PDH_FMT_COUNTERVALUE (+40, 16byte) varptr(st)+40 を基点に操作(16byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global PDH_FMT_COUNTERVALUE
#field int CStatus
#field byte Anonymous 8
#endstruct
#defstruct global PDH_STATISTICS
#field int dwFormat
#field int count
#field PDH_FMT_COUNTERVALUE min
#field PDH_FMT_COUNTERVALUE max
#field PDH_FMT_COUNTERVALUE mean
#endstruct
stdim st, PDH_STATISTICS ; NSTRUCT 変数を確保
st->dwFormat = 100
mes "dwFormat=" + st->dwFormat