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.

106 lines
2.4 KiB

  1. /*
  2. * C A L P C . H
  3. *
  4. * PerfCounter data headers
  5. *
  6. * Copyright 1986-1997 Microsoft Corporation, All Rights Reserved
  7. */
  8. #ifndef _CALPC_H_
  9. #define _CALPC_H_
  10. #include <winperf.h>
  11. // Extensible Object definitions ---------------------------------------------
  12. //
  13. // Update the following sort of define when adding an object type.
  14. //
  15. #define NUM_PERF_OBJECT_TYPES 1
  16. typedef enum {
  17. PC_TOTALREQUESTS = 0,
  18. PC_NUMCURRENTREQUESTS,
  19. PC_NUMWORKERTHREADS,
  20. PC_NUMACTIVEWORKERTHREADS,
  21. PC_CURRENTLOCKS,
  22. PC_REQ_FORWARDS,
  23. PC_REQ_REDIRECTS,
  24. PC_EXCEPTIONS,
  25. CPC_COUNTERS
  26. } PERFCOUNTER;
  27. typedef enum {
  28. PCI_PERFMON = -1,
  29. PCI_TOTALS = 0,
  30. PCI_DAVFS,
  31. PCI_DAVOWS,
  32. PCI_DAVEX,
  33. CPC_INSTANCES
  34. } PERFCOUNTERINSTANCE;
  35. enum { CCH_MAX_INSTANCE_NAME = (sizeof(L"PERFMON") * sizeof(WCHAR)) };
  36. // Resource object type counter definitions.
  37. //
  38. // This is the counter structure presently returned by the performance DLL.
  39. //
  40. #pragma pack(4)
  41. typedef struct _PERFDLL_DATA_DEFINITION
  42. {
  43. PERF_OBJECT_TYPE potObjectType;
  44. PERF_COUNTER_DEFINITION rgpcdCounters[CPC_COUNTERS];
  45. } PERFDLL_DATA_DEFINITION;
  46. #pragma pack()
  47. // This is the block of data that corresponds to each instance of
  48. // the object. This structure will immediately follow the instance
  49. // definition data structure.
  50. //
  51. #pragma pack(4)
  52. typedef struct _PERFDLL_COUNTER_BLOCK
  53. {
  54. PERF_COUNTER_BLOCK pcbCounterBlock;
  55. LONG rgdwCounters[CPC_COUNTERS];
  56. LONG lActive;
  57. } PERFDLL_COUNTER_BLOCK, * PPERFDLL_COUNTER_BLOCK;
  58. #pragma pack()
  59. enum { CB_PERF_COUNTER_MEMORY = (sizeof(PERFDLL_COUNTER_BLOCK) * CPC_INSTANCES) };
  60. #ifdef __cplusplus
  61. extern "C" {
  62. #endif
  63. SCODE __cdecl ScOpenPerfCounters (PERFCOUNTERINSTANCE ipc);
  64. VOID __cdecl ClosePerfCounters (VOID);
  65. extern PERFDLL_DATA_DEFINITION g_PerfDllDataDefinition;
  66. extern PPERFDLL_COUNTER_BLOCK g_pcntrblk;
  67. extern LPVOID g_pvcntrblk;
  68. #ifdef __cplusplus
  69. }
  70. #endif
  71. #define PERFDLL_COUNTER_BLOCK_NAME L"CALIGULA_PERFORMANCE_DATA"
  72. #define PERFDLL_COUNTER_MUTEX_NAME L"CALIGULA_PERFORMANCE_DATA_MUTEX"
  73. __inline void IncrementPerfCounter(PERFCOUNTER _x)
  74. {
  75. InterlockedIncrement(&g_pcntrblk->rgdwCounters[_x]);
  76. }
  77. __inline void DecrementPerfCounter(PERFCOUNTER _x)
  78. {
  79. InterlockedDecrement(&g_pcntrblk->rgdwCounters[_x]);
  80. }
  81. __inline void ResetPerfCounter(PERFCOUNTER _x)
  82. {
  83. InterlockedExchange(&g_pcntrblk->rgdwCounters[_x], 0);
  84. }
  85. #endif // _CALPC_H_