home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 40 / IOPROG_40.ISO / SOFT / NETFrameworkSDK.exe / comsdk.cab / gchost.idl < prev    next >
Encoding:
Text File  |  2000-06-23  |  3.8 KB  |  100 lines

  1. /* -------------------------------------------------------------------------- *
  2.  * COM+ Runtime Profiling interfaces
  3.  * (C) 2000 Microsoft, All rights reserved
  4.  *
  5.  * The IGCHost allows a host environment to get statistics about the
  6.  * garbage collector as well as to gain some limited control over collections.
  7.  * This interface can be QueryInterface'd for on from the CorHost object.
  8.  * -------------------------------------------------------------------------- */
  9.  
  10. import "unknwn.idl";
  11.  
  12. cpp_quote("#ifndef _BASETSD_H_")
  13. #include "basetsd.h"
  14. cpp_quote("#endif // _BASETSD_H_")
  15.  
  16.  
  17. typedef enum
  18. {
  19.     COR_GC_COUNTS                 = 0x00000001,         // Fill out count values.
  20.     COR_GC_MEMORYUSAGE            = 0x00000002,         // Fill out memory usage values.
  21. } COR_GC_STAT_TYPES;
  22.  
  23.  
  24. /*
  25.  * This structure is used to return statics for the GC system.  Set the Flags
  26.  * value to a bitmask of values that should be returned.  Only those values which
  27.  * are requested are calculated and returned to the caller.
  28.  */
  29. typedef struct _COR_GC_STATS
  30. {
  31.     ULONG       Flags;                                  // What values to get.
  32.  
  33.     // Value when COR_GC_COUNTS is specified.
  34.     SIZE_T       ExplicitGCCount;                        // How many times was GC forced to run by external request.
  35.     SIZE_T       GenCollectionsTaken[3];                    // Number of collections done for each generation
  36.  
  37.     // Memory sizes, valid for COR_GC_MEMORYUSAGE.
  38.     SIZE_T       CommittedKBytes;                        // Total committed bytes from all heaps.    
  39.     SIZE_T       ReservedKBytes;                         // Total reserved bytes from all heaps.    
  40.     SIZE_T       Gen0HeapSizeKBytes;                     // Size of gen 0 heap.
  41.     SIZE_T       Gen1HeapSizeKBytes;                     // Size of gen 1 heap.
  42.     SIZE_T       Gen2HeapSizeKBytes;                     // Size of gen 2 heap.
  43.     SIZE_T       LargeObjectHeapSizeKBytes;              // Size of large object heap.
  44.     SIZE_T       KBytesPromotedFromGen0;                 // How many bytes promoted to next generation.
  45.     SIZE_T       KBytesPromotedFromGen1;
  46.  
  47. } COR_GC_STATS;
  48.  
  49. /*
  50.  * This structure is used to return per-thread statistics related to GC.
  51.  */
  52. typedef struct _COR_GC_THREAD_STATS
  53. {
  54.     ULONGLONG   PerThreadAllocation;                    // Amount of memory allocated on this
  55.                                                         // thread.  Cleared to 0 on each Gen 0 collection.
  56. } COR_GC_THREAD_STATS;
  57.  
  58.  
  59.  
  60. /*
  61.  * This interface is used to get information about the GC system and
  62.  * control some aspects of the GC.  This interface is for expert usage
  63.  * only, and can severely impact the performance of an application if
  64.  * used improperly!!
  65.  */
  66. [
  67.     object,
  68.     uuid(FAC34F6E-0DCD-47b5-8021-531BC5ECCA63),
  69.     pointer_default(unique),
  70.     local
  71. ]
  72. interface IGCHost : IUnknown
  73. {
  74.     /*
  75.      * Sets the segment size and gen 0 maximum size.  This value may only be
  76.      * specified once and will not change if called later.
  77.      */
  78.     HRESULT SetGCStatupLimits([in] DWORD SegmentSize, [in] DWORD MaxGen0Size);
  79.     
  80.     /*
  81.      * Forces a collection to occur for the given generation, regardless of
  82.      * current GC statistics.  A value of -1 means collect all generations.
  83.      */
  84.     HRESULT Collect([in] DWORD Generation);
  85.     
  86.     /*
  87.      * Returns a set of current statistics about the state of the GC system.
  88.      * These values can then be used by a smart allocation system to help the
  89.      * GC run, by say adding more memory or forcing a collection.
  90.      */
  91.     HRESULT GetStats([in][out] COR_GC_STATS *pStats);
  92.     
  93.     /*
  94.      * This method returns the per-thread statics gathered by the GC. 
  95.      */
  96.     HRESULT GetThreadStats([in] DWORD *pFiberCookie, [in][out] COR_GC_THREAD_STATS *pStats);
  97. }
  98.  
  99.  
  100.