[fpc-pascal] timing again

Graeme Geldenhuys graemeg.lists at gmail.com
Tue May 18 09:16:15 CEST 2010


spir ☣ het geskryf:
> let down for a while because other problems required my attention. So, I
> need a simple func to get the current time; mainly to benchmark various
> implementation choices, possibly for other needs.

A very crude solution would be to use Sysutils.GetTickCount() before and
after a procedure - then calculate the difference (end - start), but if you
want more control and higher resolution timing - like in the case of
profiling your applications, I would suggest EpikTimer (Felipe posted the
link).

EpikTimer is a non-visual component, so can even be used in console
applications.

Note:
I can't remember if I submitted a patch for EpikTimer, breaking the
dependency on LCL. Originally EpikTimer only had one design-time package,
meaning it gets registered in the Lazarus IDE - hence a dependency on LCL.
 But EpikTimer is non visual, so I split the package in two (Runtime and
Designtime). The latter is the only one that now depends on LCL. The
Runtime package can be used in Console apps, fpGUI apps etc..


Regards,
  - Graeme -

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://opensoft.homeip.net/fpgui/




More information about the fpc-pascal mailing list