' ########################################################################################
' Microsoft Windows
' File: gchost.inc
' Copyright (c) 2011 Jos? Roca
' Portions Copyright (c) Microsoft Corporation.
' All Rights Reserved.
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
' ########################################################################################
#IF NOT %DEF(PBX_gchost_PBI)
#DEFINE PBX_gchost_PBI
%EQUATE `GCHOST_INC = 1
'/* header files for imported files */
#INCLUDE ONCE "Legacy/COM/Unknwn.inc"
' enum COR_GC_STAT_TYPES
%EQUATE `COR_GC_COUNTS = &H1
%EQUATE `COR_GC_MEMORYUSAGE = &H2
' enum COR_GC_THREAD_STATS_TYPES
%EQUATE `COR_GC_THREAD_HAS_PROMOTED_BYTES = &H1
' // Size = 52 bytes
TYPE COR_GC_STATS DWORD
 Flags AS DWORD ' ULONG
 ExplicitGCCount AS DWORD ' SIZE_T
 GenCollectionsTaken(2) AS DWORD ' SIZE_T[3]
 CommittedKBytes AS DWORD ' SIZE_T
 ReservedKBytes AS DWORD ' SIZE_T
 Gen0HeapSizeKBytes AS DWORD ' SIZE_T
 Gen1HeapSizeKBytes AS DWORD ' SIZE_T
 Gen2HeapSizeKBytes AS DWORD ' SIZE_T
 LargeObjectHeapSizeKBytes AS DWORD ' SIZE_T
 KBytesPromotedFromGen0 AS DWORD ' SIZE_T
 KBytesPromotedFromGen1 AS DWORD ' SIZE_T
END TYPE
' // Size = 16 bytes
TYPE COR_GC_THREAD_STATS QWORD
 PerThreadAllocation AS QUAD ' ULONGLONG
 Flags AS DWORD ' ULONG
END TYPE
' ########################################################################################
' Interface name = IGCHost
' IID = {FAC34F6E-0DCD-47B5-8021-531BC5ECCA63}
' Inherited interface = IUnknown
' Provides methods for obtaining information about the garbage collection system and for
' controlling some aspects of garbage collection.
' NOTE: This interface is for expert usage only. It can affect the performance of an
' application if used improperly
' ########################################################################################
#IF NOT %DEF(%IGCHost_INTERFACE_DEFINED)
 %IGCHost_INTERFACE_DEFINED = 1
$IID_IGCHost = GUID$("{FAC34F6E-0DCD-47B5-8021-531BC5ECCA63}")
INTERFACE IGCHost $IID_IGCHost
 INHERIT IUnknown
 ' =====================================================================================
 METHOD SetGCStartupLimits ( ' VTable offset = 12
 BYVAL SegmentSize AS DWORD
 , BYVAL MaxGen0Size AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD Collect ( ' VTable offset = 16
 BYVAL Generation AS LONG
 ) AS LONG
 ' =====================================================================================
 METHOD GetStats ( ' VTable offset = 20
 BYREF pStats AS COR_GC_STATS
 ) AS LONG
 ' =====================================================================================
 METHOD GetThreadStats ( ' VTable offset = 24
 BYREF pFiberCookie AS DWORD
 , BYREF pStats AS COR_GC_THREAD_STATS
 ) AS LONG
 ' =====================================================================================
 METHOD SetVirtualMemLimit ( ' VTable offset = 28
 BYVAL sztMaxVirtualMemMB AS DWORD
 ) AS LONG
 ' =====================================================================================
END INTERFACE
#ENDIF ' /* __IGCHost_INTERFACE_DEFINED__ */
#ENDIF
