summaryrefslogtreecommitdiff
path: root/tune/README
diff options
context:
space:
mode:
authorNiels Möller <nisse@lysator.liu.se>2010-01-20 09:21:25 +0100
committerNiels Möller <nisse@lysator.liu.se>2010-01-20 09:21:25 +0100
commiteeee5693a1d2a6ea175c008d26c5e5883b3bb9fb (patch)
tree9b87ea58d87c0da7ec2fe6bf578b36babb3880a1 /tune/README
parent5939f25f8abd1a53b5ca3e7b0019390ac0118cc7 (diff)
downloadgmp-eeee5693a1d2a6ea175c008d26c5e5883b3bb9fb.tar.gz
Notes on linux timing
Diffstat (limited to 'tune/README')
-rw-r--r--tune/README21
1 files changed, 21 insertions, 0 deletions
diff --git a/tune/README b/tune/README
index 9b06953ca..41f88fbf2 100644
--- a/tune/README
+++ b/tune/README
@@ -73,6 +73,27 @@ SCO OpenUNIX 8 /etc/hw
running the speed program repeatedly then set a GMP_CPU_FREQUENCY
environment variable (see TIME BASE section below).
+Timing on GNU/Linux
+
+ On Linux, timing currently uses the cycle counter. This is unreliable,
+ since the counter is not saved and restored at context switches (unlike
+ FreeBSD and Solaris where the cycle counter is "virtualized").
+
+ Using the clock_gettime method with CLOCK_PROCESS_CPUTIME_ID (posix) or
+ CLOCK_VIRTUAL (BSD) should be more reliable. To get clock_gettime
+ with glibc, one has to link with -lrt (which also drags in the pthreads
+ threading library). configure.in must be hacked to detect this and
+ arrange proper linking. Something like
+
+ old_LIBS="$LIBS"
+ AC_SEARCH_LIBS(clock_gettime, rt, [AC_DEFINE(HAVE_CLOCK_GETTIME)])
+ TUNE_LIBS="$LIBS"
+ LIBS="$old_LIBS"
+
+ AC_SUBST(TUNE_LIBS)
+
+ might work.
+
Low resolution timebase
Parameter tuning can be very time consuming if the only timebase