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.

161 lines
4.6 KiB

  1. /***********************************************************************
  2. * Microsoft Jet
  3. *
  4. * Microsoft Confidential. Copyright 1991-1993 Microsoft Corporation.
  5. *
  6. * Component:
  7. *
  8. * File: perfdata.h
  9. *
  10. * File Comments:
  11. *
  12. * Public header file for use with performance monitoring.
  13. *
  14. * Revision History:
  15. *
  16. * [0] 13-Jul-94 t-andyg Added this header
  17. *
  18. ***********************************************************************/
  19. #ifndef __PERFDATA_H__
  20. #define __PERFDATA_H__
  21. //
  22. // ADDING A PERFORMANCE OBJECT OR COUNTER
  23. //
  24. // In order to add an object or counter to a translation unit, you must
  25. // perform the following steps:
  26. //
  27. // o add the object/counter's information to the performance
  28. // database in perfdata.txt (see this file for details)
  29. // o add the object/counter's name and help text macros to
  30. // perfdata.src (see this file for an example)
  31. // o add the object/counter's actual name and help text to
  32. // lang\???\perfdata.tok in the respective tokens (all languages)
  33. // o define all data/functions referenced by the object/counter's
  34. // information in the database
  35. //
  36. //
  37. // NOTE: some macros in this file require the inclusion of winperf.h
  38. //
  39. // Default detail level
  40. #define PERF_DETAIL_DEFAULT PERF_DETAIL_NOVICE
  41. // Instance Catalog Function (typedef)
  42. //
  43. // Returns a Unicode MultiSz containing all instances of the given object.
  44. // This list can be static or dynamic and is reevaluated every time
  45. // CollectPerformanceData() is called. If no instances are returned,
  46. // the Counter Evaluation Function will not be called.
  47. //
  48. // Action codes for the passed long:
  49. //
  50. // ICFData: Pass pointer to string in *(void **) and return # instances
  51. // ICFInit: Perform any required initialization (return 0 on success)
  52. // ICFTerm: Perform any required termination (return 0 on success)
  53. //
  54. // NOTE: The caller is NOT responsible for freeing the string's buffer.
  55. // The caller is also not permitted to modify the buffer.
  56. typedef long (PM_ICF_PROC) ( long, void const ** );
  57. #define ICFData ( 0 )
  58. #define ICFInit ( 1 )
  59. #define ICFTerm ( 2 )
  60. // Counter Evaluation Function (typedef)
  61. //
  62. // The function is given the index of the Instance that
  63. // we need counter data for and a pointer to the location
  64. // to store that data.
  65. //
  66. // If the pointer is NULL, the passed long has the following
  67. // special meanings:
  68. //
  69. // CEFInit: Initialize counter for all instances (return 0 on success)
  70. // CEFTerm: Terminate counter for all instances (return 0 on success)
  71. typedef long (PM_CEF_PROC) ( long, void * );
  72. #define CEFInit ( 1 )
  73. #define CEFTerm ( 2 )
  74. // Calculate the true size of a counter, accounting for DWORD padding
  75. #define PerfSize( _x ) ( ( _x ) &0x300 )
  76. #define DWORD_MULTIPLE( _x ) ( ( ( ( _x ) + sizeof( unsigned long ) - 1 ) \
  77. / sizeof( unsigned long ) ) \
  78. * sizeof( unsigned long ) )
  79. #define CntrSize( _a, _b ) ( PerfSize( _a ) == 0x000 ? 4 \
  80. : ( PerfSize( _a ) == 0x100 ? 8 \
  81. : ( PerfSize( _a ) == 0x200 ? 0 \
  82. : ( DWORD_MULTIPLE( _b ) ) ) ) )
  83. // initial count for inst count semaphore
  84. #define PERF_INIT_INST_COUNT 0x7FFFFFFF
  85. // shared data area
  86. #define PERF_SIZEOF_SHARED_DATA 0x10000
  87. #pragma pack( 4 )
  88. typedef struct _SDA {
  89. unsigned long cCollect; // collect count (collect signal ID)
  90. unsigned long dwProcCount; // # Processes signaled to write data
  91. unsigned long iNextBlock; // Index of next free block
  92. unsigned long cbAvail; // Available bytes
  93. unsigned long ibTop; // Top of the allocation stack
  94. unsigned long ibBlockOffset[]; // Offset to each block
  95. } SDA, *PSDA;
  96. #pragma pack()
  97. // extern pointing to generated PERF_DATA_TEMPLATE in perfdata.c
  98. //
  99. // NOTE: the PerformanceData functions access this structure using
  100. // its self contained offset tree, NOT using any declaration
  101. extern void * const pvPERFDataTemplate;
  102. // performance data version string (used to correctly match edb.dll
  103. // and edbperf.dll versions as the name of the file mapping)
  104. extern char szPERFVersion[];
  105. // ICF/CEF tables in perfdata.c
  106. extern PM_ICF_PROC* rgpicfPERFICF[];
  107. extern PM_CEF_PROC* rgpcefPERFCEF[];
  108. // # objects in perfdata.c
  109. extern const unsigned long dwPERFNumObjects;
  110. // object instance data tables in perfdata.c
  111. extern long rglPERFNumInstances[];
  112. extern wchar_t *rgwszPERFInstanceList[];
  113. // # counters in perfdata.c
  114. extern const unsigned long dwPERFNumCounters;
  115. // maximum index used for name/help text in perfdata.c
  116. extern const unsigned long dwPERFMaxIndex;
  117. #endif /* __PERFDATA_H__ */