diff options
author | Dave Jones <davej@redhat.com> | 2005-08-27 02:31:21 -0400 |
---|---|---|
committer | Dave Jones <davej@redhat.com> | 2005-08-27 02:31:21 -0400 |
commit | 89c34266b47fc22e9c1461465b72080d98d8942b (patch) | |
tree | 53561bb03d28f52bc9f21e17e2eb7341e53a7c4a /bench | |
parent | 1c2742122bd5eb2760d96e0afa033a801b68fe14 (diff) |
Remove support for non Linux OS's.
The ifdefs really were ugly, and I've not heard a report from
a single user of this code since it was merged.
Diffstat (limited to 'bench')
-rw-r--r-- | bench/MHz.c | 39 |
1 files changed, 0 insertions, 39 deletions
diff --git a/bench/MHz.c b/bench/MHz.c index 7bc4066..7312601 100644 --- a/bench/MHz.c +++ b/bench/MHz.c @@ -15,12 +15,6 @@ #include <string.h> #include <unistd.h> -#ifdef __WIN32__ -#include <windows.h> - -__inline__ unsigned long timer_init(); -#endif /* __WIN32__ */ - #include "../x86info.h" __inline__ unsigned long long int rdtsc() @@ -32,22 +26,13 @@ __inline__ unsigned long long int rdtsc() void estimate_MHz(struct cpudata *cpu) { -#ifndef __WIN32__ struct timezone tz; struct timeval tvstart, tvstop; -#endif /* __WIN32__ */ unsigned long long int cycles[2]; /* gotta be 64 bit */ unsigned long microseconds; /* total time taken */ unsigned long eax, ebx, ecx, edx; unsigned long freq = 1; -#ifdef __WIN32__ - LARGE_INTEGER lfreq; - - QueryPerformanceFrequency(&lfreq); - freq = lfreq.LowPart/1000000; -#endif /* __WIN32__ */ - /* Make sure we have a TSC (and hence RDTSC) */ cpuid (cpu->number, 1, &eax, &ebx, &ecx, &edx); if ((edx & (1<<4))==0) { @@ -56,34 +41,22 @@ void estimate_MHz(struct cpudata *cpu) return; } -#ifdef __WIN32__ - timer_init(); - cycles[0] = rdtsc(); - microseconds = timer_init(); -#else memset(&tz, 0, sizeof(tz)); /* get this function in cached memory */ gettimeofday(&tvstart, &tz); cycles[0] = rdtsc(); gettimeofday(&tvstart, &tz); -#endif /* __WIN32__ */ /* we don't trust that this is any specific length of time */ usleep(250000); -#ifdef __WIN32__ - timer_init(); - cycles[1] = rdtsc(); - microseconds = timer_init() - microseconds; -#else gettimeofday(&tvstop, &tz); cycles[1] = rdtsc(); gettimeofday(&tvstop, &tz); microseconds = ((tvstop.tv_sec-tvstart.tv_sec)*1000000) + (tvstop.tv_usec-tvstart.tv_usec); -#endif /* __WIN32__ */ cpu->MHz = (int) (cycles[1]-cycles[0]) / (microseconds/freq); @@ -92,17 +65,5 @@ void estimate_MHz(struct cpudata *cpu) cpu->MHz = ((cpu->MHz / 50) * 50) + 50; else cpu->MHz = ((cpu->MHz / 50) * 50); - -} - -#ifdef __WIN32__ -__inline__ unsigned long timer_init() -{ - LARGE_INTEGER lcnt; - - QueryPerformanceCounter(&lcnt); - - return lcnt.LowPart; } -#endif /* __WIN32__ */ |