ホーム › System.Power › PPM_WMI_PERF_STATE
PPM_WMI_PERF_STATE
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| Frequency | DWORD | 4 | +0 | +0 | このパフォーマンス状態でのプロセッサ周波数。MHz単位。 |
| Power | DWORD | 4 | +4 | +4 | このパフォーマンス状態での消費電力。mW単位で表す。 |
| PercentFrequency | BYTE | 1 | +8 | +8 | 最大周波数に対する割合。パーセントで表す。 |
| IncreaseLevel | BYTE | 1 | +9 | +9 | 性能を上げる際に遷移する目標状態のレベル。 |
| DecreaseLevel | BYTE | 1 | +10 | +10 | 性能を下げる際に遷移する目標状態のレベル。 |
| Type | BYTE | 1 | +11 | +11 | このパフォーマンス状態の種別を示す値。 |
| IncreaseTime | DWORD | 4 | +12 | +12 | 性能を上げる遷移に要する時間。 |
| DecreaseTime | DWORD | 4 | +16 | +16 | 性能を下げる遷移に要する時間。 |
| Control | ULONGLONG | 8 | +24 | +24 | この状態を設定するためにハードウェアへ書き込む制御値。 |
| Status | ULONGLONG | 8 | +32 | +32 | この状態に到達したことを示すハードウェアの状態値。 |
| HitCount | DWORD | 4 | +40 | +40 | この状態が選択された回数のカウント。 |
| Reserved1 | DWORD | 4 | +44 | +44 | 将来の拡張用に予約された領域。 |
| Reserved2 | ULONGLONG | 8 | +48 | +48 | 将来の拡張用に予約された領域。 |
| Reserved3 | ULONGLONG | 8 | +56 | +56 | 将来の拡張用に予約された領域。 |
各言語での定義
#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;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;
}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 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),
]#[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,
}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_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;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,
};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: uint64struct 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;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; PPM_WMI_PERF_STATE サイズ: 64 バイト(x64)
dim st, 16 ; 4byte整数×16(構造体サイズ 64 / 4 切り上げ)
; Frequency : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; Power : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; PercentFrequency : BYTE (+8, 1byte) poke st,8,値 / 値 = peek(st,8)
; IncreaseLevel : BYTE (+9, 1byte) poke st,9,値 / 値 = peek(st,9)
; DecreaseLevel : BYTE (+10, 1byte) poke st,10,値 / 値 = peek(st,10)
; Type : BYTE (+11, 1byte) poke st,11,値 / 値 = peek(st,11)
; IncreaseTime : DWORD (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; DecreaseTime : DWORD (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; Control : ULONGLONG (+24, 8byte) qpoke st,24,値 / qpeek(st,24) ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; Status : ULONGLONG (+32, 8byte) qpoke st,32,値 / qpeek(st,32) ※IronHSPのみ。3.7/3.8は lpoke st,32,下位 : lpoke st,36,上位
; HitCount : DWORD (+40, 4byte) st.10 = 値 / 値 = st.10 (lpoke/lpeek も可)
; Reserved1 : DWORD (+44, 4byte) st.11 = 値 / 値 = st.11 (lpoke/lpeek も可)
; Reserved2 : ULONGLONG (+48, 8byte) qpoke st,48,値 / qpeek(st,48) ※IronHSPのみ。3.7/3.8は lpoke st,48,下位 : lpoke st,52,上位
; Reserved3 : ULONGLONG (+56, 8byte) qpoke st,56,値 / qpeek(st,56) ※IronHSPのみ。3.7/3.8は lpoke st,56,下位 : lpoke st,60,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#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
stdim st, PPM_WMI_PERF_STATE ; NSTRUCT 変数を確保
st->Frequency = 100
mes "Frequency=" + st->Frequency