From ae0ebd1e9326f2c863b23eadc2f0a24b1c007960 Mon Sep 17 00:00:00 2001 From: florian Date: Mon, 6 Jan 2020 14:48:38 +0000 Subject: [PATCH] * missing part of last commit git-svn-id: trunk@43870 - --- compiler/cprofile.pp | 35 ++++++++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/compiler/cprofile.pp b/compiler/cprofile.pp index d374c89683..6835ba440b 100644 --- a/compiler/cprofile.pp +++ b/compiler/cprofile.pp @@ -21,7 +21,27 @@ } unit cprofile; -{$define COMPILER_TIMINGS} +{ to use this profile intrastructure, the epiktimer sources must be available, the official repository is currently: + + https://github.com/graemeg/epiktimer.git + + clone it into the same base directory fpc is checked out/cloned, i.e. + /fpc/compiler + /epiktimer + + As the offical branch requires the use of the classes units, I recommend to + use my modified version of epiktimer which allows to disable the use of the classes unit, + this is done automatically by the compiler sources through a define. You can get my epiktimer source from + + https://github.com/FPK/epiktimer.git + + clone them into the same base directory fpc is checked out/cloned, i.e. + /fpc/compiler + /epiktimer + + (FK) +} +{ $define COMPILER_TIMINGS} {$i fpcdefs.inc} @@ -41,9 +61,17 @@ interface implementation {$ifndef COMPILER_TIMINGS} + procedure ResumeTimer(t : TCTimer); + begin + end; + + + procedure StopTimer; + begin + end; {$else COMPILER_TIMINGS} uses - epiktimer in '../../epiktimer/epiktimer.pas'; + cepiktimer; var currenttimer : TCTimer; @@ -73,9 +101,10 @@ initialization timers[t]:=TEpikTimer.Create; currenttimer:=ct_none; finalization + writeln(StdErr,'Compiler profiler results:'); timers[currenttimer].Stop; for t:=low(timers) to high(timers) do - writeln(StdErr,t,' ',timers[t].Elapsed); + writeln(StdErr,' ',t,' ',timers[t].Elapsed:0:9,' s'); for t:=low(timers) to high(timers) do timers[t].Free; {$endif COMPILER_TIMINGS}