[OT] Money for nothing, and your bit flips for free?
nick at leippe.com
Wed Feb 7 15:47:51 MST 2007
clock() returns a clock_t, which isn't a unix timestamp (seconds) nor
necessarily one tick per cpu clock cycle.
difftime() expects a time_t, which is a unix timestamp. There's no guarantee
that it will compute the correct difference for two clock_t values (which can
suffer from wraparound).
Even if it were one tick per cpu clock cycle, remember also that the ipc of
some instructions often exceeds 1 on modern cpus. With loop unrolling on a
good optimizing compiler targeting an OO cpu with multiple pipelines, several
operations can sometimes be combined further increasing the effective ipc.
More information about the PLUG