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.

299 lines
6.9 KiB

  1. /*++
  2. Copyright (c) 1992 Microsoft Corporation
  3. Module Name:
  4. pdhp.h
  5. Abstract:
  6. PDH private APIs. Converts WMI event trace data to perf counters
  7. Author:
  8. Melur Raghuraman (mraghu) 03-Oct-1997
  9. Environment:
  10. Revision History:
  11. --*/
  12. #ifndef __TRACECTR__01042001_
  13. #define __TRACECTR__01042001_
  14. #include <wchar.h>
  15. #include <pdh.h>
  16. #ifdef __cplusplus
  17. extern "C" {
  18. #endif
  19. /*****************************************************************************\
  20. Trace Section
  21. \*****************************************************************************/
  22. #define CPDAPI __stdcall
  23. #define TRACE_LOGGER_START_IF 0x00000001
  24. #define TRACE_LOGGER_EXISTING 0x00000002
  25. #define TRACE_ZERO_ON_QUERY 0x00000004
  26. #define TRACE_REDUCE 0x00000008
  27. #define TRACE_LOG_REPLAY 0x00000010
  28. #define TRACE_DS_ONLY 0x00000020
  29. #define TRACE_SPOOLER 0x00000040
  30. #define TRACE_DUMP 0x00000080
  31. #define TRACE_USE_WBEM 0x00000100
  32. #define TRACE_EXTENDED_FMT 0x00000200
  33. #define TRACE_SUMMARY 0x00000400
  34. #define TRACE_MERGE_ETL 0x00000800
  35. #define TRACE_INTERPRET 0x00001000
  36. #define TRACE_LOG_REPORT_MEMORY 0x00000100
  37. #define TRACE_LOG_REPORT_HARDFAULT 0x00000200
  38. #define TRACE_LOG_REPORT_BASIC 0x00000400
  39. #define TRACE_LOG_REPORT_TOTALS 0x00000800
  40. #define TRACE_LOG_REPORT_FILE 0x00001000
  41. #define DEFAULT_FILE_REPORT_SIZE 50
  42. typedef enum _TRACEINFOCLASS {
  43. TraceProcessInformation,
  44. TraceFileInformation,
  45. TraceThreadInformation,
  46. TraceDiskInformation,
  47. TraceTransactionInformation,
  48. TraceModuleInformation,
  49. TraceProcessPageFaultInformation
  50. } TRACEINFOCLASS;
  51. typedef enum _MM_REPORT_TYPE
  52. {
  53. REPORT_SUMMARY_PROCESS,
  54. REPORT_SUMMARY_MODULE,
  55. REPORT_LIST_PROCESS,
  56. REPORT_LIST_MODULE
  57. } MM_REPORT_TYPE;
  58. typedef enum _MM_REPORT_SORT_KEY
  59. {
  60. REPORT_SORT_ALL,
  61. REPORT_SORT_HPF,
  62. REPORT_SORT_TF,
  63. REPORT_SORT_DZF,
  64. REPORT_SORT_COW
  65. } MM_REPORT_SORT_KEY;
  66. typedef struct _USER_CONTEXT_MM
  67. {
  68. MM_REPORT_TYPE reportNow;
  69. MM_REPORT_SORT_KEY sortNow;
  70. PWCHAR strImgName;
  71. } CPD_USER_CONTEXT_MM, * PCPD_USER_CONTEXT_MM;
  72. typedef struct _TRACE_MODULE_INFO
  73. {
  74. ULONG PID;
  75. ULONG lBaseAddress;
  76. ULONG lModuleSize;
  77. ULONG lDataFaultHF;
  78. ULONG lDataFaultTF;
  79. ULONG lDataFaultDZF;
  80. ULONG lDataFaultCOW;
  81. ULONG lCodeFaultHF;
  82. ULONG lCodeFaultTF;
  83. ULONG lCodeFaultDZF;
  84. ULONG lCodeFaultCOW;
  85. ULONG NextEntryOffset; // From the Current; Not from the top.
  86. LPWSTR strModuleName;
  87. LPWSTR strImageName;
  88. } TRACE_MODULE_INFO, * PTRACE_MODULE_INFO;
  89. typedef struct _TRACE_PROCESS_FAULT_INFO {
  90. ULONG PID;
  91. ULONG lDataFaultHF;
  92. ULONG lDataFaultTF;
  93. ULONG lDataFaultDZF;
  94. ULONG lDataFaultCOW;
  95. ULONG lCodeFaultHF;
  96. ULONG lCodeFaultTF;
  97. ULONG lCodeFaultDZF;
  98. ULONG lCodeFaultCOW;
  99. ULONG NextEntryOffset;
  100. LPWSTR ImageName;
  101. } TRACE_PROCESS_FAULT_INFO, *PTRACE_PROCESS_FAULT_INFO;
  102. typedef struct _TRACE_TRANSACTION_INFO {
  103. ULONG TransactionCount;
  104. ULONG AverageResponseTime; // in milliseconds
  105. ULONG MaxResponseTime;
  106. ULONG MinResponseTime;
  107. ULONG NextEntryOffset;
  108. LPWSTR Name;
  109. } TRACE_TRANSACTION_INFO, *PTRACE_TRANSACTION_INFO;
  110. typedef struct _TRACE_FILE_INFOW {
  111. ULONG ReadCount;
  112. ULONG WriteCount;
  113. ULONG ReadSize;
  114. ULONG WriteSize;
  115. ULONG NextEntryOffset; // From the Current; Not from the top.
  116. LPWSTR FileName; // The string immediatealy follows this structure.
  117. ULONG DiskNumber;
  118. } TRACE_FILE_INFOW, *PTRACE_FILE_INFOW;
  119. typedef struct _TRACE_PROCESS_INFOW {
  120. ULONG ReadCount;
  121. ULONG WriteCount;
  122. ULONG ReadSize;
  123. ULONG WriteSize;
  124. ULONG SendCount;
  125. ULONG RecvCount;
  126. ULONG SendSize;
  127. ULONG RecvSize;
  128. ULONG NextEntryOffset;
  129. LPWSTR ImageName;
  130. ULONG PID;
  131. ULONG DeadFlag;
  132. ULONG HPF;
  133. ULONG SPF;
  134. ULONG PrivateWSet;
  135. ULONG GlobalWSet;
  136. ULONG UserCPU;
  137. ULONG KernelCPU;
  138. ULONG TransCount;
  139. ULONGLONG LifeTime;
  140. ULONGLONG ResponseTime;
  141. ULONGLONG TxnStartTime;
  142. ULONGLONG TxnEndTime;
  143. LPWSTR UserName;
  144. } TRACE_PROCESS_INFOW, *PTRACE_PROCESS_INFOW;
  145. typedef struct _TRACE_THREAD_INFO {
  146. ULONG ThreadId;
  147. } TRACE_THREAD_INFO, *PTRACE_THREAD_INFO;
  148. typedef struct _TRACE_DISK_INFOW {
  149. ULONG ReadCount;
  150. ULONG WriteCount;
  151. ULONG ReadSize;
  152. ULONG WriteSize;
  153. ULONG NextEntryOffset;
  154. LPWSTR DiskName;
  155. ULONG DiskNumber;
  156. } TRACE_DISK_INFOW, *PTRACE_DISK_INFOW;
  157. //
  158. // tracelib will not start up a logger anymore. It is external to the dll
  159. // You can provide either Logfiles or LoggerNames (RealTime) as data feed
  160. //
  161. typedef struct _TRACE_BASIC_INFOW {
  162. ULONG FlushTimer;
  163. HANDLE hEvent;
  164. ULONG LogFileCount;
  165. ULONG LoggerCount;
  166. LPCWSTR *LogFileName;
  167. LPCWSTR *LoggerName;
  168. LPCWSTR MergeFileName;
  169. LPCWSTR ProcFileName;
  170. LPCWSTR SummaryFileName;
  171. LPCWSTR DumpFileName;
  172. LPCWSTR MofFileName;
  173. LPCWSTR CompFileName;
  174. ULONGLONG StartTime;
  175. ULONGLONG EndTime;
  176. ULONGLONG DSStartTime;
  177. ULONGLONG DSEndTime;
  178. ULONG Flags;
  179. PVOID pUserContext;
  180. } TRACE_BASIC_INFOW, *PTRACE_BASIC_INFOW;
  181. #define TRACE_FILE_INFO TRACE_FILE_INFOW
  182. #define PTRACE_FILE_INFO PTRACE_FILE_INFOW
  183. #define TRACE_PROCESS_INFO TRACE_PROCESS_INFOW
  184. #define PTRACE_PROCESS_INFO PTRACE_PROCESS_INFOW
  185. #define TRACE_DISK_INFO TRACE_DISK_INFOW
  186. #define PTRACE_DISK_INFO PTRACE_DISK_INFOW
  187. #define TRACE_BASIC_INFO TRACE_BASIC_INFOW
  188. #define PTRACE_BASIC_INFO PTRACE_BASIC_INFOW
  189. //
  190. // APIs
  191. //
  192. HRESULT
  193. CPDAPI
  194. GetTempName( LPTSTR strFile, DWORD dwSize );
  195. BOOLEAN
  196. CPDAPI
  197. TraceCtrDllInitialize (
  198. HINSTANCE hinstDll,
  199. DWORD fdwReason,
  200. LPVOID fImpLoad
  201. );
  202. ULONG
  203. CPDAPI
  204. InitTraceContextW(
  205. IN OUT PTRACE_BASIC_INFOW pTraceBasic
  206. );
  207. ULONG
  208. CPDAPI
  209. DeinitTraceContext(
  210. IN OUT PTRACE_BASIC_INFO pTraceBasic
  211. );
  212. //
  213. // Gets all instances of the Trace information. Caller provides
  214. // storage and frees it. If the information does not fit, returns
  215. // as much will go in the buffer provided and returns the Length
  216. // of data stuffed.
  217. //
  218. ULONG
  219. CPDAPI
  220. GetMaxLoggers();
  221. ULONG
  222. CPDAPI
  223. TraceQueryAllInstances (
  224. IN TRACEINFOCLASS TraceInformationClass,
  225. OUT PVOID TraceInformation,
  226. IN ULONG TraceInformationLength,
  227. OUT PULONG Length
  228. );
  229. ULONG
  230. CPDAPI
  231. TraceDrillDownW(
  232. IN TRACEINFOCLASS RootInformationClass,
  233. IN LPCWSTR InstanceName,
  234. IN TRACEINFOCLASS TraceInformationClass,
  235. OUT PVOID TraceInformation,
  236. IN ULONG TraceInforamationLength,
  237. OUT PULONG Length
  238. );
  239. ULONG
  240. CPDAPI
  241. TraceSetTimer (
  242. IN ULONG FlushTimer
  243. );
  244. #define TraceDrillDown TraceDrillDownW
  245. #define InitTraceContext InitTraceContextW
  246. #ifdef __cplusplus
  247. }
  248. #endif
  249. #endif // __TRACECTR__01042001_