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.

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