1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-09-29 21:49:07 +00:00

drop leftover freq_dynamic code in freebsd.c and openbsd.c

As the comment states, those functions were originally copied from
linux.c; in fact just the code which has been removed due to licensing
issues.
This commit is contained in:
Phil Sutter 2009-11-15 04:48:56 +01:00
parent e97b67aa20
commit 44f76f4876
3 changed files with 0 additions and 87 deletions

View File

@ -30,7 +30,6 @@ void update_running_processes(void);
void update_i8k(void);
void update_stuff(void);
char get_freq(char *, size_t, const char *, int, unsigned int);
void get_freq_dynamic(char *, size_t, const char *, int);
char get_voltage(char *, size_t, const char *, int, unsigned int); /* ptarjan */
void update_load_average(void);
void update_top(void);

View File

@ -508,49 +508,6 @@ void get_acpi_fan(char *p_client_buffer, size_t client_buffer_size)
}
}
/* rdtsc() and get_freq_dynamic() copied from linux.c */
#if defined(__i386) || defined(__x86_64)
__attribute__((gnu_inline)) inline unsigned long long int rdtsc(void)
{
unsigned long long int x;
__asm__ volatile(".byte 0x0f, 0x31":"=A" (x));
return x;
}
#endif
/* return system frequency in MHz (use divisor=1) or GHz (use divisor=1000) */
void get_freq_dynamic(char *p_client_buffer, size_t client_buffer_size,
const char *p_format, int divisor)
{
#if defined(__i386) || defined(__x86_64)
struct timezone tz;
struct timeval tvstart, tvstop;
unsigned long long cycles[2]; /* gotta be 64 bit */
unsigned int microseconds; /* total time taken */
memset(&tz, 0, sizeof(tz));
/* get this function in cached memory */
gettimeofday(&tvstart, &tz);
cycles[0] = rdtsc();
gettimeofday(&tvstart, &tz);
/* we don't trust that this is any specific length of time */
usleep(100);
cycles[1] = rdtsc();
gettimeofday(&tvstop, &tz);
microseconds = ((tvstop.tv_sec - tvstart.tv_sec) * 1000000) +
(tvstop.tv_usec - tvstart.tv_usec);
snprintf(p_client_buffer, client_buffer_size, p_format,
(float) ((cycles[1] - cycles[0]) / microseconds) / divisor);
#else
get_freq(p_client_buffer, client_buffer_size, p_format, divisor, 1);
#endif
}
/* void */
char get_freq(char *p_client_buffer, size_t client_buffer_size, const char *p_format,
int divisor, unsigned int cpu)

View File

@ -582,49 +582,6 @@ void get_obsd_product(char *buf, size_t client_buffer_size)
}
}
/* rdtsc() and get_freq_dynamic() copied from linux.c */
#if defined(__i386) || defined(__x86_64)
__inline__ unsigned long long int rdtsc()
{
unsigned long long int x;
__asm__ volatile(".byte 0x0f, 0x31":"=A" (x));
return x;
}
#endif
/* return system frequency in MHz (use divisor=1) or GHz (use divisor=1000) */
void get_freq_dynamic(char *p_client_buffer, size_t client_buffer_size,
const char *p_format, int divisor)
{
#if defined(__i386) || defined(__x86_64)
struct timezone tz;
struct timeval tvstart, tvstop;
unsigned long long cycles[2]; /* gotta be 64 bit */
unsigned int microseconds; /* total time taken */
memset(&tz, 0, sizeof(tz));
/* get this function in cached memory */
gettimeofday(&tvstart, &tz);
cycles[0] = rdtsc();
gettimeofday(&tvstart, &tz);
/* we don't trust that this is any specific length of time */
usleep(100);
cycles[1] = rdtsc();
gettimeofday(&tvstop, &tz);
microseconds = ((tvstop.tv_sec - tvstart.tv_sec) * 1000000) +
(tvstop.tv_usec - tvstart.tv_usec);
snprintf(p_client_buffer, client_buffer_size, p_format,
(float) ((cycles[1] - cycles[0]) / microseconds) / divisor);
#else
get_freq(p_client_buffer, client_buffer_size, p_format, divisor, 1);
#endif
}
/* void */
char get_freq(char *p_client_buffer, size_t client_buffer_size,
const char *p_format, int divisor, unsigned int cpu)