The bugs are:
1) Determination of CYCLES_PER_USEC is a configuration
time action. Thus a package built on one machine but
executed on another could end up with an incorrect
2) gettimeofday(2) offers better precision compared
to times(3), at least on FreeBSD. The exact
frequency of the TSC is available using the
sysctl machdep.tsc_freq on FreeBSD and need not
be estimated as is being done in
3) The TSC's counting rate varies when the CPUs
speed changes (e.g., thermal throttling).
Using TSCs to determine "elapsed time" is
4) In current x86 implementations, TSCs on a
multi-processor system can get out of sync.
The values returned by two successive RDTSC
instructions are not guaranteed to be
monotonically increasing if there process switched
between CPUs in the interim.
See also: clocks(7).