diff options
author | Niels Möller <nisse@lysator.liu.se> | 2010-02-15 10:03:54 +0100 |
---|---|---|
committer | Niels Möller <nisse@lysator.liu.se> | 2010-02-15 10:03:54 +0100 |
commit | 4f4d385d275a00d95f693326c6015e1d48b4d864 (patch) | |
tree | 813d6342f913764b687cb61f95dc29ebb85cfd42 /tune/time.c | |
parent | 5534b38e33a3fc804ac1dfff33851055d3fa9c18 (diff) | |
download | gmp-4f4d385d275a00d95f693326c6015e1d48b4d864.tar.gz |
Deleted hack to avoid the cycle counter on linux.
Diffstat (limited to 'tune/time.c')
-rw-r--r-- | tune/time.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/tune/time.c b/tune/time.c index 0376def3e..320a47d04 100644 --- a/tune/time.c +++ b/tune/time.c @@ -456,15 +456,19 @@ cycles_works_p (void) if (result != -1) goto done; -#ifdef __linux__ - /* On linux, the cycle counter is not saved and restored over + /* FIXME: On linux, the cycle counter is not saved and restored over * context switches, making it almost useless for precise cputime - * measurements. It's' better to use clock_gettime, which seems to - * have reasonable accuracy (tested on x86_32, linux-2.6.26, - * glibc-2.7). */ - result = 0; - goto done; -#endif + * measurements. When available, it's better to use clock_gettime, + * which seems to have reasonable accuracy (tested on x86_32, + * linux-2.6.26, glibc-2.7). However, there are also some linux + * systems where clock_gettime is broken in one way or the other, + * like CLOCK_PROCESS_CPUTIME_ID not implemented (easy case) or + * kind-of implemented but broken (needs code to detect that), and + * on those systems a wall-clock cycle counter is the least bad + * fallback. + * + * So we need some code to disable the cycle counter on some but not + * all linux systems. */ #ifdef SIGILL { RETSIGTYPE (*old_handler) __GMP_PROTO ((int)); |