home *** CD-ROM | disk | FTP | other *** search
/ Magazyn Internet 2000 May / MICD_2000_05.iso / CBuilder5 / INSTALL / DATA1.CAB / Program_Built_Files / Include / monitor.h < prev    next >
C/C++ Source or Header  |  2000-02-01  |  9KB  |  180 lines

  1. // --monitor.h------------------------------------------------------------------
  2. //
  3. // Header file for module containing performance monitoring functions.
  4. //
  5. // Copyright 1986 - 1998 Microsoft Corporation.  All Rights Reserved.
  6. // -----------------------------------------------------------------------------
  7. #if !defined(_MONITOR_H)
  8. #pragma option push -b -a8 -pc -A- /*P_O_Push*/
  9. #define _MONITOR_H
  10.  
  11. #ifdef __cplusplus
  12. extern "C" {
  13. #endif // __cplusplus
  14.  
  15. //
  16. // Enumerated Types
  17. //
  18.  
  19. //$--DIRECTIONTYPE--------------------------------------------------------------
  20. //  Tells shether a statistic applies to messages going into or out of Exchange.
  21. // -----------------------------------------------------------------------------
  22. typedef enum _DirectionType                // (hungarian notation = dir)
  23. {
  24.     DIRECTIONTYPE_IN = 0,                 // coming into Exchange
  25.     DIRECTIONTYPE_OUT,                     // going out of Exchange
  26.     DIRECTIONTYPE_LAST                    // all direction types less than this
  27. } DIRECTIONTYPE;
  28.  
  29. //$--COUNTERTYPE----------------------------------------------------------------
  30. //  Tells what statistic is to be counted.
  31. // -----------------------------------------------------------------------------
  32. typedef enum _CounterType                // (hungarian notation = ct)
  33. {
  34.     COUNTERTYPE_MESSAGES_IN_FOLDER = 0,    // total number of messages in folder
  35.     COUNTERTYPE_BYTES_IN_FOLDER,        // total number of bytes in folder
  36.     COUNTERTYPE_MESSAGES_ENTERING_FOLDER, // number of messages entering folder
  37.     COUNTERTYPE_BYTES_ENTERING_FOLDER,    // number of bytes entering folder
  38.     COUNTERTYPE_MESSAGES_LEAVING_FOLDER, // number of messages leaving folder
  39.     COUNTERTYPE_BYTES_LEAVING_FOLDER,    // NOT IMPLEMENTED!!! (placeholder)
  40.     COUNTERTYPE_MESSAGES_TRANSFERRED_IN, // messages transferred into Exchange
  41.     COUNTERTYPE_BYTES_TRANSFERRED_IN,    // bytes transferred into Exchange
  42.     COUNTERTYPE_MESSAGES_TRANSFERRED_OUT, // msgs transferred out of Exchange
  43.     COUNTERTYPE_BYTES_TRANSFERRED_OUT,    // bytes transferred out of Exchange
  44.     COUNTERTYPE_NDRS_IN,                // number of NDRs into Exchange
  45.     COUNTERTYPE_NDRS_OUT,                // number of NDRs out of Exchange
  46.     COUNTERTYPE_ASSOCIATIONS,             // total number of associations
  47.     COUNTERTYPE_USER_DEFINED,             // counter maintained by user
  48.     COUNTERTYPE_LAST                    // all counter types are less than this
  49. } COUNTERTYPE;
  50.  
  51. //$--PERIODTYPE-----------------------------------------------------------------
  52. //  Tells what period the given statistic is to be totaled over.
  53. // -----------------------------------------------------------------------------
  54. typedef enum _PeriodType                // (hungarian notation = per)
  55. {
  56.     PERIODTYPE_NONE = 0,                // not a period statistic
  57.     PERIODTYPE_CONTINUOUS,                // last Perf. Monitor sampling period
  58.     PERIODTYPE_LAST_N_MINUTES,            // past N 1-minute intervals
  59.     PERIODTYPE_TOTAL,                    // since gateway started
  60.     PERIODTYPE_LAST                        // all period types are less than this
  61. } PERIODTYPE;
  62.  
  63. //
  64. // Structure Definitions
  65. //
  66.  
  67. //$--COUNTER--------------------------------------------------------------------
  68. //  The type for a variable that is being used as a counter.
  69. // -----------------------------------------------------------------------------
  70. typedef DWORD COUNTER, *LPCOUNTER;      // (hungarian notation = cnt)
  71.  
  72. //$--COUNTERDEF-----------------------------------------------------------------
  73. //  A table of these structures is passed into rcMonitorInit() to describe the 
  74. //  counters used in performance monitoring.  A counter table consisting of a 
  75. //  table of COUNTER's is created, and it is guaranteed that the counters will 
  76. //  be contiguous and in the same order as they are described in this table.
  77. //  Contiguity is needed for some cases of calculated counters using user 
  78. //  defined counters.
  79. // -----------------------------------------------------------------------------
  80. typedef struct _CounterDef                // (hungarian notation = cd)
  81. {
  82.     DWORD iCounterTitleOffset;            // index to counter name in registry 
  83.                                         // (offset from First Counter)
  84.     COUNTERTYPE ctStatistic;            // which statistic this counter monitors
  85.     LPMAPIFOLDER lpFolder;                // folder that counter is from (if 
  86.                                         // applicable)
  87.     PERIODTYPE perPeriod;                // Period to total statistic (if 
  88.                                         // applicable)
  89.     DWORD cMinutes;                        // N for PERIODTYPE_LAST_N_MINUTES
  90.     LPCOUNTER * lppcntUserCounter;        // address to return a pointer to 
  91.                                         // actual counter (for a user defined 
  92.                                         // counter), or NULL if not needed
  93.     DWORD dwUserCounterType;            // counter type as defined in winperf.h
  94.                                         // (for a user defined counter)
  95.     DWORD dwDetailLevel;                // counter complexity (from winperf.h)
  96.     DWORD dwDefaultScale;                // default scale (from winperf.h)
  97. } COUNTERDEF, *LPCOUNTERDEF;
  98.  
  99. //
  100. // Public Function Declarations
  101. //
  102.  
  103. //$--HrMonInit--------------------------------------------------------------
  104. //  Begins performance monitoring of the current monitored object.
  105. //
  106. //  If lpszObjectClass != NULL, then use lpszObjectClass as the class of the  
  107. //  monitored object.
  108. //  If lpszObjectClass == NULL, then read the object class from the 
  109. //  Parameters\ObjectClass value under the object's registry key, or if 
  110. //  it's not present, assume that the object class is the same as the object 
  111. //  name.
  112. // -----------------------------------------------------------------------------
  113. HRESULT HrMonInit(                     // RETURNS: HRESULT
  114.     IN DWORD dwFlags,                    // for future use--must be zero
  115.     IN LPSTR lpszObjectClass,            // class of monitored object, or NULL
  116.     IN LPSTR lpszObjectName,             // gateway instance name
  117.     IN DWORD dwObjectTitleOffset,        // index number of object name in 
  118.                                         // the registry database (offset from
  119.                                         // First Counter)
  120.     IN DWORD dwObjectDetailLevel,        // complexity of object (see winperf.h)
  121.     IN LONG dwDefaultCounter,            // zero-based number of default counter 
  122.                                         // for this object
  123.     IN DWORD ccdNumberOfCounters,        // number of counter structures
  124.                                         // being passed in
  125.     IN LPCOUNTERDEF lpcdCounters);        // pointer to array of counter
  126.                                         // structures
  127.  
  128. //$--HrMonUninit----------------------------------------------------------
  129. //  Ends performance monitoring of the current gateway.
  130. // -----------------------------------------------------------------------------
  131. HRESULT HrMonUninit(void);        // RETURNS: HRESULT
  132.  
  133. //$--HrMonCollectNDRStats----------------------------------------------------
  134. //  Call this after processing an NDR.
  135. // -----------------------------------------------------------------------------
  136. HRESULT HrMonCollectNDRStats(        // RETURNS: HRESULT
  137.     IN DWORD cNDRs,                        // number of NDR's processed
  138.     IN DIRECTIONTYPE dir);                // direction of NDR's
  139.  
  140. //$--HrMonCollectMessageXferStats-------------------------------------
  141. //  Call this after transferring a message.
  142. // -----------------------------------------------------------------------------
  143. HRESULT HrMonCollectMessageXferStats( // RETURNS: HRESULT
  144.     IN DWORD cMessages,                 // number of messages transferred
  145.     IN DWORD cBytes,                     // number of bytes transferred
  146.     IN DIRECTIONTYPE dir);                // direction of message transfer
  147.  
  148. //$--HrMonCollectAssociationStats--------------------------------------------
  149. //  Call this after making or breaking an association, or to set a new total 
  150. //  number of associations.
  151. // -----------------------------------------------------------------------------
  152. HRESULT HrMonCollectAssociationStats( // RETURNS: HRESULT
  153.     IN BOOL fSetNewTotal,                // if TRUE, iAssociations becomes 
  154.                                         // the new total of associations.
  155.                                         // if FALSE, iAssociations is added 
  156.                                         // to the number of associations.
  157.  
  158.     IN LONG cAssociations);                // number of associations to add to
  159.                                         // total (can be negative), or new 
  160.                                         // total if fSetNewTotal == TRUE
  161.  
  162. //$--HrMonLockCounters------------------------------------------------------
  163. //  Locks the block of counters against access by other threads/processes.
  164. //  This should be called before accessing a user defined counter.
  165. // -----------------------------------------------------------------------------
  166. HRESULT HrMonLockCounters(void);    // RETURNS: HRESULT
  167.  
  168. //$--HrMonUnlockCounters----------------------------------------------------
  169. //  Unlocks the block of counters to allow access by other threads/processes.
  170. //  This should be called after accessing a user defined counter.
  171. // -----------------------------------------------------------------------------
  172. HRESULT HrMonUnlockCounters(void);    // RETURNS: HRESULT
  173.  
  174. #ifdef __cplusplus
  175. }
  176. #endif
  177.  
  178. #pragma option pop /*P_O_Pop*/
  179. #endif
  180.