From 6fab949926192cb7eebdfe30c024171790184485 Mon Sep 17 00:00:00 2001 From: Brenden Matthews Date: Sun, 7 Dec 2008 15:15:57 -0700 Subject: [PATCH] Removing $freq_dyn and $freq_dyn_g I have decided to remove $freq_dyn and $freq_dyn_g due to license issues (see sf.net tracker bug #2166612) --- ChangeLog | 4 ++++ src/conky.c | 17 -------------- src/linux.c | 65 ----------------------------------------------------- 3 files changed, 4 insertions(+), 82 deletions(-) diff --git a/ChangeLog b/ChangeLog index d50107bc..84559c2e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2008-12-07 + * Removing $freq_dyn and $freq_dyn_g due to license issues (see sf.net + tracker bug #2166612) + 2008-12-06 * Switching from svn to git repository. The repo can be viewed from http://git.omp.am/?p=conky.git;a=summary and you can clone the repo with: diff --git a/src/conky.c b/src/conky.c index 83310f5e..7b3cf867 100644 --- a/src/conky.c +++ b/src/conky.c @@ -1161,8 +1161,6 @@ enum text_object_type { OBJ_execpi, OBJ_freq, OBJ_freq_g, - OBJ_freq_dyn, - OBJ_freq_dyn_g, OBJ_fs_bar, OBJ_fs_bar_free, OBJ_fs_free, @@ -2690,8 +2688,6 @@ static struct text_object *construct_text_object(const char *s, #endif /* HAVE_IWLIB */ #endif /* __linux__ */ - END OBJ(freq_dyn, 0) - END OBJ(freq_dyn_g, 0) #ifndef __OpenBSD__ END OBJ(acpifan, 0) @@ -4905,19 +4901,6 @@ static void generate_text_internal(char *p, int p_max_size, #endif /* __linux__ */ - OBJ(freq_dyn) { - get_freq_dynamic(p, p_max_size, "%.0f", 1); - spaced_print(p, p_max_size, "%s", 6, "freq_dyn", p); - } - OBJ(freq_dyn_g) { -#ifndef __OpenBSD__ - get_freq_dynamic(p, p_max_size, "%'.2f", 1000); -#else - get_freq_dynamic(p, p_max_size, "%.2f", 1000); -#endif - spaced_print(p, p_max_size, "%s", 6, "freq_dyn", p); - } - #ifndef __OpenBSD__ OBJ(adt746xcpu) { get_adt746x_cpu(p, p_max_size); diff --git a/src/linux.c b/src/linux.c index d9afeca1..cac47381 100644 --- a/src/linux.c +++ b/src/linux.c @@ -1046,71 +1046,6 @@ void get_adt746x_cpu(char *p_client_buffer, size_t client_buffer_size) snprintf(p_client_buffer, client_buffer_size, "%s", adt746x_cpu_state); } -/* Thanks to "Walt Nelson" */ - -/***********************************************************************/ -/* This file is part of x86info. - * (C) 2001 Dave Jones. - * - * Licensed under the terms of the GNU GPL License version 2. - * - * Estimate CPU MHz routine by Andrea Arcangeli - * Small changes by David Sterba */ - -#if defined(__i386) || defined(__x86_64) -unsigned long long int rdtsc(void) -{ - unsigned long long int x; - unsigned int a, d; - - __asm__ volatile(".byte 0x0f, 0x31":"=a" (a),"=d" (d)); - x = d; - return x << 32 | a; -} -#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 */ - - if (!p_client_buffer || client_buffer_size <= 0 || !p_format - || divisor <= 0) { - return; - } - - 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); - return; -#else - /* FIXME: hardwired: get freq for first cpu! - * this whole function needs to be rethought and redone for - * multi-cpu/multi-core/multi-threaded environments and - * arbitrary combinations thereof */ - get_freq(p_client_buffer, client_buffer_size, p_format, divisor, 1); - return; -#endif -} - #define CPUFREQ_PREFIX "/sys/devices/system/cpu" #define CPUFREQ_POSTFIX "cpufreq/scaling_cur_freq"