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.

235 lines
6.2 KiB

  1. /*++
  2. Copyright (C) 1999 Microsoft Corporation
  3. Module Name:
  4. perfmon5.h
  5. Abstract:
  6. <abstract>
  7. --*/
  8. #include <assert.h>
  9. #include <stdio.h>
  10. #include <stdlib.h>
  11. #include <string.h>
  12. #include <math.h>
  13. #include <limits.h>
  14. #include <windows.h>
  15. #include <winperf.h>
  16. #include <pdh.h>
  17. #include <pdhmsg.h>
  18. #define FileSeekBegin(hFile, lAmtToMove) SetFilePointer(hFile, lAmtToMove, NULL, FILE_BEGIN)
  19. // these defintions are copied from the NT4 perfmon.exe source files
  20. typedef struct OPTIONSSTRUCT
  21. {
  22. BOOL bMenubar;
  23. BOOL bToolbar;
  24. BOOL bStatusbar;
  25. BOOL bAlwaysOnTop;
  26. } OPTIONS ;
  27. //======================================//
  28. // DISKLINE data type //
  29. //======================================//
  30. #define dwLineSignature (MAKELONG ('L', 'i'))
  31. typedef struct DISKSTRINGSTRUCT
  32. {
  33. DWORD dwLength;
  34. DWORD dwOffset;
  35. } DISKSTRING, * PDISKSTRING;
  36. typedef struct _TIMELINESTRUCT
  37. {
  38. INT ppd; // Pixels Per DataPoint
  39. INT rppd; // Remaining Pixels Per DataPoint
  40. INT xLastTime; // X coordinate of last time line.
  41. INT iValidValues; // High water mark for valid data.
  42. }TIMELINESTRUCT;
  43. #define LineTypeChart 1
  44. #define LineTypeAlert 2
  45. #define LineTypeReport 3
  46. typedef struct LINEVISUALSTRUCT
  47. {
  48. COLORREF crColor;
  49. int iColorIndex;
  50. int iStyle;
  51. int iStyleIndex;
  52. int iWidth;
  53. int iWidthIndex;
  54. } LINEVISUAL, * PLINEVISUAL;
  55. typedef struct DISKLINESTRUCT
  56. {
  57. int iLineType;
  58. DISKSTRING dsSystemName;
  59. DISKSTRING dsObjectName;
  60. DISKSTRING dsCounterName;
  61. DISKSTRING dsInstanceName;
  62. DISKSTRING dsPINName;
  63. DISKSTRING dsParentObjName;
  64. DWORD dwUniqueID;
  65. LINEVISUAL Visual;
  66. int iScaleIndex;
  67. FLOAT eScale;
  68. BOOL bAlertOver;
  69. FLOAT eAlertValue;
  70. DISKSTRING dsAlertProgram;
  71. BOOL bEveryTime;
  72. } DISKLINE, * PDISKLINE;
  73. #define PerfSignatureLen 20
  74. #define szPerfChartSignature ((LPCWSTR) L"PERF CHART")
  75. #define szPerfAlertSignature ((LPCWSTR) L"PERF ALERT")
  76. #define szPerfLogSignature ((LPCWSTR) L"PERF LOG")
  77. #define szPerfReportSignature ((LPCWSTR) L"PERF REPORT")
  78. #define szPerfWorkspaceSignature ((LPCWSTR) L"PERF WORKSPACE")
  79. #define LINE_GRAPH 1
  80. #define BAR_GRAPH 2
  81. #define PMC_FILE 1
  82. #define PMA_FILE 2
  83. #define PML_FILE 3
  84. #define PMR_FILE 4
  85. #define PMW_FILE 5
  86. #define AlertMajorVersion 1
  87. // minor version 2 to support Alert msg name
  88. // minor version 3 to support alert, report, log intervals in msec
  89. // minor version 4 to support alert event logging
  90. // minor version 6 to support alert misc options
  91. #define AlertMinorVersion 6
  92. typedef struct DISKALERTSTRUCT
  93. {
  94. LINEVISUAL Visual;
  95. DWORD dwNumLines;
  96. DWORD dwIntervalSecs;
  97. BOOL bManualRefresh;
  98. BOOL bSwitchToAlert;
  99. BOOL bNetworkAlert;
  100. WCHAR MessageName[16];
  101. OPTIONS perfmonOptions;
  102. DWORD MiscOptions;
  103. } DISKALERT;
  104. typedef struct PERFFILEHEADERSTRUCT
  105. { // PERFFILEHEADER
  106. WCHAR szSignature[PerfSignatureLen];
  107. DWORD dwMajorVersion;
  108. DWORD dwMinorVersion;
  109. BYTE abyUnused[100];
  110. } PERFFILEHEADER;
  111. // minor version 3 to support alert, report, log intervals in msec
  112. #define ChartMajorVersion 1
  113. #define ChartMinorVersion 3
  114. typedef struct _graph_options {
  115. BOOL bLegendChecked;
  116. BOOL bMenuChecked;
  117. BOOL bLabelsChecked;
  118. BOOL bVertGridChecked;
  119. BOOL bHorzGridChecked;
  120. BOOL bStatusBarChecked;
  121. INT iVertMax;
  122. FLOAT eTimeInterval;
  123. INT iGraphOrHistogram;
  124. INT GraphVGrid,
  125. GraphHGrid,
  126. HistVGrid,
  127. HistHGrid;
  128. } GRAPH_OPTIONS;
  129. #define MAX_SYSTEM_NAME_LENGTH 128
  130. #define PerfObjectLen 80
  131. typedef struct DISKCHARTSTRUCT
  132. {
  133. DWORD dwNumLines;
  134. INT gMaxValues;
  135. LINEVISUAL Visual;
  136. GRAPH_OPTIONS gOptions;
  137. BOOL bManualRefresh;
  138. OPTIONS perfmonOptions;
  139. } DISKCHART;
  140. // minor version 3 to support alert, report, log intervals in msec
  141. #define ReportMajorVersion 1
  142. #define ReportMinorVersion 3
  143. typedef struct DISKREPORTSTRUCT
  144. {
  145. LINEVISUAL Visual;
  146. DWORD dwNumLines;
  147. DWORD dwIntervalSecs;
  148. BOOL bManualRefresh;
  149. OPTIONS perfmonOptions;
  150. } DISKREPORT;
  151. //=====================================//
  152. // Log File Counter Name data type //
  153. //=====================================//
  154. // minor version 3 to support alert, report, log intervals in msec
  155. // minor version 5 to support storing Log file name in setting
  156. // and start logging after reading the file.
  157. #define LogMajorVersion 1
  158. #define LogMinorVersion 5
  159. typedef struct DISKLOGSTRUCT
  160. {
  161. DWORD dwNumLines;
  162. DWORD dwIntervalSecs;
  163. BOOL bManualRefresh;
  164. OPTIONS perfmonOptions;
  165. WCHAR LogFileName[260];
  166. } DISKLOG;
  167. typedef struct _LOGENTRYSTRUCT
  168. {
  169. DWORD ObjectTitleIndex;
  170. WCHAR szComputer[MAX_SYSTEM_NAME_LENGTH + 1];
  171. WCHAR szObject[PerfObjectLen + 1];
  172. BOOL bSaveCurrentName;
  173. struct _LOGENTRYSTRUCT * pNextLogEntry;
  174. } LOGENTRY, * PLOGENTRY;
  175. #define WorkspaceMajorVersion 1
  176. // minor version 1 to support window placement data
  177. // minor version 2 to support alert msg name
  178. // minor version 3 to support alert, report, log intervals in msec
  179. // minor version 4 to support alert eventlog
  180. // minor version 5 to support log file name in log setting
  181. // minor version 6 to support alert misc options
  182. #define WorkspaceMinorVersion 6
  183. typedef struct DISKWORKSPACESTRUCT
  184. {
  185. INT iPerfmonView;
  186. DWORD ChartOffset;
  187. DWORD AlertOffset;
  188. DWORD LogOffset;
  189. DWORD ReportOffset;
  190. WINDOWPLACEMENT WindowPlacement;
  191. } DISKWORKSPACE;
  192. WCHAR LOCAL_SYS_CODE_NAME[] = {L"...."};
  193. #define sizeofCodeName sizeof(LOCAL_SYS_CODE_NAME) / sizeof(WCHAR) - 1