From 4cba6fba71fbdf14beaf9c74a2a38cd481cfe595 Mon Sep 17 00:00:00 2001 From: diego Date: Wed, 13 Oct 2004 09:37:32 +0000 Subject: [PATCH] Remove CPU speed detection since - it is unreliable - it adds a constant 0.1s to startup time - it is hardly a feature for a movie player git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@13629 b3059339-0415-0410-9bf9-f77b7e298cf2 --- cpudetect.c | 46 ++++------------------------------------------ 1 file changed, 4 insertions(+), 42 deletions(-) diff --git a/cpudetect.c b/cpudetect.c index f6c3f36051..9e05236319 100644 --- a/cpudetect.c +++ b/cpudetect.c @@ -13,7 +13,6 @@ CpuCaps gCpuCaps; #include #include -#include "osdep/timer.h" #if defined (__NetBSD__) || defined(__OpenBSD__) #include @@ -210,29 +209,6 @@ void GetCpuCaps( CpuCaps *caps) } -static inline unsigned long long int rdtsc( void ) -{ - unsigned long long int retval; - __asm __volatile ("rdtsc":"=A"(retval)::"memory"); - return retval; -} - -/* Returns CPU clock in khz */ -static unsigned int GetCpuSpeed(void) -{ - unsigned long long int tscstart, tscstop; - unsigned int start, stop; - - tscstart = rdtsc(); - start = GetTimer(); - usec_sleep(50000); - stop = GetTimer(); - tscstop = rdtsc(); - - return((tscstop-tscstart)/((stop-start)/1000.0)); -} - - #define CPUID_EXTFAMILY ((regs2[0] >> 20)&0xFF) /* 27..20 */ #define CPUID_EXTMODEL ((regs2[0] >> 16)&0x0F) /* 19..16 */ #define CPUID_TYPE ((regs2[0] >> 12)&0x04) /* 13..12 */ @@ -242,37 +218,23 @@ static unsigned int GetCpuSpeed(void) char *GetCpuFriendlyName(unsigned int regs[], unsigned int regs2[]){ #include "cputable.h" /* get cpuname and cpuvendors */ - char vendor[17], cpuspeed[16]; + char vendor[17]; char *retname; - int i=0; + int i; if (NULL==(retname=(char*)malloc(256))) { mp_msg(MSGT_CPUDETECT,MSGL_FATAL,"Error: GetCpuFriendlyName() not enough memory\n"); exit(1); } - /* Measure CPU speed */ - if (gCpuCaps.hasTSC && (i = GetCpuSpeed()) > 0) { - if (i < 1000000) { - i += 50; /* for rounding */ - snprintf(cpuspeed,15, " %d.%d MHz", i/1000, (i/100)%10); - } else { - //i += 500; /* for rounding */ - snprintf(cpuspeed,15, " %d MHz", i/1000); - } - } else { /* No TSC Support */ - cpuspeed[0]='\0'; - } - - sprintf(vendor,"%.4s%.4s%.4s",(char*)(regs+1),(char*)(regs+3),(char*)(regs+2)); for(i=0; i