diff options
author | Mario Sergio Fujikawa Ferreira <lioux@FreeBSD.org> | 2003-01-02 05:46:09 +0000 |
---|---|---|
committer | Mario Sergio Fujikawa Ferreira <lioux@FreeBSD.org> | 2003-01-02 05:46:09 +0000 |
commit | a5fcdc400d5009567c30d38b793eca35c4ba325e (patch) | |
tree | e6d46a3460232052995cdcd782cb3c5962bbd21b /sysutils/clockspeed/files | |
parent | Prevent .la files from being installed. PLIST change, so (diff) |
o Remove ONLY_FOR_ARCHS limitation by adding timing support other
than RDTSC registers from Pentium. After a reminder by Garrett
Wollman <wollman@FreeBSD.org> [1] that FreeBSD has a gethrtime()
similar function, added experimental support for FreeBSD
clock_gettime(2) which should work in all FreeBSD supported ARCHes
o Add notes in both DESCR and PKGMESSAGE that there might be precision
differences since this is experimental code
Reviewed by: portmgr (silence/no objections)
Submitted by: wollman [1]
Notes
Notes:
svn path=/head/; revision=72165
Diffstat (limited to 'sysutils/clockspeed/files')
-rw-r--r-- | sysutils/clockspeed/files/patch-aa | 32 | ||||
-rw-r--r-- | sysutils/clockspeed/files/patch-ac | 22 | ||||
-rw-r--r-- | sysutils/clockspeed/files/patch-timing.h | 31 | ||||
-rw-r--r-- | sysutils/clockspeed/files/tryclock_gettime.c | 8 |
4 files changed, 84 insertions, 9 deletions
diff --git a/sysutils/clockspeed/files/patch-aa b/sysutils/clockspeed/files/patch-aa index 4483dda53433..45f6287d1e3c 100644 --- a/sysutils/clockspeed/files/patch-aa +++ b/sysutils/clockspeed/files/patch-aa @@ -1,6 +1,28 @@ ---- Makefile.orig Fri Jun 16 22:21:58 2000 -+++ Makefile Fri Jun 16 22:23:28 2000 -@@ -293,10 +293,10 @@ +--- Makefile.orig Tue Oct 13 15:37:28 1998 ++++ Makefile Sat Dec 21 14:50:57 2002 +@@ -74,6 +74,7 @@ + + clockspeed.o: \ + compile clockspeed.c readwrite.h exit.h select.h scan.h fmt.h str.h \ ++hasclock_gettime.h \ + fifo.h open.h error.h auto_home.h timing.h hasrdtsc.h hasgethr.h + ./compile clockspeed.c + +@@ -137,6 +138,13 @@ + ./makelib fs.a fmt_str.o fmt_uint.o fmt_uint0.o \ + fmt_ulong.o scan_ulong.o + ++hasclock_gettime.h: \ ++tryclock_gettime.c compile load ++ ( ( ./compile tryclock_gettime.c && ./load tryclock_gettime ) >/dev/null \ ++ 2>&1 \ ++ && echo \#define HASCLOCK_GETTIME 1 || exit 0 ) > hasclock_gettime.h ++ rm -f tryclock_gettime.o ++ + hasgethr.h: \ + trygethr.c compile load + ( ( ./compile trygethr.c && ./load trygethr ) >/dev/null \ +@@ -293,10 +301,10 @@ chmod 400 shar sntpclock: \ @@ -14,7 +36,7 @@ sntpclock.0: \ sntpclock.1 -@@ -406,10 +406,10 @@ +@@ -406,10 +414,10 @@ ./compile taia_unpack.c taiclock: \ @@ -28,7 +50,7 @@ taiclock.0: \ taiclock.1 -@@ -421,10 +421,10 @@ +@@ -421,10 +429,10 @@ ./compile taiclock.c taiclockd: \ diff --git a/sysutils/clockspeed/files/patch-ac b/sysutils/clockspeed/files/patch-ac index 6f94e6d95a0d..d28fb7c52782 100644 --- a/sysutils/clockspeed/files/patch-ac +++ b/sysutils/clockspeed/files/patch-ac @@ -1,6 +1,20 @@ --- clockspeed.c.orig Tue Oct 13 15:37:28 1998 -+++ clockspeed.c Mon Nov 20 09:06:34 2000 -@@ -83,7 +83,7 @@ ++++ clockspeed.c Sat Dec 21 15:00:32 2002 +@@ -14,11 +14,13 @@ + + #ifndef HASRDTSC + #ifndef HASGETHRTIME ++#ifndef HASCLOCK_GETTIME + + Error! Need an unadjusted hardware clock. + + #endif + #endif ++#endif + + struct point { + timing lowlevel; +@@ -83,7 +85,7 @@ if (deriv <= 0) return; if (deriv > 200000000) return; /* 5Hz ticks? be serious */ @@ -9,7 +23,7 @@ if (fd == -1) return; buf[0] = 0; -@@ -119,7 +119,7 @@ +@@ -119,7 +121,7 @@ if (fsync(fd) == -1) { close(fd); return; } if (close(fd) == -1) return; /* NFS stupidity */ @@ -18,7 +32,7 @@ } void main() -@@ -136,16 +136,16 @@ +@@ -136,16 +138,16 @@ if (chdir(auto_home) == -1) _exit(1); umask(033); diff --git a/sysutils/clockspeed/files/patch-timing.h b/sysutils/clockspeed/files/patch-timing.h new file mode 100644 index 000000000000..dea14a779970 --- /dev/null +++ b/sysutils/clockspeed/files/patch-timing.h @@ -0,0 +1,31 @@ +--- timing.h.orig Tue Oct 13 15:37:28 1998 ++++ timing.h Wed Dec 25 17:20:03 2002 +@@ -3,6 +3,7 @@ + + #include "hasrdtsc.h" + #include "hasgethr.h" ++#include "hasclock_gettime.h" + #include <sys/types.h> + #include <sys/time.h> + +@@ -25,11 +26,20 @@ + #define timing_diff(x,y) ((double) ((x)->t - (y)->t)) + + #else ++#ifdef HASCLOCK_GETTIME ++ ++typedef struct { struct timespec t; } timing; ++#define timing_now(x) ((void) clock_gettime(CLOCK_REALTIME, &((x)->t))) ++/* in seconds */ ++#define timing_diff(x,y) (((x)->t.tv_sec - (double) (y)->t.tv_sec) + (4294967296.0*((x)->t.tv_nsec - (double) (y)->t.tv_nsec)))/1e9) ++ ++#else + + #define timing timing_basic + #define timing_now timing_basic_now + #define timing_diff timing_basic_diff + ++#endif + #endif + #endif + diff --git a/sysutils/clockspeed/files/tryclock_gettime.c b/sysutils/clockspeed/files/tryclock_gettime.c new file mode 100644 index 000000000000..0e5bd1c445c5 --- /dev/null +++ b/sysutils/clockspeed/files/tryclock_gettime.c @@ -0,0 +1,8 @@ +#include <sys/time.h> + +main() +{ + struct timespec ts; + + (void) clock_gettime(CLOCK_REALTIME, &ts); +} |