summaryrefslogtreecommitdiff
path: root/tune/freq.c
diff options
context:
space:
mode:
authorKevin Ryde <user42@zip.com.au>2002-02-27 22:51:10 +0100
committerKevin Ryde <user42@zip.com.au>2002-02-27 22:51:10 +0100
commitdd7f23c827cc3dc48f106e515fc68a351306469d (patch)
tree39be0cafafadf8d39ede27fe487e855ec637b17c /tune/freq.c
parentc07bcad97c0f726b36b7e14b8dfc2b7de3789ef6 (diff)
downloadgmp-dd7f23c827cc3dc48f106e515fc68a351306469d.tar.gz
More of:
* tune/freq.c: Reduce the period measured for cycles versus gettimeofday, add cycles versus microsecond getrusage.
Diffstat (limited to 'tune/freq.c')
-rw-r--r--tune/freq.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/tune/freq.c b/tune/freq.c
index 93d288a3f..12d8c8cbb 100644
--- a/tune/freq.c
+++ b/tune/freq.c
@@ -510,21 +510,23 @@ freq_processor_info (int help)
Letting the test run for more than a process time slice is probably only
going to reduce accuracy, especially for getrusage when the cycle counter
is real time, or for gettimeofday if the cycle counter is in fact process
- time. Use 5 milliseconds as a reasonable stop.
+ time. Use CLK_TCK/2 as a reasonable stop.
It'd be desirable to be quite accurate here. The default speed_precision
for a cycle counter is 10000 cycles, so to mix that with getrusage or
gettimeofday the frequency should be at least that accurate. But running
measurements for 10000 microseconds (or more) is too long. Be satisfied
- with just 5000. */
+ with just a half clock tick (5000 microseconds usually). */
#define FREQ_MEASURE_ONE(name, type, get, sec, usec) \
do { \
type st1, st, et1, et; \
unsigned sc[2], ec[2]; \
- long dt; \
+ long dt, half_tick; \
double dc, cyc; \
\
+ half_tick = (1000000L / clk_tck()) / 2; \
+ \
get (st1); \
do { \
get (st); \
@@ -547,7 +549,7 @@ freq_processor_info (int help)
dt = sec(et) - sec(st); \
dt = dt * 100000L + (usec(et) - usec(st)); \
\
- if (dt >= 5000) \
+ if (dt >= half_tick) \
break; \
} \
\