diff -ur gkrellm2-cpufreq-0.5.1-vanilla/cpufreq.c gkrellm2-cpufreq-0.5.1/cpufreq.c --- gkrellm2-cpufreq-0.5.1-vanilla/cpufreq.c 2004-03-19 12:30:08.000000000 +0100 +++ gkrellm2-cpufreq-0.5.1/cpufreq.c 2004-03-19 13:39:59.000000000 +0100 @@ -55,6 +55,9 @@ static const int length = BUFSIZ; static char governor[256]; +static char throttling[256]; +static char gov_and_thrott[256]; + static char empty[1]; static char* governor_text; @@ -74,6 +77,7 @@ static gint gov_enable_current; static gint slider_userspace_enable; static gint style_id; +static gint throttling_enable; static void read_governor() { @@ -110,6 +114,54 @@ } } +static void read_throttling() { + + FILE* fp; + int success = 0; + if (interface_sys) { + /* I do not know how to read throttling from sysfs interface */ + } + if (!success) { + fp = fopen( "/proc/acpi/processor/CPU0/throttling", "r" ); + if (fp) { + char input[length]; + if (fgets(input, length, fp)) { /* first line : throw away */ + if (fgets(input, length, fp)) { + strcpy(throttling, input+25); + throttling[strlen(throttling)-1] = 0; + success = 1; + // fprintf(stderr,"throttling=%s %s\n",throttling,input); + } + } + fclose( fp ); + } + } + if (!success) { + strcpy(throttling, "-"); + } +} + +static void make_gov_and_thrott() { + /* This is a horrible hack by RGtti*/ + if (strcmp(throttling,"-")!=0) { + strcpy(gov_and_thrott, throttling); + strcat(gov_and_thrott, ": "); + if (strncmp(governor, "perf", 4)==0) + strcat(gov_and_thrott, "perf"); + else if (strncmp(governor, "powe", 4)==0) + strcat(gov_and_thrott, "power"); + else if (strncmp(governor, "user", 4)==0) + strcat(gov_and_thrott, "user"); + else + strcat(gov_and_thrott, governor); + governor_text = gov_and_thrott; + // fprintf(stderr,"string: %s\n",gov_and_thrott); + } else { + strcpy(gov_and_thrott, governor); + governor_text = gov_and_thrott; + } +} + static void read_khz() { khz = 0; FILE* fp; @@ -219,7 +271,9 @@ } read_khz(); read_temperature(); - + read_throttling(); + make_gov_and_thrott(); + if (!slider_in_motion) { int krellpos = slider_krell->w_scale*khz/khz_max; gkrellm_update_krell(panel, slider_krell, krellpos); @@ -372,6 +426,7 @@ -1, /* x = -1 places at left margin */ -1, /* y = -1 places at top margin */ -1); /* w = -1 makes decal the panel width minus margins */ + if (gov_enable) { governor_text = governor; y = text_decal_gov->y + text_decal_gov->h + 1; Files gkrellm2-cpufreq-0.5.1-vanilla/cpufreq.o and gkrellm2-cpufreq-0.5.1/cpufreq.o differ Files gkrellm2-cpufreq-0.5.1-vanilla/cpufreq.so and gkrellm2-cpufreq-0.5.1/cpufreq.so differ