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.

95 lines
2.4 KiB

  1. /*++ BUILD Version: 0001 // Increment this if a change has global effects
  2. Copyright (c) 1992 Microsoft Corporation
  3. Module Name:
  4. perfutil.h
  5. Abstract:
  6. This file supports routines used to parse and
  7. create Performance Monitor Data Structures.
  8. It actually supports Performance Object types with
  9. multiple instances
  10. Author:
  11. Russ Blake 7/30/92
  12. Revision History:
  13. --*/
  14. #ifndef _PERFUTIL_H_
  15. #define _PERFUTIL_H_
  16. // enable this define to log process heap data to the event log
  17. #ifdef PROBE_HEAP_USAGE
  18. #undef PROBE_HEAP_USAGE
  19. #endif
  20. //
  21. // Utility macro. This is used to reserve a DWORD multiple of
  22. // bytes for Unicode strings embedded in the definitional data,
  23. // viz., object instance names.
  24. //
  25. #define DWORD_MULTIPLE(x) (((x+sizeof(DWORD)-1)/sizeof(DWORD))*sizeof(DWORD))
  26. // (assumes dword is 4 bytes long and pointer is a dword in size)
  27. #define ALIGN_ON_DWORD(x) ((VOID *)( ((DWORD) x & 0x00000003) ? ( ((DWORD) x & 0xFFFFFFFC) + 4 ) : ( (DWORD) x ) ))
  28. extern WCHAR GLOBAL_STRING[]; // Global command (get all local ctrs)
  29. extern WCHAR FOREIGN_STRING[]; // get data from foreign computers
  30. extern WCHAR COSTLY_STRING[];
  31. extern WCHAR NULL_STRING[];
  32. #define QUERY_GLOBAL 1
  33. #define QUERY_ITEMS 2
  34. #define QUERY_FOREIGN 3
  35. #define QUERY_COSTLY 4
  36. //
  37. // The definition of the only routine of perfutil.c, It builds part of a
  38. // performance data instance (PERF_INSTANCE_DEFINITION) as described in
  39. // winperf.h
  40. //
  41. HANDLE MonOpenEventLog ();
  42. VOID MonCloseEventLog ();
  43. LONG AddSrcToReg ();
  44. DWORD GetQueryType (IN LPWSTR);
  45. BOOL IsNumberInUnicodeList (DWORD, LPWSTR);
  46. typedef struct _LOCAL_HEAP_INFO_BLOCK {
  47. DWORD AllocatedEntries;
  48. DWORD AllocatedBytes;
  49. DWORD FreeEntries;
  50. DWORD FreeBytes;
  51. } LOCAL_HEAP_INFO, *PLOCAL_HEAP_INFO;
  52. //
  53. // Memory Probe macro
  54. //
  55. #ifdef PROBE_HEAP_USAGE
  56. #define HEAP_PROBE() { \
  57. DWORD dwHeapStatus[5]; \
  58. NTSTATUS CallStatus; \
  59. dwHeapStatus[4] = __LINE__; \
  60. if (!(CallStatus = memprobe (dwHeapStatus, 16L, NULL))) { \
  61. REPORT_INFORMATION_DATA (TCP_HEAP_STATUS, LOG_DEBUG, \
  62. &dwHeapStatus, sizeof(dwHeapStatus)); \
  63. } else { \
  64. REPORT_ERROR_DATA (TCP_HEAP_STATUS_ERROR, LOG_DEBUG, \
  65. &CallStatus, sizeof (DWORD)); \
  66. } \
  67. }
  68. #else
  69. #define HEAP_PROBE() ;
  70. #endif
  71. #endif //_PERFUTIL_H_