find out if the code goes unused

This commit is contained in:
albert 2002-10-07 03:37:48 +00:00
parent 74e87aa737
commit 0a20031787

View File

@ -120,15 +120,14 @@ int uptime(double *uptime_secs, double *idle_secs) {
unsigned long long Hertz; unsigned long long Hertz;
static void init_Hertz_value_old(void){ static void old_Hertz_hack(void){
unsigned long long user_j, nice_j, sys_j, other_j; /* jiffies (clock ticks) */ unsigned long long user_j, nice_j, sys_j, other_j; /* jiffies (clock ticks) */
double up_1, up_2, seconds; double up_1, up_2, seconds;
unsigned long long jiffies; unsigned long long jiffies;
unsigned h; unsigned h;
char *savelocale; char *savelocale;
smp_num_cpus = sysconf(_SC_NPROCESSORS_CONF); fprintf(stderr, "ELF note not found - report to albert@users.sf.net\n");
if(smp_num_cpus<1) smp_num_cpus=1;
savelocale = setlocale(LC_NUMERIC, NULL); savelocale = setlocale(LC_NUMERIC, NULL);
setlocale(LC_NUMERIC, "C"); setlocale(LC_NUMERIC, "C");
do{ do{
@ -191,12 +190,16 @@ static unsigned long find_elf_note(unsigned long findme){
return ret; return ret;
} }
static void init_Hertz_value(void) __attribute__((constructor)); static void init_libproc(void) __attribute__((constructor));
static void init_Hertz_value(void){ static void init_libproc(void){
Hertz = find_elf_note(AT_CLKTCK); /* ought to count CPUs in /proc/stat instead of relying
if(Hertz==42) init_Hertz_value_old(); * on glibc, which foolishly tries to parse /proc/cpuinfo
else smp_num_cpus = sysconf(_SC_NPROCESSORS_CONF); */
smp_num_cpus = sysconf(_SC_NPROCESSORS_CONF);
if(smp_num_cpus<1) smp_num_cpus=1; /* SPARC glibc is buggy */ if(smp_num_cpus<1) smp_num_cpus=1; /* SPARC glibc is buggy */
Hertz = find_elf_note(AT_CLKTCK);
if(Hertz==42) old_Hertz_hack();
} }
/*********************************************************************** /***********************************************************************