ホーム › System.Power › PPM_WMI_PERF_STATES_EX
PPM_WMI_PERF_STATES_EX
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| Count | DWORD | 4 | +0 | +0 | Stateフィールドに含まれるパフォーマンス状態の数。 |
| MaxFrequency | DWORD | 4 | +4 | +4 | プロセッサの最大周波数。MHz単位で表す。 |
| CurrentState | DWORD | 4 | +8 | +8 | 現在のパフォーマンス状態のインデックス。 |
| MaxPerfState | DWORD | 4 | +12 | +12 | 選択可能な最高パフォーマンス状態のインデックス。 |
| MinPerfState | DWORD | 4 | +16 | +16 | 選択可能な最低パフォーマンス状態のインデックス。 |
| LowestPerfState | DWORD | 4 | +20 | +20 | ハードウェアがサポートする最低状態のインデックス。 |
| ThermalConstraint | DWORD | 4 | +24 | +24 | 温度制約による性能上限。パーセントで表す。 |
| BusyAdjThreshold | BYTE | 1 | +28 | +28 | ビジー率調整のしきい値。パーセントで表す。 |
| PolicyType | BYTE | 1 | +29 | +29 | 適用されるパフォーマンスポリシーの種別。 |
| Type | BYTE | 1 | +30 | +30 | パフォーマンス状態セットの種別を示す値。 |
| Reserved | BYTE | 1 | +31 | +31 | 将来の拡張用に予約された領域。 |
| TimerInterval | DWORD | 4 | +32 | +32 | 性能状態評価のタイマー間隔。 |
| TargetProcessors | void* | 8/4 | +40 | +36 | この設定が適用される対象プロセッサを示すポインタ。 |
| PStateHandler | DWORD | 4 | +48 | +40 | Pステート(性能状態)ハンドラを示す値。 |
| PStateContext | DWORD | 4 | +52 | +44 | Pステートハンドラに渡すコンテキスト値。 |
| TStateHandler | DWORD | 4 | +56 | +48 | Tステート(スロットリング)ハンドラを示す値。 |
| TStateContext | DWORD | 4 | +60 | +52 | Tステートハンドラに渡すコンテキスト値。 |
| FeedbackHandler | DWORD | 4 | +64 | +56 | 性能フィードバックハンドラを示す値。 |
| Reserved1 | DWORD | 4 | +68 | +60 | 将来の拡張用に予約された領域。 |
| Reserved2 | ULONGLONG | 8 | +72 | +64 | 将来の拡張用に予約された領域。 |
| State | PPM_WMI_PERF_STATE | 64 | +80 | +72 | 各パフォーマンス状態の詳細を格納する可変長配列。 |
各言語での定義
#include <windows.h>
// PPM_WMI_PERF_STATE (x64 64 / x86 64 バイト)
typedef struct PPM_WMI_PERF_STATE {
DWORD Frequency;
DWORD Power;
BYTE PercentFrequency;
BYTE IncreaseLevel;
BYTE DecreaseLevel;
BYTE Type;
DWORD IncreaseTime;
DWORD DecreaseTime;
ULONGLONG Control;
ULONGLONG Status;
DWORD HitCount;
DWORD Reserved1;
ULONGLONG Reserved2;
ULONGLONG Reserved3;
} PPM_WMI_PERF_STATE;
// PPM_WMI_PERF_STATES_EX (x64 144 / x86 136 バイト)
typedef struct PPM_WMI_PERF_STATES_EX {
DWORD Count;
DWORD MaxFrequency;
DWORD CurrentState;
DWORD MaxPerfState;
DWORD MinPerfState;
DWORD LowestPerfState;
DWORD ThermalConstraint;
BYTE BusyAdjThreshold;
BYTE PolicyType;
BYTE Type;
BYTE Reserved;
DWORD TimerInterval;
void* TargetProcessors;
DWORD PStateHandler;
DWORD PStateContext;
DWORD TStateHandler;
DWORD TStateContext;
DWORD FeedbackHandler;
DWORD Reserved1;
ULONGLONG Reserved2;
PPM_WMI_PERF_STATE State[1];
} PPM_WMI_PERF_STATES_EX;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct PPM_WMI_PERF_STATE
{
public uint Frequency;
public uint Power;
public byte PercentFrequency;
public byte IncreaseLevel;
public byte DecreaseLevel;
public byte Type;
public uint IncreaseTime;
public uint DecreaseTime;
public ulong Control;
public ulong Status;
public uint HitCount;
public uint Reserved1;
public ulong Reserved2;
public ulong Reserved3;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct PPM_WMI_PERF_STATES_EX
{
public uint Count;
public uint MaxFrequency;
public uint CurrentState;
public uint MaxPerfState;
public uint MinPerfState;
public uint LowestPerfState;
public uint ThermalConstraint;
public byte BusyAdjThreshold;
public byte PolicyType;
public byte Type;
public byte Reserved;
public uint TimerInterval;
public IntPtr TargetProcessors;
public uint PStateHandler;
public uint PStateContext;
public uint TStateHandler;
public uint TStateContext;
public uint FeedbackHandler;
public uint Reserved1;
public ulong Reserved2;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public PPM_WMI_PERF_STATE[] State;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure PPM_WMI_PERF_STATE
Public Frequency As UInteger
Public Power As UInteger
Public PercentFrequency As Byte
Public IncreaseLevel As Byte
Public DecreaseLevel As Byte
Public Type As Byte
Public IncreaseTime As UInteger
Public DecreaseTime As UInteger
Public Control As ULong
Public Status As ULong
Public HitCount As UInteger
Public Reserved1 As UInteger
Public Reserved2 As ULong
Public Reserved3 As ULong
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure PPM_WMI_PERF_STATES_EX
Public Count As UInteger
Public MaxFrequency As UInteger
Public CurrentState As UInteger
Public MaxPerfState As UInteger
Public MinPerfState As UInteger
Public LowestPerfState As UInteger
Public ThermalConstraint As UInteger
Public BusyAdjThreshold As Byte
Public PolicyType As Byte
Public Type As Byte
Public Reserved As Byte
Public TimerInterval As UInteger
Public TargetProcessors As IntPtr
Public PStateHandler As UInteger
Public PStateContext As UInteger
Public TStateHandler As UInteger
Public TStateContext As UInteger
Public FeedbackHandler As UInteger
Public Reserved1 As UInteger
Public Reserved2 As ULong
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=1)> Public State() As PPM_WMI_PERF_STATE
End Structureimport ctypes
from ctypes import wintypes
class PPM_WMI_PERF_STATE(ctypes.Structure):
_fields_ = [
("Frequency", wintypes.DWORD),
("Power", wintypes.DWORD),
("PercentFrequency", ctypes.c_ubyte),
("IncreaseLevel", ctypes.c_ubyte),
("DecreaseLevel", ctypes.c_ubyte),
("Type", ctypes.c_ubyte),
("IncreaseTime", wintypes.DWORD),
("DecreaseTime", wintypes.DWORD),
("Control", ctypes.c_ulonglong),
("Status", ctypes.c_ulonglong),
("HitCount", wintypes.DWORD),
("Reserved1", wintypes.DWORD),
("Reserved2", ctypes.c_ulonglong),
("Reserved3", ctypes.c_ulonglong),
]
class PPM_WMI_PERF_STATES_EX(ctypes.Structure):
_fields_ = [
("Count", wintypes.DWORD),
("MaxFrequency", wintypes.DWORD),
("CurrentState", wintypes.DWORD),
("MaxPerfState", wintypes.DWORD),
("MinPerfState", wintypes.DWORD),
("LowestPerfState", wintypes.DWORD),
("ThermalConstraint", wintypes.DWORD),
("BusyAdjThreshold", ctypes.c_ubyte),
("PolicyType", ctypes.c_ubyte),
("Type", ctypes.c_ubyte),
("Reserved", ctypes.c_ubyte),
("TimerInterval", wintypes.DWORD),
("TargetProcessors", ctypes.c_void_p),
("PStateHandler", wintypes.DWORD),
("PStateContext", wintypes.DWORD),
("TStateHandler", wintypes.DWORD),
("TStateContext", wintypes.DWORD),
("FeedbackHandler", wintypes.DWORD),
("Reserved1", wintypes.DWORD),
("Reserved2", ctypes.c_ulonglong),
("State", PPM_WMI_PERF_STATE * 1),
]#[repr(C)]
pub struct PPM_WMI_PERF_STATE {
pub Frequency: u32,
pub Power: u32,
pub PercentFrequency: u8,
pub IncreaseLevel: u8,
pub DecreaseLevel: u8,
pub Type: u8,
pub IncreaseTime: u32,
pub DecreaseTime: u32,
pub Control: u64,
pub Status: u64,
pub HitCount: u32,
pub Reserved1: u32,
pub Reserved2: u64,
pub Reserved3: u64,
}
#[repr(C)]
pub struct PPM_WMI_PERF_STATES_EX {
pub Count: u32,
pub MaxFrequency: u32,
pub CurrentState: u32,
pub MaxPerfState: u32,
pub MinPerfState: u32,
pub LowestPerfState: u32,
pub ThermalConstraint: u32,
pub BusyAdjThreshold: u8,
pub PolicyType: u8,
pub Type: u8,
pub Reserved: u8,
pub TimerInterval: u32,
pub TargetProcessors: *mut core::ffi::c_void,
pub PStateHandler: u32,
pub PStateContext: u32,
pub TStateHandler: u32,
pub TStateContext: u32,
pub FeedbackHandler: u32,
pub Reserved1: u32,
pub Reserved2: u64,
pub State: [PPM_WMI_PERF_STATE; 1],
}import "golang.org/x/sys/windows"
type PPM_WMI_PERF_STATE struct {
Frequency uint32
Power uint32
PercentFrequency byte
IncreaseLevel byte
DecreaseLevel byte
Type byte
IncreaseTime uint32
DecreaseTime uint32
Control uint64
Status uint64
HitCount uint32
Reserved1 uint32
Reserved2 uint64
Reserved3 uint64
}
type PPM_WMI_PERF_STATES_EX struct {
Count uint32
MaxFrequency uint32
CurrentState uint32
MaxPerfState uint32
MinPerfState uint32
LowestPerfState uint32
ThermalConstraint uint32
BusyAdjThreshold byte
PolicyType byte
Type byte
Reserved byte
TimerInterval uint32
TargetProcessors uintptr
PStateHandler uint32
PStateContext uint32
TStateHandler uint32
TStateContext uint32
FeedbackHandler uint32
Reserved1 uint32
Reserved2 uint64
State [1]PPM_WMI_PERF_STATE
}type
PPM_WMI_PERF_STATE = record
Frequency: DWORD;
Power: DWORD;
PercentFrequency: Byte;
IncreaseLevel: Byte;
DecreaseLevel: Byte;
Type: Byte;
IncreaseTime: DWORD;
DecreaseTime: DWORD;
Control: UInt64;
Status: UInt64;
HitCount: DWORD;
Reserved1: DWORD;
Reserved2: UInt64;
Reserved3: UInt64;
end;
PPM_WMI_PERF_STATES_EX = record
Count: DWORD;
MaxFrequency: DWORD;
CurrentState: DWORD;
MaxPerfState: DWORD;
MinPerfState: DWORD;
LowestPerfState: DWORD;
ThermalConstraint: DWORD;
BusyAdjThreshold: Byte;
PolicyType: Byte;
Type: Byte;
Reserved: Byte;
TimerInterval: DWORD;
TargetProcessors: Pointer;
PStateHandler: DWORD;
PStateContext: DWORD;
TStateHandler: DWORD;
TStateContext: DWORD;
FeedbackHandler: DWORD;
Reserved1: DWORD;
Reserved2: UInt64;
State: array[0..0] of PPM_WMI_PERF_STATE;
end;const PPM_WMI_PERF_STATE = extern struct {
Frequency: u32,
Power: u32,
PercentFrequency: u8,
IncreaseLevel: u8,
DecreaseLevel: u8,
Type: u8,
IncreaseTime: u32,
DecreaseTime: u32,
Control: u64,
Status: u64,
HitCount: u32,
Reserved1: u32,
Reserved2: u64,
Reserved3: u64,
};
const PPM_WMI_PERF_STATES_EX = extern struct {
Count: u32,
MaxFrequency: u32,
CurrentState: u32,
MaxPerfState: u32,
MinPerfState: u32,
LowestPerfState: u32,
ThermalConstraint: u32,
BusyAdjThreshold: u8,
PolicyType: u8,
Type: u8,
Reserved: u8,
TimerInterval: u32,
TargetProcessors: ?*anyopaque,
PStateHandler: u32,
PStateContext: u32,
TStateHandler: u32,
TStateContext: u32,
FeedbackHandler: u32,
Reserved1: u32,
Reserved2: u64,
State: [1]PPM_WMI_PERF_STATE,
};type
PPM_WMI_PERF_STATE {.bycopy.} = object
Frequency: uint32
Power: uint32
PercentFrequency: uint8
IncreaseLevel: uint8
DecreaseLevel: uint8
Type: uint8
IncreaseTime: uint32
DecreaseTime: uint32
Control: uint64
Status: uint64
HitCount: uint32
Reserved1: uint32
Reserved2: uint64
Reserved3: uint64
PPM_WMI_PERF_STATES_EX {.bycopy.} = object
Count: uint32
MaxFrequency: uint32
CurrentState: uint32
MaxPerfState: uint32
MinPerfState: uint32
LowestPerfState: uint32
ThermalConstraint: uint32
BusyAdjThreshold: uint8
PolicyType: uint8
Type: uint8
Reserved: uint8
TimerInterval: uint32
TargetProcessors: pointer
PStateHandler: uint32
PStateContext: uint32
TStateHandler: uint32
TStateContext: uint32
FeedbackHandler: uint32
Reserved1: uint32
Reserved2: uint64
State: array[1, PPM_WMI_PERF_STATE]struct PPM_WMI_PERF_STATE
{
uint Frequency;
uint Power;
ubyte PercentFrequency;
ubyte IncreaseLevel;
ubyte DecreaseLevel;
ubyte Type;
uint IncreaseTime;
uint DecreaseTime;
ulong Control;
ulong Status;
uint HitCount;
uint Reserved1;
ulong Reserved2;
ulong Reserved3;
}
struct PPM_WMI_PERF_STATES_EX
{
uint Count;
uint MaxFrequency;
uint CurrentState;
uint MaxPerfState;
uint MinPerfState;
uint LowestPerfState;
uint ThermalConstraint;
ubyte BusyAdjThreshold;
ubyte PolicyType;
ubyte Type;
ubyte Reserved;
uint TimerInterval;
void* TargetProcessors;
uint PStateHandler;
uint PStateContext;
uint TStateHandler;
uint TStateContext;
uint FeedbackHandler;
uint Reserved1;
ulong Reserved2;
PPM_WMI_PERF_STATE[1] State;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; PPM_WMI_PERF_STATES_EX サイズ: 136 バイト(x86)
dim st, 34 ; 4byte整数×34(構造体サイズ 136 / 4 切り上げ)
; Count : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; MaxFrequency : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; CurrentState : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; MaxPerfState : DWORD (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; MinPerfState : DWORD (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; LowestPerfState : DWORD (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; ThermalConstraint : DWORD (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; BusyAdjThreshold : BYTE (+28, 1byte) poke st,28,値 / 値 = peek(st,28)
; PolicyType : BYTE (+29, 1byte) poke st,29,値 / 値 = peek(st,29)
; Type : BYTE (+30, 1byte) poke st,30,値 / 値 = peek(st,30)
; Reserved : BYTE (+31, 1byte) poke st,31,値 / 値 = peek(st,31)
; TimerInterval : DWORD (+32, 4byte) st.8 = 値 / 値 = st.8 (lpoke/lpeek も可)
; TargetProcessors : void* (+36, 4byte) st.9 = 値 / 値 = st.9 (lpoke/lpeek も可)
; PStateHandler : DWORD (+40, 4byte) st.10 = 値 / 値 = st.10 (lpoke/lpeek も可)
; PStateContext : DWORD (+44, 4byte) st.11 = 値 / 値 = st.11 (lpoke/lpeek も可)
; TStateHandler : DWORD (+48, 4byte) st.12 = 値 / 値 = st.12 (lpoke/lpeek も可)
; TStateContext : DWORD (+52, 4byte) st.13 = 値 / 値 = st.13 (lpoke/lpeek も可)
; FeedbackHandler : DWORD (+56, 4byte) st.14 = 値 / 値 = st.14 (lpoke/lpeek も可)
; Reserved1 : DWORD (+60, 4byte) st.15 = 値 / 値 = st.15 (lpoke/lpeek も可)
; Reserved2 : ULONGLONG (+64, 8byte) qpoke st,64,値 / qpeek(st,64) ※IronHSPのみ。3.7/3.8は lpoke st,64,下位 : lpoke st,68,上位
; State : PPM_WMI_PERF_STATE (+72, 64byte) varptr(st)+72 を基点に操作(64byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; PPM_WMI_PERF_STATES_EX サイズ: 144 バイト(x64)
dim st, 36 ; 4byte整数×36(構造体サイズ 144 / 4 切り上げ)
; Count : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; MaxFrequency : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; CurrentState : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; MaxPerfState : DWORD (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; MinPerfState : DWORD (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; LowestPerfState : DWORD (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; ThermalConstraint : DWORD (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; BusyAdjThreshold : BYTE (+28, 1byte) poke st,28,値 / 値 = peek(st,28)
; PolicyType : BYTE (+29, 1byte) poke st,29,値 / 値 = peek(st,29)
; Type : BYTE (+30, 1byte) poke st,30,値 / 値 = peek(st,30)
; Reserved : BYTE (+31, 1byte) poke st,31,値 / 値 = peek(st,31)
; TimerInterval : DWORD (+32, 4byte) st.8 = 値 / 値 = st.8 (lpoke/lpeek も可)
; TargetProcessors : void* (+40, 8byte) qpoke st,40,値 / qpeek(st,40) ※IronHSPのみ。3.7/3.8は lpoke st,40,下位 : lpoke st,44,上位
; PStateHandler : DWORD (+48, 4byte) st.12 = 値 / 値 = st.12 (lpoke/lpeek も可)
; PStateContext : DWORD (+52, 4byte) st.13 = 値 / 値 = st.13 (lpoke/lpeek も可)
; TStateHandler : DWORD (+56, 4byte) st.14 = 値 / 値 = st.14 (lpoke/lpeek も可)
; TStateContext : DWORD (+60, 4byte) st.15 = 値 / 値 = st.15 (lpoke/lpeek も可)
; FeedbackHandler : DWORD (+64, 4byte) st.16 = 値 / 値 = st.16 (lpoke/lpeek も可)
; Reserved1 : DWORD (+68, 4byte) st.17 = 値 / 値 = st.17 (lpoke/lpeek も可)
; Reserved2 : ULONGLONG (+72, 8byte) qpoke st,72,値 / qpeek(st,72) ※IronHSPのみ。3.7/3.8は lpoke st,72,下位 : lpoke st,76,上位
; State : PPM_WMI_PERF_STATE (+80, 64byte) varptr(st)+80 を基点に操作(64byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global PPM_WMI_PERF_STATE
#field int Frequency
#field int Power
#field byte PercentFrequency
#field byte IncreaseLevel
#field byte DecreaseLevel
#field byte Type
#field int IncreaseTime
#field int DecreaseTime
#field int64 Control
#field int64 Status
#field int HitCount
#field int Reserved1
#field int64 Reserved2
#field int64 Reserved3
#endstruct
#defstruct global PPM_WMI_PERF_STATES_EX
#field int Count
#field int MaxFrequency
#field int CurrentState
#field int MaxPerfState
#field int MinPerfState
#field int LowestPerfState
#field int ThermalConstraint
#field byte BusyAdjThreshold
#field byte PolicyType
#field byte Type
#field byte Reserved
#field int TimerInterval
#field intptr TargetProcessors
#field int PStateHandler
#field int PStateContext
#field int TStateHandler
#field int TStateContext
#field int FeedbackHandler
#field int Reserved1
#field int64 Reserved2
#field PPM_WMI_PERF_STATE State 1
#endstruct
stdim st, PPM_WMI_PERF_STATES_EX ; NSTRUCT 変数を確保
st->Count = 100
mes "Count=" + st->Count