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.

162 lines
4.0 KiB

  1. #ifndef _PERFDATA_H_
  2. #define _PERFDATA_H_
  3. #define INITIAL_SIZE ((DWORD)0x00010000)
  4. #define EXTEND_SIZE ((DWORD)0x00008000)
  5. #define RESERVED 0L
  6. typedef LPVOID LPMEMORY;
  7. typedef HGLOBAL HMEMORY;
  8. #ifndef _NTDEF_
  9. typedef struct _UNICODE_STRING {
  10. USHORT Length;
  11. USHORT MaximumLength;
  12. PWSTR Buffer;
  13. } UNICODE_STRING, *PUNICODE_STRING;
  14. #define UNICODE_NULL ((WCHAR)0) // winnt
  15. #endif
  16. LPWSTR
  17. *BuildNameTable(
  18. LPWSTR szComputerName, // computer to query names from
  19. LPWSTR lpszLangId, // unicode value of Language subkey
  20. FILETIME *pLastUpdate, // time stamp of the last update
  21. PDWORD pdwLastItem // size of array in elements
  22. );
  23. #define FirstObject(pPerfData) \
  24. (PPERF_OBJECT_TYPE)((PBYTE)(pPerfData) + (pPerfData)->HeaderLength)
  25. #define NextObject(pObject) \
  26. (PPERF_OBJECT_TYPE)((pObject)->TotalByteLength != 0 ? (PPERF_OBJECT_TYPE)((PBYTE)(pObject) + (pObject)->TotalByteLength) : NULL)
  27. PERF_OBJECT_TYPE *
  28. GetObjectDefByTitleIndex(
  29. IN PERF_DATA_BLOCK *pDataBlock,
  30. IN DWORD ObjectTypeTitleIndex
  31. );
  32. PERF_OBJECT_TYPE *
  33. GetObjectDefByName (
  34. IN PERF_DATA_BLOCK *pDataBlock,
  35. IN DWORD dwLastNameIndex,
  36. IN LPCWSTR *NameArray,
  37. IN LPCWSTR szObjectName
  38. );
  39. #define FirstInstance(pObjectDef) \
  40. (PERF_INSTANCE_DEFINITION *)((PCHAR) pObjectDef + pObjectDef->DefinitionLength)
  41. __inline
  42. PERF_INSTANCE_DEFINITION *
  43. NextInstance(
  44. IN PERF_INSTANCE_DEFINITION *pInstDef
  45. )
  46. {
  47. PERF_COUNTER_BLOCK *pCounterBlock;
  48. pCounterBlock = (PERF_COUNTER_BLOCK *)
  49. ((PCHAR) pInstDef + pInstDef->ByteLength);
  50. return (PERF_INSTANCE_DEFINITION *)
  51. ((PCHAR) pCounterBlock + pCounterBlock->ByteLength);
  52. }
  53. PERF_INSTANCE_DEFINITION *
  54. GetInstance(
  55. IN PERF_OBJECT_TYPE *pObjectDef,
  56. IN LONG InstanceNumber
  57. );
  58. PERF_INSTANCE_DEFINITION *
  59. GetInstanceByUniqueId(
  60. IN PERF_OBJECT_TYPE *pObjectDef,
  61. IN LONG InstanceUniqueId
  62. );
  63. DWORD
  64. GetInstanceNameStr (PPERF_INSTANCE_DEFINITION pInstance,
  65. LPWSTR lpszInstance,
  66. DWORD dwCodePage);
  67. DWORD
  68. GetFullInstanceNameStr (
  69. PERF_DATA_BLOCK *pPerfData,
  70. PERF_OBJECT_TYPE *pObjectDef,
  71. PERF_INSTANCE_DEFINITION *pInstanceDef,
  72. LPWSTR szInstanceName
  73. );
  74. #define FirstCounter(pObjectDef) \
  75. (PERF_COUNTER_DEFINITION *)((PCHAR)(pObjectDef) + (pObjectDef)->HeaderLength)
  76. #define NextCounter(pCounterDef) \
  77. (PERF_COUNTER_DEFINITION *)(((pCounterDef)->ByteLength != 0) ? (PERF_COUNTER_DEFINITION *)((PCHAR)(pCounterDef) + (pCounterDef)->ByteLength) : NULL)
  78. PERF_COUNTER_DEFINITION *
  79. GetCounterDefByName (
  80. IN PERF_OBJECT_TYPE *pObject,
  81. IN DWORD dwLastNameIndex,
  82. IN LPWSTR *NameArray,
  83. IN LPWSTR szCounterName
  84. );
  85. PERF_COUNTER_DEFINITION *
  86. GetCounterDefByTitleIndex(
  87. IN PERF_OBJECT_TYPE *pObjectDef,
  88. IN BOOL bBaseCounterDef,
  89. IN DWORD CounterTitleIndex
  90. );
  91. LONG
  92. GetSystemPerfData (
  93. IN HKEY hKeySystem,
  94. IN PPERF_DATA_BLOCK *pPerfData,
  95. IN LPWSTR szObjectList,
  96. IN BOOL bCollectCostlyData
  97. );
  98. PERF_INSTANCE_DEFINITION *
  99. GetInstanceByName(
  100. PERF_DATA_BLOCK *pDataBlock,
  101. PERF_OBJECT_TYPE *pObjectDef,
  102. LPWSTR pInstanceName,
  103. LPWSTR pParentName,
  104. DWORD dwIndex
  105. );
  106. __inline
  107. PVOID
  108. GetCounterDataPtr (
  109. PERF_OBJECT_TYPE *pObjectDef,
  110. PERF_COUNTER_DEFINITION *pCounterDef
  111. )
  112. {
  113. PERF_COUNTER_BLOCK *pCtrBlock;
  114. pCtrBlock = (PERF_COUNTER_BLOCK *)((PCHAR)pObjectDef +
  115. pObjectDef->DefinitionLength);
  116. return (PVOID)((PCHAR)pCtrBlock + pCounterDef->CounterOffset);
  117. }
  118. __inline
  119. PVOID
  120. GetInstanceCounterDataPtr (
  121. PERF_OBJECT_TYPE *pObjectDef,
  122. PERF_INSTANCE_DEFINITION *pInstanceDef,
  123. PERF_COUNTER_DEFINITION *pCounterDef
  124. )
  125. {
  126. PERF_COUNTER_BLOCK *pCtrBlock;
  127. pCtrBlock = (PERF_COUNTER_BLOCK *)((PCHAR)pInstanceDef +
  128. pInstanceDef->ByteLength);
  129. return (PVOID)((PCHAR)pCtrBlock + pCounterDef->CounterOffset);
  130. }
  131. #endif //_PERFDATA_H_
  132.