On Wed, 28 Jan 2004, Robert Watson wrote: > printf("%d.%09lu for %d iterations\n", ts_end.tv_sec, > ts_end.tv_nsec, NUM); > printf("%d.%09lu per/iteration\n", ts_end.tv_sec / NUM, > ts_end.tv_nsec / NUM); Having posted this, I should point out that this suffers an error if you get above a second total measurement time (which I generally don't do to avoid being preempted). Something like the following would work slightly better: ts_end.tv_sec *= 1000000000 / count; printf("0.%09lu per/iteration\n", ts_end.tv_sec + ts_end.tv_nsec / count); Robert N M Watson FreeBSD Core Team, TrustedBSD Projects robert_at_fledge.watson.org Senior Research Scientist, McAfee ResearchReceived on Wed Jan 28 2004 - 11:59:18 UTC
This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:40 UTC