ホーム › System.Power › PPM_PERFSTATE_EVENT
PPM_PERFSTATE_EVENT
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| State | DWORD | 4 | +0 | +0 | 遷移先のパフォーマンス状態のインデックス。 |
| Status | DWORD | 4 | +4 | +4 | 遷移後のハードウェア状態値。 |
| Latency | DWORD | 4 | +8 | +8 | 状態遷移に要した遅延時間。 |
| Speed | DWORD | 4 | +12 | +12 | 遷移後のプロセッサ速度。MHz単位で表す。 |
| Processor | DWORD | 4 | +16 | +16 | このイベントが発生したプロセッサ番号。 |
各言語での定義
#include <windows.h>
// PPM_PERFSTATE_EVENT (x64 20 / x86 20 バイト)
typedef struct PPM_PERFSTATE_EVENT {
DWORD State;
DWORD Status;
DWORD Latency;
DWORD Speed;
DWORD Processor;
} PPM_PERFSTATE_EVENT;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct PPM_PERFSTATE_EVENT
{
public uint State;
public uint Status;
public uint Latency;
public uint Speed;
public uint Processor;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure PPM_PERFSTATE_EVENT
Public State As UInteger
Public Status As UInteger
Public Latency As UInteger
Public Speed As UInteger
Public Processor As UInteger
End Structureimport ctypes
from ctypes import wintypes
class PPM_PERFSTATE_EVENT(ctypes.Structure):
_fields_ = [
("State", wintypes.DWORD),
("Status", wintypes.DWORD),
("Latency", wintypes.DWORD),
("Speed", wintypes.DWORD),
("Processor", wintypes.DWORD),
]#[repr(C)]
pub struct PPM_PERFSTATE_EVENT {
pub State: u32,
pub Status: u32,
pub Latency: u32,
pub Speed: u32,
pub Processor: u32,
}import "golang.org/x/sys/windows"
type PPM_PERFSTATE_EVENT struct {
State uint32
Status uint32
Latency uint32
Speed uint32
Processor uint32
}type
PPM_PERFSTATE_EVENT = record
State: DWORD;
Status: DWORD;
Latency: DWORD;
Speed: DWORD;
Processor: DWORD;
end;const PPM_PERFSTATE_EVENT = extern struct {
State: u32,
Status: u32,
Latency: u32,
Speed: u32,
Processor: u32,
};type
PPM_PERFSTATE_EVENT {.bycopy.} = object
State: uint32
Status: uint32
Latency: uint32
Speed: uint32
Processor: uint32struct PPM_PERFSTATE_EVENT
{
uint State;
uint Status;
uint Latency;
uint Speed;
uint Processor;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; PPM_PERFSTATE_EVENT サイズ: 20 バイト(x64)
dim st, 5 ; 4byte整数×5(構造体サイズ 20 / 4 切り上げ)
; State : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; Status : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; Latency : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; Speed : DWORD (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; Processor : DWORD (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global PPM_PERFSTATE_EVENT
#field int State
#field int Status
#field int Latency
#field int Speed
#field int Processor
#endstruct
stdim st, PPM_PERFSTATE_EVENT ; NSTRUCT 変数を確保
st->State = 100
mes "State=" + st->State