Win32 API 日本語リファレンス
ホームGraphics.DirectComposition › DCOMPOSITION_FRAME_STATISTICS

DCOMPOSITION_FRAME_STATISTICS

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

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

フィールド

フィールドサイズx64x86説明
lastFrameTimeLONGLONG8+0+0直近の合成フレームが処理された時刻をQPC単位で示す。
currentCompositionRateDXGI_RATIONAL8+8+8現在の合成リフレッシュレートを分数(DXGI_RATIONAL)で表す。
currentTimeLONGLONG8+16+16統計取得時点の現在時刻をQPC単位で示す。
timeFrequencyLONGLONG8+24+24QPC値を秒に換算するための周波数(ティック毎秒)を示す。
nextEstimatedFrameTimeLONGLONG8+32+32次フレームの推定合成時刻をQPC単位で示す。

各言語での定義

#include <windows.h>

// DXGI_RATIONAL  (x64 8 / x86 8 バイト)
typedef struct DXGI_RATIONAL {
    DWORD Numerator;
    DWORD Denominator;
} DXGI_RATIONAL;

// DCOMPOSITION_FRAME_STATISTICS  (x64 40 / x86 40 バイト)
typedef struct DCOMPOSITION_FRAME_STATISTICS {
    LONGLONG lastFrameTime;
    DXGI_RATIONAL currentCompositionRate;
    LONGLONG currentTime;
    LONGLONG timeFrequency;
    LONGLONG nextEstimatedFrameTime;
} DCOMPOSITION_FRAME_STATISTICS;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DXGI_RATIONAL
{
    public uint Numerator;
    public uint Denominator;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DCOMPOSITION_FRAME_STATISTICS
{
    public long lastFrameTime;
    public DXGI_RATIONAL currentCompositionRate;
    public long currentTime;
    public long timeFrequency;
    public long nextEstimatedFrameTime;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DXGI_RATIONAL
    Public Numerator As UInteger
    Public Denominator As UInteger
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DCOMPOSITION_FRAME_STATISTICS
    Public lastFrameTime As Long
    Public currentCompositionRate As DXGI_RATIONAL
    Public currentTime As Long
    Public timeFrequency As Long
    Public nextEstimatedFrameTime As Long
End Structure
import ctypes
from ctypes import wintypes

class DXGI_RATIONAL(ctypes.Structure):
    _fields_ = [
        ("Numerator", wintypes.DWORD),
        ("Denominator", wintypes.DWORD),
    ]

class DCOMPOSITION_FRAME_STATISTICS(ctypes.Structure):
    _fields_ = [
        ("lastFrameTime", ctypes.c_longlong),
        ("currentCompositionRate", DXGI_RATIONAL),
        ("currentTime", ctypes.c_longlong),
        ("timeFrequency", ctypes.c_longlong),
        ("nextEstimatedFrameTime", ctypes.c_longlong),
    ]
#[repr(C)]
pub struct DXGI_RATIONAL {
    pub Numerator: u32,
    pub Denominator: u32,
}

#[repr(C)]
pub struct DCOMPOSITION_FRAME_STATISTICS {
    pub lastFrameTime: i64,
    pub currentCompositionRate: DXGI_RATIONAL,
    pub currentTime: i64,
    pub timeFrequency: i64,
    pub nextEstimatedFrameTime: i64,
}
import "golang.org/x/sys/windows"

type DXGI_RATIONAL struct {
	Numerator uint32
	Denominator uint32
}

type DCOMPOSITION_FRAME_STATISTICS struct {
	lastFrameTime int64
	currentCompositionRate DXGI_RATIONAL
	currentTime int64
	timeFrequency int64
	nextEstimatedFrameTime int64
}
type
  DXGI_RATIONAL = record
    Numerator: DWORD;
    Denominator: DWORD;
  end;

  DCOMPOSITION_FRAME_STATISTICS = record
    lastFrameTime: Int64;
    currentCompositionRate: DXGI_RATIONAL;
    currentTime: Int64;
    timeFrequency: Int64;
    nextEstimatedFrameTime: Int64;
  end;
const DXGI_RATIONAL = extern struct {
    Numerator: u32,
    Denominator: u32,
};

const DCOMPOSITION_FRAME_STATISTICS = extern struct {
    lastFrameTime: i64,
    currentCompositionRate: DXGI_RATIONAL,
    currentTime: i64,
    timeFrequency: i64,
    nextEstimatedFrameTime: i64,
};
type
  DXGI_RATIONAL {.bycopy.} = object
    Numerator: uint32
    Denominator: uint32

  DCOMPOSITION_FRAME_STATISTICS {.bycopy.} = object
    lastFrameTime: int64
    currentCompositionRate: DXGI_RATIONAL
    currentTime: int64
    timeFrequency: int64
    nextEstimatedFrameTime: int64
struct DXGI_RATIONAL
{
    uint Numerator;
    uint Denominator;
}

struct DCOMPOSITION_FRAME_STATISTICS
{
    long lastFrameTime;
    DXGI_RATIONAL currentCompositionRate;
    long currentTime;
    long timeFrequency;
    long nextEstimatedFrameTime;
}

HSP用 定義

HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DCOMPOSITION_FRAME_STATISTICS サイズ: 40 バイト(x64)
dim st, 10    ; 4byte整数×10(構造体サイズ 40 / 4 切り上げ)
; lastFrameTime : LONGLONG (+0, 8byte)  qpoke st,0,値 / qpeek(st,0)  ※IronHSPのみ。3.7/3.8は lpoke st,0,下位 : lpoke st,4,上位
; currentCompositionRate : DXGI_RATIONAL (+8, 8byte)  varptr(st)+8 を基点に操作(8byte:入れ子/配列)
; currentTime : LONGLONG (+16, 8byte)  qpoke st,16,値 / qpeek(st,16)  ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; timeFrequency : LONGLONG (+24, 8byte)  qpoke st,24,値 / qpeek(st,24)  ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; nextEstimatedFrameTime : LONGLONG (+32, 8byte)  qpoke st,32,値 / qpeek(st,32)  ※IronHSPのみ。3.7/3.8は lpoke st,32,下位 : lpoke st,36,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global DXGI_RATIONAL
    #field int Numerator
    #field int Denominator
#endstruct

#defstruct global DCOMPOSITION_FRAME_STATISTICS
    #field int64 lastFrameTime
    #field DXGI_RATIONAL currentCompositionRate
    #field int64 currentTime
    #field int64 timeFrequency
    #field int64 nextEstimatedFrameTime
#endstruct

stdim st, DCOMPOSITION_FRAME_STATISTICS        ; NSTRUCT 変数を確保
st->lastFrameTime = 100
mes "lastFrameTime=" + st->lastFrameTime