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.

189 lines
5.2 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1991 - 1992.
  5. //
  6. // File : PERFOBJ.HXX
  7. //
  8. // Contents : Performance Data Object
  9. //
  10. // Classes : CPerfMon, PPerfCounter, CPerfCount, CPerfTime
  11. //
  12. // History: 22-Mar-94 t-joshh Created
  13. //
  14. //----------------------------------------------------------------------------
  15. #pragma once
  16. #include <perfobj.hxx>
  17. //----------------------------------------------------------------------------
  18. //
  19. // Performance Data's format in Shared Memory
  20. //
  21. // --------------------------------------------------------------------------------
  22. // | | | | | | | ... | | | ....
  23. // | | | | | | | | | |
  24. // --------------------------------------------------------------------------------
  25. // \ /\ /\ /\ /\ /\ / \ /\ /
  26. // (int) (BYTES) (2INT) (int) 31*(WCHAR) (DWORD) (DWORD) (int) <-- Size
  27. // No. of Empty Seq.No No. of Name of Counter ...... Counter No. of
  28. // Instance Slot Reservd CPerfMon CPerfMon CPerfMon
  29. // Object Object Object
  30. // Attached Attached
  31. // \_________ One CPerfMon Object____________/\___ Another one
  32. //
  33. //
  34. //----------------------------------------------------------------------------
  35. //+---------------------------------------------------------------------------
  36. //
  37. // Class: CReadUserPerfData
  38. //
  39. // Purpose: Only for reading Performance Data produced in User mode
  40. //
  41. // History: 22-Mar-94 t-joshh Created
  42. //
  43. // Note: The object of the class must be declared globally.
  44. //
  45. //----------------------------------------------------------------------------
  46. class CReadUserPerfData
  47. {
  48. public :
  49. CReadUserPerfData();
  50. ~CReadUserPerfData()
  51. {
  52. Finish();
  53. }
  54. void Finish();
  55. int InitOK() { return _finitOK; }
  56. BOOL InitForRead();
  57. int NumberOfInstance();
  58. WCHAR * GetInstanceName( int iWhichOne );
  59. DWORD GetCounterValue( int iWhichInstance, int iWhichCounter );
  60. UINT GetSeqNo() const;
  61. private :
  62. void CleanupForReInit();
  63. ULONG _cMaxCats;
  64. ULONG _cbPerfHeader;
  65. XPtr<CNamedSharedMem> _xSharedMemObj;
  66. UINT * _pSeqNo;
  67. int _finitOK;
  68. UINT _cCounters;
  69. int _cInstances;
  70. #if 0
  71. SECURITY_DESCRIPTOR _sdMaxAccess;
  72. BYTE _sdExtra[SECURITY_DESCRIPTOR_MIN_LENGTH];
  73. #else
  74. //XArray<BYTE> _xsdRead;
  75. XArray<BYTE> _xsdWrite;
  76. #endif
  77. };
  78. //+---------------------------------------------------------------------------
  79. //
  80. // Class: CReadKernelPerfData
  81. //
  82. // Purpose: Only for reading Performance Data generated in Kernel mode
  83. //
  84. // History: 22-Mar-94 t-joshh Created
  85. //
  86. // Note: The object of the class must be declared globally.
  87. //
  88. //----------------------------------------------------------------------------
  89. class CReadKernelPerfData
  90. {
  91. public :
  92. CReadKernelPerfData();
  93. ~CReadKernelPerfData()
  94. {
  95. Finish();
  96. }
  97. void Finish();
  98. int InitOK() { return _finitOK; }
  99. BOOL InitForRead();
  100. int NumberOfInstance();
  101. WCHAR * GetInstanceName( int iWhichOne );
  102. int Refresh( int iWhichInstance );
  103. DWORD GetCounterValue( int iWhichCounter );
  104. UINT GetSeqNo() const;
  105. private:
  106. void FindDownlevelDrives();
  107. void CleanupForReInit();
  108. ULONG _cMaxCats;
  109. ULONG _cbPerfHeader;
  110. ULONG _cbSharedMem;
  111. XPtr<CNamedSharedMem> _xSharedMemory;
  112. XArray<BYTE> _xMemory;
  113. XArray<WCHAR *> _xCatalogs;
  114. XArray<void *> _xCatalogMem;
  115. UINT * _pSeqNo;
  116. int _cInstance;
  117. int _finitOK;
  118. UINT _cCounters;
  119. #if 0
  120. SECURITY_DESCRIPTOR _sdMaxAccess;
  121. BYTE _sdExtra[SECURITY_DESCRIPTOR_MIN_LENGTH];
  122. #else
  123. //XArray<BYTE> _xsdRead;
  124. XArray<BYTE> _xsdWrite;
  125. #endif
  126. };
  127. //+---------------------------------------------------------------------------
  128. //
  129. // Functions that are exported from query.dll to the Performance Monitor
  130. //
  131. //----------------------------------------------------------------------------
  132. extern "C"
  133. {
  134. DWORD InitializeCIPerformanceData ( LPWSTR pInstance);
  135. DWORD CollectCIPerformanceData ( LPWSTR lpValueName,
  136. LPVOID *lppData,
  137. LPDWORD lpcbTotalBytes,
  138. LPDWORD lpNumObjectTypes);
  139. DWORD DoneCIPerformanceData ();
  140. DWORD InitializeFILTERPerformanceData ( LPWSTR pInstance);
  141. DWORD CollectFILTERPerformanceData ( LPWSTR lpValueName,
  142. LPVOID *lppData,
  143. LPDWORD lpcbTotalBytes,
  144. LPDWORD lpNumObjectTypes);
  145. DWORD DoneFILTERPerformanceData ();
  146. };