|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T s
Length: 1927 (0x787) Types: TextFile Names: »saxer8.c«
└─⟦db229ac7e⟧ Bits:30007240 EUUGD20: SSBA 1.2 / AFW Benchmarks └─⟦this⟧ »EUUGD20/AFUU-ssba1.21/ssba1.21F/saxer/saxer8.c«
#include <sys/types.h> #include <sys/times.h> #define DELAY 300 long ticks, hz; long starttime, endtime; static int nbsec; struct tms ts; extern long time(); #ifdef VMUNIX /* BSD only */ #include "../install/signal.h" #include <sys/time.h> #include <sys/resource.h> #include <setjmp.h> struct rlimit rlp; int cpu_before; jmp_buf jmpbuf; int sigxcpu(); long t1; int rtmsec() /* Real time in milliseconds. (BSD) */ { static long epoch; if (epoch == 0 ) { printf("verification de la granularite du temps ...\n"); printf("attendre %d secondes\n", DELAY); signal(SIGXCPU, sigxcpu); getrlimit(RLIMIT_CPU, &rlp); cpu_before = rlp.rlim_cur; rlp.rlim_cur = DELAY; setrlimit(RLIMIT_CPU, &rlp); times(&ts); starttime=time( (long *) 0); t1 = ts.tms_utime; if (setjmp(jmpbuf) == 0) for (;;) ; } times(&ts); epoch = ts.tms_utime; return (1000*epoch); } sigxcpu() { times(&ts); endtime=time( (long *) 0); rlp.rlim_cur = cpu_before; setrlimit(RLIMIT_CPU, &rlp); ticks = ts.tms_utime - t1; hz = (ticks/DELAY + 5)/10 * 10; nbsec=(endtime-starttime); printf("temps d'attente mesure : %d secondes\n", nbsec); printf("la granularite du temps semble de 1/%ld sec\n",hz); longjmp(jmpbuf, 1); } #else /* SYS5 */ extern long times(); extern unsigned sleep(); int rtmsec() /* Real time in milliseconds. (System III)*/ { static long epoch; time_t starttime2, endtime2; if (epoch == 0 ) { printf("verification de la granularite du temps ...\n"); printf("attendre %d secondes\n", DELAY); starttime=time( (long *) 0); starttime2=times(&ts); sleep(DELAY); endtime=time( (long *) 0); endtime2=times(&ts); nbsec=(endtime-starttime); hz=((float)(endtime2-starttime2)/(float)(endtime-starttime))+.5; printf("temps d'attente mesure : %d secondes\n", nbsec); printf("la granularite du temps semble de 1/%d sec\n",hz); } epoch = times(&ts); return (1000*epoch / hz ); } #endif