I've had some pretty good luck with http://wiki.lazarus.freepascal.org/EpikTimer and using its sampling routines. Granted its a bit out of date (2006) but still works like a charm.

- Jeremy