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.

95 lines
2.3 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. DWORD GetQueryType (IN LPWSTR);
  44. BOOL IsNumberInUnicodeList (DWORD, LPWSTR);
  45. typedef struct _LOCAL_HEAP_INFO_BLOCK {
  46. DWORD AllocatedEntries;
  47. DWORD AllocatedBytes;
  48. DWORD FreeEntries;
  49. DWORD FreeBytes;
  50. } LOCAL_HEAP_INFO, *PLOCAL_HEAP_INFO;
  51. //
  52. // Memory Probe macro
  53. //
  54. #ifdef PROBE_HEAP_USAGE
  55. #define HEAP_PROBE() { \
  56. DWORD dwHeapStatus[5]; \
  57. NTSTATUS CallStatus; \
  58. dwHeapStatus[4] = __LINE__; \
  59. if (!(CallStatus = memprobe (dwHeapStatus, 16L, NULL))) { \
  60. REPORT_INFORMATION_DATA (TCP_HEAP_STATUS, LOG_DEBUG, \
  61. &dwHeapStatus, sizeof(dwHeapStatus)); \
  62. } else { \
  63. REPORT_ERROR_DATA (TCP_HEAP_STATUS_ERROR, LOG_DEBUG, \
  64. &CallStatus, sizeof (DWORD)); \
  65. } \
  66. }
  67. #else
  68. #define HEAP_PROBE() ;
  69. #endif
  70. #endif //_PERFUTIL_H_
  71.