home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 39 / IOPROG_39.ISO / SOFT / sdkjava40.exe / data1.cab / fg_Samples / Samples / Profiler / heapmon / hpmnclnt.hpp < prev    next >
Encoding:
C/C++ Source or Header  |  2000-05-04  |  5.3 KB  |  216 lines

  1. // hpmnclnt.hpp
  2. //
  3. // Created 10/04/98
  4. //
  5. // (C)Copyright 1998-1999 Microsoft Corporation, All rights reserved.
  6. //
  7.  
  8. #ifndef __HPMNCLNT_HPP__
  9. #define __HPMNCLNT_HPP__
  10.  
  11. #include "ids.hpp"
  12.  
  13.  
  14. // Masks for types of information required while the client is registered
  15.  
  16. #define HMC_INFO_HEAP_ROOTS         0x00000001
  17. #define HMC_INFO_HEAP_ROOT_REFS     0x00000002
  18. #define HMC_INFO_HEAP_OBJECTS       0x00000004
  19. #define HMC_INFO_HEAP_OBJECT_REFS   0x00000008
  20. #define HMC_INFO_COUNT_MONITORS     0x00000010
  21.  
  22. // Information that is collected via IHeapInfoCallback
  23. #define HMC_ALL_HEAPCB_INFO         (  HMC_INFO_HEAP_ROOTS          \
  24.                                      | HMC_INFO_HEAP_ROOT_REFS      \
  25.                                      | HMC_INFO_HEAP_OBJECTS        \
  26.                                      | HMC_INFO_HEAP_OBJECT_REFS    \
  27.                                      | HMC_INFO_COUNT_MONITORS)
  28.  
  29. #define HMC_ALL_INFO                (-1)
  30.  
  31.  
  32. // Masks for internal events
  33.  
  34. #define HMC_THREAD_EVENTS           0x00000001
  35. #define HMC_CLASS_EVENTS            0x00000002
  36. // Implies (HMC_INFO_HEAP_ROOTS | HMC_INFO_HEAP_ROOT_REFS)
  37. #define HMC_ROOT_EVENTS             0x00000004
  38. // Implies (HMC_INFO_HEAP_OBJECTS | HMC_INFO_HEAP_OBJECT_REFS)
  39. #define HMC_OBJECT_EVENTS           0x00000008
  40. // Implies (HMC_INFO_HEAP_ROOTS | HMC_INFO_HEAP_OBJECTS)
  41. #define HMC_HEAP_EVENTS             0x00000010
  42. #define HMC_UNMASKABLE_EVENTS       0x00000020
  43.  
  44. // Events that cannot be specified in StoppedEventMask - they may be sent at
  45. // any time
  46. #define HMC_NON_GC_EVENTS           (  HMC_THREAD_EVENTS    \
  47.                                      | HMC_CLASS_EVENTS)
  48.  
  49. #define HMC_ALL_EVENTS              (-1)
  50.  
  51.  
  52. struct HeapMonitorClientRegistrationInfo
  53. {
  54.     // Events to send at each gc
  55.     DWORD EventMask;
  56.  
  57.     // Information to collect at each gc
  58.     DWORD InfoMask;
  59.  
  60.     // Events to send when stopped
  61.     DWORD StoppedEventMask;
  62.  
  63.     // Information to collect when stopped
  64.     DWORD StoppedInfoMask;
  65. };
  66.  
  67.  
  68. struct RootReferencesEventInfo
  69. {
  70.     CONTAINER_TYPE type;
  71.     UniqueID id1;
  72.     UniqueID id2;
  73.     unsigned nrefs;
  74.     const ObjectID *rgrefs;
  75.     const DWORD *rgflags;
  76.     ID rootid;
  77. };
  78.  
  79.  
  80. #undef  INTERFACE
  81. #define INTERFACE IHeapMonitorClient
  82.  
  83. DECLARE_INTERFACE_(IHeapMonitorClient, IUnknown)
  84. {
  85.     // Events that are always sent:
  86.  
  87.     // Execution has stopped.
  88.     STDMETHOD(OnStoppedExecution)(THIS) PURE;
  89.     // Execution is about to resume.
  90.     STDMETHOD(OnResumeExecution)(THIS) PURE;
  91.  
  92.     // Main window is about to be closed.
  93.     STDMETHOD(OnClose)(THIS) PURE;
  94.  
  95.  
  96.     // Events enabled by HMC_THREAD_EVENTS:
  97.  
  98.     // A thread was created.
  99.     STDMETHOD(OnThreadCreated)(THIS_
  100.         IN THREADID thread) PURE;
  101.     // A thread is about to be destroyed.
  102.     STDMETHOD(OnDestroyThread)(THIS_
  103.         IN THREADID thread) PURE;
  104.  
  105.  
  106.     // Events enabled by HMC_CLASS_EVENTS:
  107.  
  108.     // A package was created.  (Packages are internal notions, simply for
  109.     // presentation purposes - they don't map from any VM events, and are
  110.     // never destroyed.)
  111.     STDMETHOD(OnPackageCreated)(THIS_
  112.         IN PKGID pkg) PURE;
  113.  
  114.     // A class was loaded.
  115.     STDMETHOD(OnClassLoaded)(THIS_
  116.         IN CLASSID cls) PURE;
  117.     // A class is about to be unloaded.
  118.     STDMETHOD(OnUnloadClass)(THIS_
  119.         IN CLASSID cls) PURE;
  120.  
  121.  
  122.     // Events enabled by HMC_ROOT_EVENTS:
  123.  
  124.     // Heap root discovered.  Multiple calls may be received for the same root.
  125.     STDMETHOD(RootReferences)(THIS_
  126.         IN RootReferencesEventInfo *pinfo) PURE;
  127.  
  128.  
  129.     // Events enabled by HMC_OBJECT_EVENTS:
  130.  
  131.     // An "interesting" object was discovered, or the user did something with
  132.     // this object that all clients might like to know about.
  133.     STDMETHOD(OnObjectStatusChange)(THIS_
  134.         IN OBJID id) PURE;
  135.  
  136.  
  137.     // Events enabled by HMC_HEAP_EVENTS:
  138.  
  139.     // All roots have been discovered.
  140.     STDMETHOD(RootDiscoveryComplete)(THIS) PURE;
  141.     // All objects have been discovered.
  142.     STDMETHOD(ObjectDiscoveryComplete)(THIS) PURE;
  143. };
  144.  
  145.  
  146. // For copy-and-paste convenience.
  147. #if 0
  148.     //------------------------------------------------------------------------
  149.     
  150.     // IHeapMonitorClient methods
  151.  
  152.     STDMETHODIMP OnStoppedExecution ()
  153.     {
  154.         return S_OK;
  155.     }
  156.     
  157.     STDMETHODIMP OnResumeExecution ()
  158.     {
  159.         return S_OK;
  160.     }
  161.  
  162.     STDMETHODIMP OnClose ()
  163.     {
  164.         return S_OK;
  165.     }
  166.  
  167.     STDMETHODIMP OnThreadCreated (THREADID thread)
  168.     {
  169.         return E_UNEXPECTED;
  170.     }
  171.     
  172.     STDMETHODIMP OnDestroyThread (THREADID thread)
  173.     {
  174.         return E_UNEXPECTED;
  175.     }
  176.  
  177.     STDMETHODIMP OnPackageCreated (PKGID pkg)
  178.     {
  179.         return E_UNEXPECTED;
  180.     }
  181.  
  182.     STDMETHODIMP OnClassLoaded (CLASSID cls)
  183.     {
  184.         return E_UNEXPECTED;
  185.     }
  186.     
  187.     STDMETHODIMP OnUnloadClass (CLASSID cls)
  188.     {
  189.         return E_UNEXPECTED;
  190.     }
  191.  
  192.     STDMETHODIMP RootReferences (RootReferencesEventInfo *pinfo)
  193.     {
  194.         return E_UNEXPECTED;
  195.     }
  196.  
  197.     STDMETHODIMP OnObjectStatusChange (OBJID id)
  198.     {
  199.         return E_UNEXPECTED;
  200.     }
  201.  
  202.     STDMETHODIMP RootDiscoveryComplete ()
  203.     {
  204.         return E_UNEXPECTED;
  205.     }
  206.  
  207.     STDMETHODIMP ObjectDiscoveryComplete ()
  208.     {
  209.         return E_UNEXPECTED;
  210.     }
  211. #endif
  212.     
  213.  
  214. #endif /* __HPMNCLNT_HPP__ */
  215.  
  216.