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.

118 lines
3.5 KiB

  1. /*++
  2. Copyright (c) 1998 Microsoft Corporation
  3. Module Name:
  4. PassportPerfInterface.h
  5. Abstract:
  6. Performance Monitor Class Definition
  7. Author:
  8. Christopher Bergh (cbergh) 10-Sept-1988
  9. Revision History:
  10. - added Instance support 1-Oct-98
  11. --*/
  12. #if !defined (PASSPORTPERFINTERFACE_H)
  13. #define PASSPORTPERFINTERFACE_H
  14. #if _MSC_VER >= 1000
  15. #pragma once
  16. #endif // _MSC_VER >= 1000
  17. #include <windows.h>
  18. class PassportPerfInterface
  19. {
  20. public:
  21. inline PassportPerfInterface() {};
  22. inline virtual ~PassportPerfInterface () {};
  23. enum OBJECT_TYPE
  24. {
  25. PERFMON_TYPE = 100, // use Perfmon counter,
  26. SNMP_TYPE = 101 // use SNMP Traps,
  27. };
  28. // -------------------------------------------------------------------
  29. /* Divide delta by delta time. Display suffix: "/sec" */
  30. // PERF_COUNTER_COUNTER = 1000,
  31. /* Indicates the data is a counter which should not be */
  32. /* time averaged on display (such as an error counter on a serial line) */
  33. /* Display as is. No Display Suffix.*/
  34. // PERF_COUNTER_RAWCOUNT = 1001,
  35. /* A timer which, when divided by an average base, produces a time */
  36. /* in seconds which is the average time of some operation. This */
  37. /* timer times total operations, and the base is the number of opera- */
  38. /* tions. Display Suffix: "sec" */
  39. // PERF_AVERAGE_TIMER = 1002,
  40. /* This counter is used to display the difference from one sample */
  41. /* to the next. The counter value is a constantly increasing number */
  42. /* and the value displayed is the difference between the current */
  43. /* value and the previous value. Negative numbers are not allowed */
  44. /* which shouldn't be a problem as long as the counter value is */
  45. /* increasing or unchanged. */
  46. // PERF_COUNTER_DELTA = 1003,
  47. /* unknown type */
  48. // PERF_COUNTER_UNDEFINED = 1004
  49. enum COUNTER_SAMPLING_TYPE
  50. {
  51. COUNTER_COUNTER = 1000,
  52. COUNTER_RAWCOUNT = 1001,
  53. AVERAGE_TIMER = 1002,
  54. COUNTER_DELTA = 1003,
  55. COUNTER_UNDEFINED = 1004
  56. };
  57. enum { MAX_COUNTERS = 128, MAX_INSTANCES = 64, MAX_INSTANCE_NAME = 32 };
  58. // object initialization
  59. virtual BOOL init ( LPCTSTR lpcPerfObjectName ) = 0;
  60. // get set counter type
  61. virtual BOOL setCounterType (
  62. const DWORD &dwType,
  63. const PassportPerfInterface::COUNTER_SAMPLING_TYPE &counterSampleType) = 0;
  64. virtual PassportPerfInterface::COUNTER_SAMPLING_TYPE getCounterType (
  65. const DWORD &dwType ) const = 0;
  66. // adding/subtracting an instance to this object
  67. virtual BOOL addInstance ( LPCSTR lpszInstanceName ) = 0;
  68. virtual BOOL deleteInstance ( LPCSTR lpszInstanceName ) = 0;
  69. virtual BOOL instanceExists ( LPCSTR lpszInstanceName ) = 0;
  70. virtual BOOL hasInstances ( void ) = 0;
  71. virtual DWORD numInstances ( void ) = 0;
  72. // counters: note if hasInstances() is TRUE, then you must
  73. // give the instance name
  74. virtual BOOL incrementCounter (
  75. const DWORD &dwType,
  76. LPCSTR lpszInstanceName = NULL ) = 0;
  77. virtual BOOL decrementCounter (
  78. const DWORD &dwType,
  79. LPCSTR lpszInstanceName = NULL ) = 0;
  80. virtual BOOL setCounter (
  81. const DWORD &dwType,
  82. const DWORD &dwValue,
  83. LPCSTR lpszInstanceName = NULL ) = 0;
  84. virtual BOOL getCounterValue (
  85. DWORD &dwValue,
  86. const DWORD &dwType,
  87. LPCSTR lpszInstanceName = NULL ) = 0;
  88. };
  89. // create and returns a pointer to the relevant implementation,
  90. // NULL if none exists (FYI- extern "C" to stop name mangling)
  91. extern "C" PassportPerfInterface * CreatePassportPerformanceObject( PassportPerfInterface::OBJECT_TYPE type );
  92. #endif