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.

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