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.

75 lines
1.9 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 1995.
  5. //
  6. // File: sectrace.hxx
  7. //
  8. // Contents:
  9. //
  10. // History:
  11. //
  12. /// Notes: Use in conjuction with dsysdbg.h
  13. //
  14. //--------------------------------------------------------------------------
  15. #ifndef __SECTRACE_HXX__
  16. #define __SECTRACE_HXX__
  17. #if DBG
  18. #include <dsysdbg.h>
  19. #define HEAP_CHECK_ON_ENTER 0x1
  20. #define HEAP_CHECK_ON_EXIT 0x2
  21. //
  22. // Use this macro INSTEAD of DECLARE_DEBUG2 if you also want additional
  23. // heap checking and possibly future performance measurements. All this
  24. // does is call DECLARE_DEBUG2 to declare the variables and functions
  25. // for debugging and then it creates a class based on your component.
  26. // This class's constructors and destructors are used to do heap checking
  27. // and performance measuring on enter and exit of routine.
  28. //
  29. #define DECLARE_HEAP_DEBUG(comp) \
  30. DECLARE_DEBUG2(comp); \
  31. class comp##CHeapTrace \
  32. {\
  33. private:\
  34. unsigned long _ulFlags;\
  35. char * _pszName;\
  36. public:\
  37. comp##CHeapTrace(\
  38. unsigned long ulFlags, \
  39. char * pszName);\
  40. ~comp##CHeapTrace();\
  41. };\
  42. \
  43. inline comp##CHeapTrace::comp##CHeapTrace(\
  44. unsigned long ulFlags, \
  45. char * pszName)\
  46. : _ulFlags(ulFlags), _pszName(pszName)\
  47. {\
  48. comp##DebugPrint(_ulFlags, "Entering %s\n", _pszName);\
  49. }\
  50. \
  51. inline comp##CHeapTrace::~comp##CHeapTrace()\
  52. {\
  53. comp##DebugPrint(_ulFlags, "Exiting %s\n", _pszName);\
  54. }
  55. #define TRACE(comp,RoutineName,ulFlags) \
  56. comp##CHeapTrace _(ulFlags,#RoutineName);
  57. #else // ! DBG
  58. #define TRACE(ClassName,MethodName,ulFlags)
  59. #endif // if DBG
  60. #endif // __SECTRACE_HXX__