Leaked source code of windows server 2003
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.

282 lines
6.8 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_DUMP 0x00000080
  30. #define TRACE_USE_WBEM 0x00000100
  31. #define TRACE_EXTENDED_FMT 0x00000200
  32. #define TRACE_SUMMARY 0x00000400
  33. #define TRACE_MERGE_ETL 0x00000800
  34. #define TRACE_INTERPRET 0x00001000
  35. #define TRACE_MEMORY_REPORT 0x00002000
  36. #define TRACE_HARDFAULT_REPORT 0x00004000
  37. #define TRACE_BASIC_REPORT 0x00008000
  38. #define TRACE_TOTALS_REPORT 0x00010000
  39. #define TRACE_FILE_REPORT 0x00020000
  40. #define TRACE_TRANSFORM_XML 0x00040000
  41. #define DEFAULT_FILE_REPORT_SIZE 50
  42. #define TRACE_STATUS_PROCESSING 0x00000001
  43. #define TRACE_STATUS_REPORTING 0x00000002
  44. typedef enum _MM_REPORT_TYPE
  45. {
  46. REPORT_SUMMARY_PROCESS,
  47. REPORT_SUMMARY_MODULE,
  48. REPORT_LIST_PROCESS,
  49. REPORT_LIST_MODULE
  50. } MM_REPORT_TYPE;
  51. typedef enum _MM_REPORT_SORT_KEY
  52. {
  53. REPORT_SORT_ALL,
  54. REPORT_SORT_HPF,
  55. REPORT_SORT_TF,
  56. REPORT_SORT_DZF,
  57. REPORT_SORT_COW
  58. } MM_REPORT_SORT_KEY;
  59. typedef struct _USER_CONTEXT_MM
  60. {
  61. MM_REPORT_TYPE reportNow;
  62. MM_REPORT_SORT_KEY sortNow;
  63. PWCHAR strImgName;
  64. } CPD_USER_CONTEXT_MM, * PCPD_USER_CONTEXT_MM;
  65. typedef struct _TRACE_MODULE_INFO
  66. {
  67. ULONG PID;
  68. ULONG lBaseAddress;
  69. ULONG lModuleSize;
  70. ULONG lDataFaultHF;
  71. ULONG lDataFaultTF;
  72. ULONG lDataFaultDZF;
  73. ULONG lDataFaultCOW;
  74. ULONG lCodeFaultHF;
  75. ULONG lCodeFaultTF;
  76. ULONG lCodeFaultDZF;
  77. ULONG lCodeFaultCOW;
  78. ULONG NextEntryOffset; // From the Current; Not from the top.
  79. LPWSTR strModuleName;
  80. LPWSTR strImageName;
  81. } TRACE_MODULE_INFO, * PTRACE_MODULE_INFO;
  82. typedef struct _TRACE_PROCESS_FAULT_INFO {
  83. ULONG PID;
  84. ULONG lDataFaultHF;
  85. ULONG lDataFaultTF;
  86. ULONG lDataFaultDZF;
  87. ULONG lDataFaultCOW;
  88. ULONG lCodeFaultHF;
  89. ULONG lCodeFaultTF;
  90. ULONG lCodeFaultDZF;
  91. ULONG lCodeFaultCOW;
  92. ULONG NextEntryOffset;
  93. LPWSTR ImageName;
  94. } TRACE_PROCESS_FAULT_INFO, *PTRACE_PROCESS_FAULT_INFO;
  95. typedef struct _TRACE_TRANSACTION_INFO {
  96. ULONG TransactionCount;
  97. ULONG AverageResponseTime; // in milliseconds
  98. ULONG MaxResponseTime;
  99. ULONG MinResponseTime;
  100. ULONG NextEntryOffset;
  101. LPWSTR Name;
  102. } TRACE_TRANSACTION_INFO, *PTRACE_TRANSACTION_INFO;
  103. typedef struct _TRACE_FILE_INFOW {
  104. ULONG ReadCount;
  105. ULONG WriteCount;
  106. ULONG ReadSize;
  107. ULONG WriteSize;
  108. ULONG NextEntryOffset; // From the Current; Not from the top.
  109. LPWSTR FileName; // The string immediatealy follows this structure.
  110. ULONG DiskNumber;
  111. } TRACE_FILE_INFOW, *PTRACE_FILE_INFOW;
  112. typedef struct _TRACE_PROCESS_INFOW {
  113. ULONG ReadCount;
  114. ULONG WriteCount;
  115. ULONG ReadSize;
  116. ULONG WriteSize;
  117. ULONG SendCount;
  118. ULONG RecvCount;
  119. ULONG SendSize;
  120. ULONG RecvSize;
  121. ULONG NextEntryOffset;
  122. LPWSTR ImageName;
  123. ULONG PID;
  124. ULONG DeadFlag;
  125. ULONG HPF;
  126. ULONG SPF;
  127. ULONG PrivateWSet;
  128. ULONG GlobalWSet;
  129. ULONG UserCPU;
  130. ULONG KernelCPU;
  131. ULONG TransCount;
  132. ULONGLONG LifeTime;
  133. ULONGLONG ResponseTime;
  134. ULONGLONG TxnStartTime;
  135. ULONGLONG TxnEndTime;
  136. LPWSTR UserName;
  137. } TRACE_PROCESS_INFOW, *PTRACE_PROCESS_INFOW;
  138. typedef struct _TRACE_THREAD_INFO {
  139. ULONG ThreadId;
  140. } TRACE_THREAD_INFO, *PTRACE_THREAD_INFO;
  141. typedef struct _TRACE_DISK_INFOW {
  142. ULONG ReadCount;
  143. ULONG WriteCount;
  144. ULONG ReadSize;
  145. ULONG WriteSize;
  146. ULONG NextEntryOffset;
  147. LPWSTR DiskName;
  148. ULONG DiskNumber;
  149. } TRACE_DISK_INFOW, *PTRACE_DISK_INFOW;
  150. //
  151. // tracelib will not start up a logger anymore. It is external to the dll
  152. // You can provide either Logfiles or LoggerNames (RealTime) as data feed
  153. //
  154. typedef struct _TRACE_BASIC_INFOW {
  155. ULONG FlushTimer;
  156. HANDLE hEvent;
  157. ULONG LogFileCount;
  158. ULONG LoggerCount;
  159. LPCWSTR *LogFileName;
  160. LPCWSTR *LoggerName;
  161. LPCWSTR MergeFileName;
  162. LPCWSTR ProcFileName;
  163. LPCWSTR SummaryFileName;
  164. LPCWSTR DumpFileName;
  165. LPCWSTR MofFileName;
  166. LPCWSTR DefMofFileName;
  167. LPCWSTR CompFileName;
  168. LPCWSTR XSLDocName;
  169. ULONGLONG StartTime;
  170. ULONGLONG EndTime;
  171. ULONGLONG DSStartTime;
  172. ULONGLONG DSEndTime;
  173. ULONG Flags;
  174. void (*StatusFunction)(int, double);
  175. PVOID pUserContext;
  176. } TRACE_BASIC_INFOW, *PTRACE_BASIC_INFOW;
  177. #define TRACE_FILE_INFO TRACE_FILE_INFOW
  178. #define PTRACE_FILE_INFO PTRACE_FILE_INFOW
  179. #define TRACE_PROCESS_INFO TRACE_PROCESS_INFOW
  180. #define PTRACE_PROCESS_INFO PTRACE_PROCESS_INFOW
  181. #define TRACE_DISK_INFO TRACE_DISK_INFOW
  182. #define PTRACE_DISK_INFO PTRACE_DISK_INFOW
  183. #define TRACE_BASIC_INFO TRACE_BASIC_INFOW
  184. #define PTRACE_BASIC_INFO PTRACE_BASIC_INFOW
  185. #ifdef DBG
  186. extern BOOLEAN TracectrDbgEnabled;
  187. #define TrctrDbgPrint(_x_) { if (TracectrDbgEnabled) DbgPrint _x_ ; }
  188. #endif
  189. //
  190. // APIs
  191. //
  192. ULONG
  193. CPDAPI
  194. GetTempName( LPTSTR strFile, size_t cchSize );
  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. PULONG pMergedEventsLost
  207. );
  208. ULONG
  209. CPDAPI
  210. DeinitTraceContext(
  211. IN OUT PTRACE_BASIC_INFO pTraceBasic
  212. );
  213. ULONG
  214. CPDAPI
  215. GetMaxLoggers();
  216. void DecodeIpAddressA(
  217. USHORT AddrType,
  218. PULONG IpAddrV4,
  219. PUSHORT IpAddrV6,
  220. PCHAR pszA
  221. );
  222. void DecodeIpAddressW(
  223. USHORT AddrType,
  224. PULONG IpAddrV4,
  225. PUSHORT IpAddrV6,
  226. PWCHAR pszW
  227. );
  228. HRESULT TransformXML( LPWSTR szXML, LPWSTR szXSL, LPWSTR szResult );
  229. #define InitTraceContext InitTraceContextW
  230. #ifdef __cplusplus
  231. }
  232. #endif
  233. #endif // __TRACECTR__01042001_