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.

46 lines
1.4 KiB

  1. {$IFNDEF PROFILER_DISABLE}
  2. {.$DEFINE PROFILER_ENABLE}
  3. {.$DEFINE PROFILER_DISABLE_NAMES}
  4. {$ENDIF}
  5. (******************************************************************************
  6. Usage:
  7. Somewhere, use this:
  8. {.$DEFINE PROFILER_DISABLE} //use this to disable profiling for specific unit
  9. {$I uutlEmbeddedProfiler.inc}
  10. (also add wherever that file is to the project's include search path -Fi,
  11. unit search path is not enough)
  12. In Uses-List: SysUtils, ... __PROFUSE;
  13. (notice: no comma before __PROFUSE)
  14. In Code:
  15. begin
  16. __PROFENTER
  17. ... code here ...
  18. __PROFLEAVE
  19. end;
  20. ******************************************************************************)
  21. {$macro on}
  22. {$IFDEF PROFILER_ENABLE}
  23. {$DEFINE __PROFENTER:=uutlEmbeddedProfiler.ProfilerEnterProc(Get_pc_addr); try}
  24. {$DEFINE __PROFLEAVE:=finally uutlEmbeddedProfiler.ProfilerLeaveProc; end;}
  25. {$DEFINE __PROFUSE:=, uutlEmbeddedProfiler}
  26. {$DEFINE __PROFUSEPREV:=uutlEmbeddedProfiler, }
  27. {$IFNDEF PROFILER_DISABLE_NAMES}
  28. {$DEFINE __PROFSETNAME:=uutlEmbeddedProfiler.ProfilerEnterProc(Get_pc_addr,}
  29. {$DEFINE __PROFENTERNAME:=); try}
  30. {$ELSE}
  31. {$DEFINE __PROFSETNAME:=//}
  32. {$DEFINE __PROFENTERNAME:=__PROFENTER}
  33. {$ENDIF}
  34. {$ELSE}
  35. {$DEFINE __PROFENTER:=}
  36. {$DEFINE __PROFLEAVE:=}
  37. {$DEFINE __PROFUSE:=}
  38. {$DEFINE __PROFUSEPREV:=}
  39. {$DEFINE __PROFSETNAME:=//}
  40. {$DEFINE __PROFENTERNAME:=}
  41. {$ENDIF}