diff -ru /home/sliwers/tmp/xfce4-cpugraph-plugin-0.2.2.xfld/panel-plugin/cpu.c panel-plugin/cpu.c --- /home/sliwers/tmp/xfce4-cpugraph-plugin-0.2.2.xfld/panel-plugin/cpu.c 2004-06-12 03:25:31.000000000 +0200 +++ panel-plugin/cpu.c 2005-04-25 17:58:22.000000000 +0200 @@ -307,7 +307,7 @@ void UpdateTooltip (CPUGraph *base) { char tooltip[32]; - sprintf (tooltip, "Usage: %d%%", base->m_CPUUsage); + sprintf (tooltip, "Frequency: %dMHz", base->m_CPUFreq); gtk_tooltips_set_tip (GTK_TOOLTIPS (base->m_Tooltip), base->m_Parent, tooltip, NULL); } void SetSize (Control *control, int size) @@ -636,6 +636,7 @@ gboolean UpdateCPU (CPUGraph *base) { base->m_CPUUsage = GetCPUUsage (&base->m_OldUsage, &base->m_OldTotal); + base->m_CPUFreq = GetCPUFreq () / 1000; memmove (base->m_History+1, base->m_History, (base->m_Values-1)*sizeof (int)); base->m_History[0] = base->m_CPUUsage; diff -ru /home/sliwers/tmp/xfce4-cpugraph-plugin-0.2.2.xfld/panel-plugin/cpu.h panel-plugin/cpu.h --- /home/sliwers/tmp/xfce4-cpugraph-plugin-0.2.2.xfld/panel-plugin/cpu.h 2004-06-11 07:18:45.000000000 +0200 +++ panel-plugin/cpu.h 2005-04-25 17:26:26.000000000 +0200 @@ -87,6 +87,7 @@ guint m_TimeoutID; // Timeout ID for the tooltip; long m_CPUUsage; + long m_CPUFreq; long *m_History; int m_Values; diff -ru /home/sliwers/tmp/xfce4-cpugraph-plugin-0.2.2.xfld/panel-plugin/os.c panel-plugin/os.c --- /home/sliwers/tmp/xfce4-cpugraph-plugin-0.2.2.xfld/panel-plugin/os.c 2004-06-07 03:16:30.000000000 +0200 +++ panel-plugin/os.c 2005-04-25 17:56:32.000000000 +0200 @@ -29,6 +29,21 @@ return usage; } +#define FREQ_FILE "/sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq" +long GetCPUFreq (void) +{ + long freq; + FILE *fp = fopen (FREQ_FILE, "r"); + + if (!fp){ + printf ("Couldn't read from " FREQ_FILE); + return -1; + } + + fscanf (fp, "%ld", & freq); + fclose (fp); + return freq; +} #elif defined (__FreeBSD__) long GetCPUUsage (int *oldusage, int *oldtotal) { diff -ru /home/sliwers/tmp/xfce4-cpugraph-plugin-0.2.2.xfld/panel-plugin/os.h panel-plugin/os.h --- /home/sliwers/tmp/xfce4-cpugraph-plugin-0.2.2.xfld/panel-plugin/os.h 2004-06-07 02:00:28.000000000 +0200 +++ panel-plugin/os.h 2005-04-25 17:28:20.000000000 +0200 @@ -35,5 +35,6 @@ #endif long GetCPUUsage (int *oldusage, int *oldtotal); +long GetCPUFreq (void); #endif