{$IFNDEF PROFILER_DISABLE} {.$DEFINE PROFILER_ENABLE} {.$DEFINE PROFILER_DISABLE_NAMES} {$ENDIF} (****************************************************************************** Usage: Somewhere, use this: {.$DEFINE PROFILER_DISABLE} //use this to disable profiling for specific unit {$I uutlEmbeddedProfiler.inc} (also add wherever that file is to the project's include search path -Fi, unit search path is not enough) In Uses-List: SysUtils, ... __PROFUSE; (notice: no comma before __PROFUSE) In Code: begin __PROFENTER ... code here ... __PROFLEAVE end; ******************************************************************************) {$macro on} {$IFDEF PROFILER_ENABLE} {$DEFINE __PROFENTER:=uutlEmbeddedProfiler.ProfilerEnterProc(Get_pc_addr); try} {$DEFINE __PROFLEAVE:=finally uutlEmbeddedProfiler.ProfilerLeaveProc; end;} {$DEFINE __PROFUSE:=, uutlEmbeddedProfiler} {$DEFINE __PROFUSEPREV:=uutlEmbeddedProfiler, } {$IFNDEF PROFILER_DISABLE_NAMES} {$DEFINE __PROFSETNAME:=uutlEmbeddedProfiler.ProfilerEnterProc(Get_pc_addr,} {$DEFINE __PROFENTERNAME:=); try} {$ELSE} {$DEFINE __PROFSETNAME:=//} {$DEFINE __PROFENTERNAME:=__PROFENTER} {$ENDIF} {$ELSE} {$DEFINE __PROFENTER:=} {$DEFINE __PROFLEAVE:=} {$DEFINE __PROFUSE:=} {$DEFINE __PROFUSEPREV:=} {$DEFINE __PROFSETNAME:=//} {$DEFINE __PROFENTERNAME:=} {$ENDIF}