ホーム › System.ClrHosting › COR_GC_STATS
COR_GC_STATS
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| Flags | DWORD | 4 | +0 | +0 | 取得する統計項目を指定するフラグ。 |
| ExplicitGCCount | UINT_PTR | 8/4 | +8 | +4 | 明示的に呼び出されたGCの回数。 |
| GenCollectionsTaken | UINT_PTR | 24/12 | +16 | +8 | 各世代のコレクション実行回数。 |
| CommittedKBytes | UINT_PTR | 8/4 | +40 | +20 | コミット済みヒープサイズ(KB)。 |
| ReservedKBytes | UINT_PTR | 8/4 | +48 | +24 | 予約済みヒープサイズ(KB)。 |
| Gen0HeapSizeKBytes | UINT_PTR | 8/4 | +56 | +28 | 第0世代ヒープのサイズ(KB)。 |
| Gen1HeapSizeKBytes | UINT_PTR | 8/4 | +64 | +32 | 第1世代ヒープのサイズ(KB)。 |
| Gen2HeapSizeKBytes | UINT_PTR | 8/4 | +72 | +36 | 第2世代ヒープのサイズ(KB)。 |
| LargeObjectHeapSizeKBytes | UINT_PTR | 8/4 | +80 | +40 | ラージオブジェクトヒープのサイズ(KB)。 |
| KBytesPromotedFromGen0 | UINT_PTR | 8/4 | +88 | +44 | 第0世代から昇格したバイト数(KB)。 |
| KBytesPromotedFromGen1 | UINT_PTR | 8/4 | +96 | +48 | 第1世代から昇格したバイト数(KB)。 |
各言語での定義
#include <windows.h>
// COR_GC_STATS (x64 104 / x86 52 バイト)
typedef struct COR_GC_STATS {
DWORD Flags;
UINT_PTR ExplicitGCCount;
UINT_PTR GenCollectionsTaken[3];
UINT_PTR CommittedKBytes;
UINT_PTR ReservedKBytes;
UINT_PTR Gen0HeapSizeKBytes;
UINT_PTR Gen1HeapSizeKBytes;
UINT_PTR Gen2HeapSizeKBytes;
UINT_PTR LargeObjectHeapSizeKBytes;
UINT_PTR KBytesPromotedFromGen0;
UINT_PTR KBytesPromotedFromGen1;
} COR_GC_STATS;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct COR_GC_STATS
{
public uint Flags;
public UIntPtr ExplicitGCCount;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public UIntPtr[] GenCollectionsTaken;
public UIntPtr CommittedKBytes;
public UIntPtr ReservedKBytes;
public UIntPtr Gen0HeapSizeKBytes;
public UIntPtr Gen1HeapSizeKBytes;
public UIntPtr Gen2HeapSizeKBytes;
public UIntPtr LargeObjectHeapSizeKBytes;
public UIntPtr KBytesPromotedFromGen0;
public UIntPtr KBytesPromotedFromGen1;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure COR_GC_STATS
Public Flags As UInteger
Public ExplicitGCCount As UIntPtr
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=3)> Public GenCollectionsTaken() As UIntPtr
Public CommittedKBytes As UIntPtr
Public ReservedKBytes As UIntPtr
Public Gen0HeapSizeKBytes As UIntPtr
Public Gen1HeapSizeKBytes As UIntPtr
Public Gen2HeapSizeKBytes As UIntPtr
Public LargeObjectHeapSizeKBytes As UIntPtr
Public KBytesPromotedFromGen0 As UIntPtr
Public KBytesPromotedFromGen1 As UIntPtr
End Structureimport ctypes
from ctypes import wintypes
class COR_GC_STATS(ctypes.Structure):
_fields_ = [
("Flags", wintypes.DWORD),
("ExplicitGCCount", ctypes.c_size_t),
("GenCollectionsTaken", ctypes.c_size_t * 3),
("CommittedKBytes", ctypes.c_size_t),
("ReservedKBytes", ctypes.c_size_t),
("Gen0HeapSizeKBytes", ctypes.c_size_t),
("Gen1HeapSizeKBytes", ctypes.c_size_t),
("Gen2HeapSizeKBytes", ctypes.c_size_t),
("LargeObjectHeapSizeKBytes", ctypes.c_size_t),
("KBytesPromotedFromGen0", ctypes.c_size_t),
("KBytesPromotedFromGen1", ctypes.c_size_t),
]#[repr(C)]
pub struct COR_GC_STATS {
pub Flags: u32,
pub ExplicitGCCount: usize,
pub GenCollectionsTaken: [usize; 3],
pub CommittedKBytes: usize,
pub ReservedKBytes: usize,
pub Gen0HeapSizeKBytes: usize,
pub Gen1HeapSizeKBytes: usize,
pub Gen2HeapSizeKBytes: usize,
pub LargeObjectHeapSizeKBytes: usize,
pub KBytesPromotedFromGen0: usize,
pub KBytesPromotedFromGen1: usize,
}import "golang.org/x/sys/windows"
type COR_GC_STATS struct {
Flags uint32
ExplicitGCCount uintptr
GenCollectionsTaken [3]uintptr
CommittedKBytes uintptr
ReservedKBytes uintptr
Gen0HeapSizeKBytes uintptr
Gen1HeapSizeKBytes uintptr
Gen2HeapSizeKBytes uintptr
LargeObjectHeapSizeKBytes uintptr
KBytesPromotedFromGen0 uintptr
KBytesPromotedFromGen1 uintptr
}type
COR_GC_STATS = record
Flags: DWORD;
ExplicitGCCount: NativeUInt;
GenCollectionsTaken: array[0..2] of NativeUInt;
CommittedKBytes: NativeUInt;
ReservedKBytes: NativeUInt;
Gen0HeapSizeKBytes: NativeUInt;
Gen1HeapSizeKBytes: NativeUInt;
Gen2HeapSizeKBytes: NativeUInt;
LargeObjectHeapSizeKBytes: NativeUInt;
KBytesPromotedFromGen0: NativeUInt;
KBytesPromotedFromGen1: NativeUInt;
end;const COR_GC_STATS = extern struct {
Flags: u32,
ExplicitGCCount: usize,
GenCollectionsTaken: [3]usize,
CommittedKBytes: usize,
ReservedKBytes: usize,
Gen0HeapSizeKBytes: usize,
Gen1HeapSizeKBytes: usize,
Gen2HeapSizeKBytes: usize,
LargeObjectHeapSizeKBytes: usize,
KBytesPromotedFromGen0: usize,
KBytesPromotedFromGen1: usize,
};type
COR_GC_STATS {.bycopy.} = object
Flags: uint32
ExplicitGCCount: uint
GenCollectionsTaken: array[3, uint]
CommittedKBytes: uint
ReservedKBytes: uint
Gen0HeapSizeKBytes: uint
Gen1HeapSizeKBytes: uint
Gen2HeapSizeKBytes: uint
LargeObjectHeapSizeKBytes: uint
KBytesPromotedFromGen0: uint
KBytesPromotedFromGen1: uintstruct COR_GC_STATS
{
uint Flags;
size_t ExplicitGCCount;
size_t[3] GenCollectionsTaken;
size_t CommittedKBytes;
size_t ReservedKBytes;
size_t Gen0HeapSizeKBytes;
size_t Gen1HeapSizeKBytes;
size_t Gen2HeapSizeKBytes;
size_t LargeObjectHeapSizeKBytes;
size_t KBytesPromotedFromGen0;
size_t KBytesPromotedFromGen1;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; COR_GC_STATS サイズ: 52 バイト(x86)
dim st, 13 ; 4byte整数×13(構造体サイズ 52 / 4 切り上げ)
; Flags : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; ExplicitGCCount : UINT_PTR (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; GenCollectionsTaken : UINT_PTR (+8, 12byte) varptr(st)+8 を基点に操作(12byte:入れ子/配列)
; CommittedKBytes : UINT_PTR (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; ReservedKBytes : UINT_PTR (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; Gen0HeapSizeKBytes : UINT_PTR (+28, 4byte) st.7 = 値 / 値 = st.7 (lpoke/lpeek も可)
; Gen1HeapSizeKBytes : UINT_PTR (+32, 4byte) st.8 = 値 / 値 = st.8 (lpoke/lpeek も可)
; Gen2HeapSizeKBytes : UINT_PTR (+36, 4byte) st.9 = 値 / 値 = st.9 (lpoke/lpeek も可)
; LargeObjectHeapSizeKBytes : UINT_PTR (+40, 4byte) st.10 = 値 / 値 = st.10 (lpoke/lpeek も可)
; KBytesPromotedFromGen0 : UINT_PTR (+44, 4byte) st.11 = 値 / 値 = st.11 (lpoke/lpeek も可)
; KBytesPromotedFromGen1 : UINT_PTR (+48, 4byte) st.12 = 値 / 値 = st.12 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; COR_GC_STATS サイズ: 104 バイト(x64)
dim st, 26 ; 4byte整数×26(構造体サイズ 104 / 4 切り上げ)
; Flags : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; ExplicitGCCount : UINT_PTR (+8, 8byte) qpoke st,8,値 / qpeek(st,8) ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; GenCollectionsTaken : UINT_PTR (+16, 24byte) varptr(st)+16 を基点に操作(24byte:入れ子/配列)
; CommittedKBytes : UINT_PTR (+40, 8byte) qpoke st,40,値 / qpeek(st,40) ※IronHSPのみ。3.7/3.8は lpoke st,40,下位 : lpoke st,44,上位
; ReservedKBytes : UINT_PTR (+48, 8byte) qpoke st,48,値 / qpeek(st,48) ※IronHSPのみ。3.7/3.8は lpoke st,48,下位 : lpoke st,52,上位
; Gen0HeapSizeKBytes : UINT_PTR (+56, 8byte) qpoke st,56,値 / qpeek(st,56) ※IronHSPのみ。3.7/3.8は lpoke st,56,下位 : lpoke st,60,上位
; Gen1HeapSizeKBytes : UINT_PTR (+64, 8byte) qpoke st,64,値 / qpeek(st,64) ※IronHSPのみ。3.7/3.8は lpoke st,64,下位 : lpoke st,68,上位
; Gen2HeapSizeKBytes : UINT_PTR (+72, 8byte) qpoke st,72,値 / qpeek(st,72) ※IronHSPのみ。3.7/3.8は lpoke st,72,下位 : lpoke st,76,上位
; LargeObjectHeapSizeKBytes : UINT_PTR (+80, 8byte) qpoke st,80,値 / qpeek(st,80) ※IronHSPのみ。3.7/3.8は lpoke st,80,下位 : lpoke st,84,上位
; KBytesPromotedFromGen0 : UINT_PTR (+88, 8byte) qpoke st,88,値 / qpeek(st,88) ※IronHSPのみ。3.7/3.8は lpoke st,88,下位 : lpoke st,92,上位
; KBytesPromotedFromGen1 : UINT_PTR (+96, 8byte) qpoke st,96,値 / qpeek(st,96) ※IronHSPのみ。3.7/3.8は lpoke st,96,下位 : lpoke st,100,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global COR_GC_STATS
#field int Flags
#field intptr ExplicitGCCount
#field intptr GenCollectionsTaken 3
#field intptr CommittedKBytes
#field intptr ReservedKBytes
#field intptr Gen0HeapSizeKBytes
#field intptr Gen1HeapSizeKBytes
#field intptr Gen2HeapSizeKBytes
#field intptr LargeObjectHeapSizeKBytes
#field intptr KBytesPromotedFromGen0
#field intptr KBytesPromotedFromGen1
#endstruct
stdim st, COR_GC_STATS ; NSTRUCT 変数を確保
st->Flags = 100
mes "Flags=" + st->Flags