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.

148 lines
2.7 KiB

  1. /*++
  2. Copyright (c) 1996 Microsoft Corporation
  3. All rights reserved.
  4. Module Name:
  5. perf.hxx
  6. Abstract:
  7. Performance public header file.
  8. Author:
  9. Albert Ting (AlbertT) 18-Dec-1996
  10. Revision History:
  11. --*/
  12. #ifndef PERF_HXX
  13. #define PERF_HXX
  14. /********************************************************************
  15. To use the performance library, do the following:
  16. * Define a string gszAppName that is the name of the application.
  17. * Export the routines:
  18. Pf_dwClientOpen
  19. Pf_dwClientCollet
  20. Pf_vClientClose
  21. * In Pf_dwClientOpen, call Pf_*FixIndicies* to update the indicies
  22. based on either a performance registry key, or fixed known values.
  23. * Static link with perf.lib.
  24. ********************************************************************/
  25. typedef struct PERF_DATA_DEFINITION
  26. {
  27. PERF_OBJECT_TYPE ObjectType;
  28. PERF_COUNTER_DEFINITION aCounterDefinitions[1];
  29. } *PPERF_DATA_DEFINITION;
  30. inline
  31. UINT
  32. QuadAlignUp(
  33. UINT u
  34. )
  35. {
  36. return ( u + 7 ) & ~7;
  37. }
  38. /********************************************************************
  39. Support routines client may call.
  40. ********************************************************************/
  41. DWORD
  42. Pf_dwFixIndiciesKey(
  43. LPCTSTR szPerformanceKey,
  44. PPERF_DATA_DEFINITION ppdd
  45. );
  46. VOID
  47. Pf_vFixIndiciesFromIndex(
  48. DWORD dwFirstCounter,
  49. DWORD dwFirstHelp,
  50. PPERF_DATA_DEFINITION ppdd
  51. );
  52. DWORD
  53. Pf_dwBuildInstance(
  54. DWORD dwParentObjectTitleIndex,
  55. DWORD dwParentObjectInstance,
  56. DWORD dwUniqueID,
  57. LPCWSTR pszName,
  58. PBYTE* ppData,
  59. PDWORD pcbDataLeft
  60. );
  61. /********************************************************************
  62. Client export functions.
  63. ********************************************************************/
  64. DWORD
  65. Pf_dwClientOpen(
  66. LPCWSTR pszDeviceNames,
  67. PPERF_DATA_DEFINITION *pppdd
  68. );
  69. DWORD
  70. Pf_dwClientCollect(
  71. PBYTE *ppData,
  72. PDWORD pcbDataLeft,
  73. PDWORD pcNumInstances
  74. );
  75. VOID
  76. Pf_vClientClose(
  77. VOID
  78. );
  79. /********************************************************************
  80. Event logging.
  81. ********************************************************************/
  82. enum EEventLogLevel {
  83. kSuccess = 0,
  84. kInformation = 1,
  85. kWarning = 2,
  86. kError = 3,
  87. kTypeMask = 0xffff,
  88. kNone = 0x00000,
  89. kUser = 0x10000,
  90. kDebug = 0x20000,
  91. kVerbose = 0x30000,
  92. kLevelShift = 0x10
  93. };
  94. VOID
  95. Pf_vReportEvent(
  96. UINT uLevel,
  97. DWORD dwMessage,
  98. DWORD cbData,
  99. PVOID pvData,
  100. LPCWSTR pszFirst,
  101. ...
  102. );
  103. #endif // ifdef PERF_HXX