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.

180 lines
6.7 KiB

  1. // NMSTAT.H
  2. //
  3. // Headers for STATS.DLL: a library to accumulate high performance
  4. // statistics and allow them to be tabulated in a different
  5. // process.
  6. //
  7. // Created 24-Oct-96 [JonT]
  8. #ifndef _NMSTATS_H
  9. #define _NMSTATS_H
  10. #ifdef __cplusplus
  11. extern "C" {
  12. #endif
  13. //#if defined(_BUILD_STATS_) || defined(__midl)
  14. #ifdef _BUILD_STATS_
  15. #define STATSAPI
  16. #else
  17. #define STATSAPI __declspec(dllimport)
  18. #endif
  19. // Equates
  20. #define MAX_COUNTER_NAME 64
  21. #define STATS_COUNTER_ADDDEL_EVENT "StatsNewCounter"
  22. #define STATS_REPORT_ADDDEL_EVENT "StatsNewReport"
  23. #define COUNTER_FLAG_NO_STATISTICS 1 // Flag to CreateCounter. No statistics accumulated
  24. // for this counter even if StartStatistics called.
  25. // (StartStatistics fails)
  26. #define COUNTER_FLAG_ACCUMULATE 2 // UpdateCounter adds to the counter value rather
  27. // than replacing it.
  28. #define COUNTER_CLEAR 1 // Flag to GetCounter. Specifies the counter should
  29. // be cleared after being read
  30. #define MAX_REPORT_NAME 64
  31. #define UNDEFINED -1L
  32. // Call parameters report defines
  33. #define REP_SEND_AUDIO_FORMAT 0
  34. #define REP_SEND_AUDIO_SAMPLING 1
  35. #define REP_SEND_AUDIO_BITRATE 2
  36. #define REP_SEND_AUDIO_PACKET 3
  37. #define REP_RECV_AUDIO_FORMAT 4
  38. #define REP_RECV_AUDIO_SAMPLING 5
  39. #define REP_RECV_AUDIO_BITRATE 6
  40. #define REP_RECV_AUDIO_PACKET 7
  41. #define REP_SEND_VIDEO_FORMAT 8
  42. #define REP_SEND_VIDEO_MAXFPS 9
  43. #define REP_SEND_VIDEO_BITRATE 10
  44. #define REP_RECV_VIDEO_FORMAT 11
  45. #define REP_RECV_VIDEO_MAXFPS 12
  46. #define REP_RECV_VIDEO_BITRATE 13
  47. // System settings report defines
  48. #define REP_SYS_BANDWIDTH 0
  49. #define REP_SYS_AUDIO_DSOUND 1
  50. #define REP_SYS_AUDIO_RECORD 2
  51. #define REP_SYS_AUDIO_PLAYBACK 3
  52. #define REP_SYS_AUDIO_DUPLEX 4
  53. #define REP_SYS_VIDEO_DEVICE 5
  54. #define REP_DEVICE_IMAGE_SIZE 6
  55. // Types
  56. #ifdef __midl
  57. typedef DWORD HCOUNTER;
  58. #else
  59. typedef HANDLE HCOUNTER;
  60. #endif
  61. typedef HCOUNTER HREPORT;
  62. typedef struct _FINDCOUNTER
  63. {
  64. DWORD dwSize;
  65. char szName[MAX_COUNTER_NAME]; // Human-readable counter name
  66. HCOUNTER hcounter; // Handle to use with all stats functions
  67. int nValue; // Current value of counter
  68. WORD wFlags; // COUNTER_FLAG_* values
  69. WORD wRefCount; // Number of times StartStatistics has been called.
  70. DWORD dwReserved; // Must be preserved: used for FindNextCounter
  71. } FINDCOUNTER;
  72. typedef struct _FINDREPORT
  73. {
  74. DWORD dwSize;
  75. char szName[MAX_REPORT_NAME]; // Human-readable report name
  76. HREPORT hreport; // Handle to use with all functions
  77. WORD wFlags; // COUNTER_FLAG_* values
  78. WORD wRefCount; // Number of times StartStatistics has been called.
  79. DWORD dwReserved; // Must be preserved: used for FindNextCounter
  80. } FINDREPORT;
  81. typedef struct _COUNTERSTAT
  82. {
  83. DWORD dwSize; // Size of structure. Allows for future growth...
  84. int nValue;
  85. int nLow; // Lowest value seen since clear
  86. int nHigh; // Highest value seen since clear
  87. int nAverage; // Average value seen since clear
  88. DWORD dwNumSamples; // Number of samples accumulated
  89. DWORD dwmsAtClear; // GetTickCount at last Clear/StartStatistics call
  90. } COUNTERSTAT;
  91. // Nothing further needed by MIDL
  92. #ifndef __midl
  93. // Counter Functions
  94. // Called by updater of counter to make new counter
  95. // Sets the event named in the equate STATS_NEW_COUNTER_EVENT
  96. STATSAPI HCOUNTER WINAPI CreateCounter(char* szName, WORD wFlags);
  97. // Called by updater of counter when counter is going away
  98. STATSAPI BOOL WINAPI DeleteCounter(HCOUNTER hc);
  99. // Used by reader app to locate specific named counters or walk entire list.
  100. // Pass NULL in for name to walk entire list. Pass NULL to FINDCOUNTER if
  101. // just an HCOUNTER is desired. FindNext returns FALSE when there are no more.
  102. STATSAPI HCOUNTER WINAPI FindFirstCounter(char* szName, FINDCOUNTER* pfc);
  103. STATSAPI BOOL WINAPI FindNextCounter(FINDCOUNTER* pfc);
  104. // Called by updater of counter. Makes the value current in the counter.
  105. STATSAPI void WINAPI UpdateCounter(HCOUNTER hcounter, int value);
  106. // Called by updater of counter. Initializes the max value for the counter.
  107. STATSAPI void WINAPI InitCounterMax(HCOUNTER hcounter, int nMaxValue);
  108. // Called by user of counter and just returns value with no statistics
  109. STATSAPI int WINAPI GetCounter(HCOUNTER hcounter, DWORD dwFlags);
  110. // Called by user of counter and just returns max value with no statistics
  111. STATSAPI int WINAPI GetCounterMax(HCOUNTER hcounter, DWORD dwFlags);
  112. // Begins collecting statistics on a counter
  113. STATSAPI BOOL WINAPI StartStatistics(HCOUNTER hcounter);
  114. // Done collecting statistics on a counter
  115. STATSAPI void WINAPI StopStatistics(HCOUNTER hcounter);
  116. // Get statistics on a counter
  117. STATSAPI BOOL WINAPI ReadStatistics(HCOUNTER hcounter, COUNTERSTAT* pcs);
  118. // Clear statistics on a counter
  119. STATSAPI void WINAPI ClearStatistics(HCOUNTER hcounter);
  120. // Report Functions
  121. // Called by updater of report to make new report
  122. // Sets the event named in the equate STATS_NEW_COUNTER_EVENT
  123. STATSAPI HREPORT WINAPI CreateReport(char* szName, WORD wFlags);
  124. // Called by updater of report when report is going away
  125. STATSAPI BOOL WINAPI DeleteReport(HREPORT hreport);
  126. // Used by reader app to locate specific named reports or walk entire list.
  127. // Pass NULL in for name to walk entire list. Pass NULL to FINDREPORT if
  128. // just an HREPORT is desired. FindNext returns FALSE when there are no more.
  129. STATSAPI HREPORT WINAPI FindFirstReport(char* szName, FINDREPORT* pfr);
  130. STATSAPI BOOL WINAPI FindNextReport(FINDREPORT* pfr);
  131. // Called by updater of report. Makes the value current in the report.
  132. STATSAPI void WINAPI UpdateReportEntry(HREPORT hreport, int nValue, DWORD dwIndex);
  133. // Called by creater of report.
  134. STATSAPI void WINAPI CreateReportEntry(HREPORT hreport, char* szName, DWORD dwIndex);
  135. // Called by user of report
  136. STATSAPI int WINAPI GetReportEntry(HREPORT hreport, DWORD dwIndex);
  137. // Called by user of report
  138. STATSAPI void WINAPI GetReportEntryName(HREPORT hreport, char *szName, DWORD dwIndex);
  139. // Called by user of report
  140. STATSAPI int WINAPI GetNumReportEntries(HREPORT hreport);
  141. #endif // #ifndef __midl
  142. #ifdef __cplusplus
  143. }
  144. #endif
  145. #endif // #ifndef _STATS_H