Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

156 lines
4.1 KiB

  1. /*++
  2. Copyright (C) 1997-2001 Microsoft Corporation
  3. Module Name:
  4. Abstract:
  5. History:
  6. --*/
  7. //***************************************************************************
  8. //
  9. // NTPERF.H
  10. //
  11. // NT5 Perf Counter Provider
  12. //
  13. // raymcc 02-Dec-97
  14. //
  15. //***************************************************************************
  16. #ifndef _NTPERF_H_
  17. #define _NTPERF_H_
  18. #define NUM_SAMPLE_INSTANCES 10
  19. class CNt5PerfProvider;
  20. class CNt5Refresher : public IWbemRefresher
  21. {
  22. LONG m_lRef;
  23. IWbemObjectAccess *m_aInstances[NUM_SAMPLE_INSTANCES];
  24. LONG m_hName;
  25. LONG m_hCounter1;
  26. LONG m_hCounter2;
  27. LONG m_hCounter3;
  28. public:
  29. CNt5Refresher();
  30. ~CNt5Refresher();
  31. void TransferPropHandles(CNt5PerfProvider *);
  32. BOOL AddObject(IWbemObjectAccess *pObj, LONG *plId);
  33. BOOL RemoveObject(LONG lId);
  34. // Interface members.
  35. // ==================
  36. ULONG STDMETHODCALLTYPE AddRef();
  37. ULONG STDMETHODCALLTYPE Release();
  38. STDMETHODIMP QueryInterface(REFIID riid, void** ppv);
  39. virtual HRESULT STDMETHODCALLTYPE Refresh(/* [in] */ long lFlags);
  40. };
  41. class CNt5PerfProvider : public IWbemHiPerfProvider, public IWbemProviderInit
  42. {
  43. LONG m_lRef;
  44. IWbemClassObject *m_pSampleClass;
  45. IWbemObjectAccess *m_aInstances[NUM_SAMPLE_INSTANCES];
  46. LONG m_hName;
  47. LONG m_hCounter1;
  48. LONG m_hCounter2;
  49. LONG m_hCounter3;
  50. friend class CNt5Refresher;
  51. public:
  52. CNt5PerfProvider();
  53. ~CNt5PerfProvider();
  54. // Interface members.
  55. // ==================
  56. ULONG STDMETHODCALLTYPE AddRef();
  57. ULONG STDMETHODCALLTYPE Release();
  58. STDMETHODIMP QueryInterface(REFIID riid, void** ppv);
  59. // IWbemHiPerfProvider methods.
  60. // ============================
  61. virtual HRESULT STDMETHODCALLTYPE QueryInstances(
  62. /* [in] */ IWbemServices __RPC_FAR *pNamespace,
  63. /* [string][in] */ WCHAR __RPC_FAR *wszClass,
  64. /* [in] */ long lFlags,
  65. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  66. /* [in] */ IWbemObjectSink __RPC_FAR *pSink
  67. );
  68. virtual HRESULT STDMETHODCALLTYPE CreateRefresher(
  69. /* [in] */ IWbemServices __RPC_FAR *pNamespace,
  70. /* [in] */ long lFlags,
  71. /* [out] */ IWbemRefresher __RPC_FAR *__RPC_FAR *ppRefresher
  72. );
  73. virtual HRESULT STDMETHODCALLTYPE CreateRefreshableObject(
  74. /* [in] */ IWbemServices __RPC_FAR *pNamespace,
  75. /* [in] */ IWbemObjectAccess __RPC_FAR *pTemplate,
  76. /* [in] */ IWbemRefresher __RPC_FAR *pRefresher,
  77. /* [in] */ long lFlags,
  78. /* [in] */ IWbemContext __RPC_FAR *pContext,
  79. /* [out] */ IWbemObjectAccess __RPC_FAR *__RPC_FAR *ppRefreshable,
  80. /* [out] */ long __RPC_FAR *plId
  81. );
  82. virtual HRESULT STDMETHODCALLTYPE StopRefreshing(
  83. /* [in] */ IWbemRefresher __RPC_FAR *pRefresher,
  84. /* [in] */ long lId,
  85. /* [in] */ long lFlags
  86. );
  87. virtual HRESULT STDMETHODCALLTYPE CreateRefreshableEnum(
  88. /* [in] */ IWbemServices* pNamespace,
  89. /* [in, string] */ LPCWSTR wszClass,
  90. /* [in] */ IWbemRefresher* pRefresher,
  91. /* [in] */ long lFlags,
  92. /* [in] */ IWbemContext* pContext,
  93. /* [in] */ IWbemHiPerfEnum* pHiPerfEnum,
  94. /* [out] */ long* plId
  95. );
  96. virtual HRESULT STDMETHODCALLTYPE GetObjects(
  97. /* [in] */ IWbemServices* pNamespace,
  98. /* [in] */ long lNumObjects,
  99. /* [in,size_is(lNumObjects)] */ IWbemObjectAccess** apObj,
  100. /* [in] */ long lFlags,
  101. /* [in] */ IWbemContext* pContext);
  102. // IWbemProviderInit method.
  103. // =========================
  104. virtual HRESULT STDMETHODCALLTYPE Initialize(
  105. /* [unique][in] */ LPWSTR wszUser,
  106. /* [in] */ LONG lFlags,
  107. /* [in] */ LPWSTR wszNamespace,
  108. /* [unique][in] */ LPWSTR wszLocale,
  109. /* [in] */ IWbemServices __RPC_FAR *pNamespace,
  110. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  111. /* [in] */ IWbemProviderInitSink __RPC_FAR *pInitSink
  112. );
  113. };
  114. void ObjectCreated();
  115. void ObjectDestroyed();
  116. #endif