Win32 API 日本語リファレンス
ホームSystem.Power › PPM_WMI_PERF_STATE

PPM_WMI_PERF_STATE

構造体
サイズx64: 64 バイト / x86: 64 バイト

サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。

フィールド

フィールドサイズx64x86説明
FrequencyDWORD4+0+0このパフォーマンス状態でのプロセッサ周波数。MHz単位。
PowerDWORD4+4+4このパフォーマンス状態での消費電力。mW単位で表す。
PercentFrequencyBYTE1+8+8最大周波数に対する割合。パーセントで表す。
IncreaseLevelBYTE1+9+9性能を上げる際に遷移する目標状態のレベル。
DecreaseLevelBYTE1+10+10性能を下げる際に遷移する目標状態のレベル。
TypeBYTE1+11+11このパフォーマンス状態の種別を示す値。
IncreaseTimeDWORD4+12+12性能を上げる遷移に要する時間。
DecreaseTimeDWORD4+16+16性能を下げる遷移に要する時間。
ControlULONGLONG8+24+24この状態を設定するためにハードウェアへ書き込む制御値。
StatusULONGLONG8+32+32この状態に到達したことを示すハードウェアの状態値。
HitCountDWORD4+40+40この状態が選択された回数のカウント。
Reserved1DWORD4+44+44将来の拡張用に予約された領域。
Reserved2ULONGLONG8+48+48将来の拡張用に予約された領域。
Reserved3ULONGLONG8+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 Structure
import 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: uint64
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;
}

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