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

COMPOSITION_TARGET_STATS

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

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

フィールド

フィールドサイズx64x86説明
outstandingPresentsDWORD4+0+0まだ表示完了していない保留中プレゼントの件数を示す。
presentTimeULONGLONG8+8+8プレゼントが行われた時刻をQPCティックで示す。
vblankDurationULONGLONG8+16+16垂直帰線期間の長さをQPCティックで示す。
presentedStatsCOMPOSITION_STATS24+24+24プレゼント済みフレームに関する統計(COMPOSITION_STATS)。
completedStatsCOMPOSITION_STATS24+48+48表示完了フレームに関する統計(COMPOSITION_STATS)。

各言語での定義

#include <windows.h>

// COMPOSITION_STATS  (x64 24 / x86 24 バイト)
typedef struct COMPOSITION_STATS {
    DWORD presentCount;
    DWORD refreshCount;
    DWORD virtualRefreshCount;
    ULONGLONG time;
} COMPOSITION_STATS;

// COMPOSITION_TARGET_STATS  (x64 72 / x86 72 バイト)
typedef struct COMPOSITION_TARGET_STATS {
    DWORD outstandingPresents;
    ULONGLONG presentTime;
    ULONGLONG vblankDuration;
    COMPOSITION_STATS presentedStats;
    COMPOSITION_STATS completedStats;
} COMPOSITION_TARGET_STATS;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct COMPOSITION_STATS
{
    public uint presentCount;
    public uint refreshCount;
    public uint virtualRefreshCount;
    public ulong time;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct COMPOSITION_TARGET_STATS
{
    public uint outstandingPresents;
    public ulong presentTime;
    public ulong vblankDuration;
    public COMPOSITION_STATS presentedStats;
    public COMPOSITION_STATS completedStats;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure COMPOSITION_STATS
    Public presentCount As UInteger
    Public refreshCount As UInteger
    Public virtualRefreshCount As UInteger
    Public time As ULong
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure COMPOSITION_TARGET_STATS
    Public outstandingPresents As UInteger
    Public presentTime As ULong
    Public vblankDuration As ULong
    Public presentedStats As COMPOSITION_STATS
    Public completedStats As COMPOSITION_STATS
End Structure
import ctypes
from ctypes import wintypes

class COMPOSITION_STATS(ctypes.Structure):
    _fields_ = [
        ("presentCount", wintypes.DWORD),
        ("refreshCount", wintypes.DWORD),
        ("virtualRefreshCount", wintypes.DWORD),
        ("time", ctypes.c_ulonglong),
    ]

class COMPOSITION_TARGET_STATS(ctypes.Structure):
    _fields_ = [
        ("outstandingPresents", wintypes.DWORD),
        ("presentTime", ctypes.c_ulonglong),
        ("vblankDuration", ctypes.c_ulonglong),
        ("presentedStats", COMPOSITION_STATS),
        ("completedStats", COMPOSITION_STATS),
    ]
#[repr(C)]
pub struct COMPOSITION_STATS {
    pub presentCount: u32,
    pub refreshCount: u32,
    pub virtualRefreshCount: u32,
    pub time: u64,
}

#[repr(C)]
pub struct COMPOSITION_TARGET_STATS {
    pub outstandingPresents: u32,
    pub presentTime: u64,
    pub vblankDuration: u64,
    pub presentedStats: COMPOSITION_STATS,
    pub completedStats: COMPOSITION_STATS,
}
import "golang.org/x/sys/windows"

type COMPOSITION_STATS struct {
	presentCount uint32
	refreshCount uint32
	virtualRefreshCount uint32
	time uint64
}

type COMPOSITION_TARGET_STATS struct {
	outstandingPresents uint32
	presentTime uint64
	vblankDuration uint64
	presentedStats COMPOSITION_STATS
	completedStats COMPOSITION_STATS
}
type
  COMPOSITION_STATS = record
    presentCount: DWORD;
    refreshCount: DWORD;
    virtualRefreshCount: DWORD;
    time: UInt64;
  end;

  COMPOSITION_TARGET_STATS = record
    outstandingPresents: DWORD;
    presentTime: UInt64;
    vblankDuration: UInt64;
    presentedStats: COMPOSITION_STATS;
    completedStats: COMPOSITION_STATS;
  end;
const COMPOSITION_STATS = extern struct {
    presentCount: u32,
    refreshCount: u32,
    virtualRefreshCount: u32,
    time: u64,
};

const COMPOSITION_TARGET_STATS = extern struct {
    outstandingPresents: u32,
    presentTime: u64,
    vblankDuration: u64,
    presentedStats: COMPOSITION_STATS,
    completedStats: COMPOSITION_STATS,
};
type
  COMPOSITION_STATS {.bycopy.} = object
    presentCount: uint32
    refreshCount: uint32
    virtualRefreshCount: uint32
    time: uint64

  COMPOSITION_TARGET_STATS {.bycopy.} = object
    outstandingPresents: uint32
    presentTime: uint64
    vblankDuration: uint64
    presentedStats: COMPOSITION_STATS
    completedStats: COMPOSITION_STATS
struct COMPOSITION_STATS
{
    uint presentCount;
    uint refreshCount;
    uint virtualRefreshCount;
    ulong time;
}

struct COMPOSITION_TARGET_STATS
{
    uint outstandingPresents;
    ulong presentTime;
    ulong vblankDuration;
    COMPOSITION_STATS presentedStats;
    COMPOSITION_STATS completedStats;
}

HSP用 定義

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

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

#defstruct global COMPOSITION_TARGET_STATS
    #field int outstandingPresents
    #field int64 presentTime
    #field int64 vblankDuration
    #field COMPOSITION_STATS presentedStats
    #field COMPOSITION_STATS completedStats
#endstruct

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