[Xfce4-commits] <xfce4-cpugraph-plugin:master> Get rid of non working code
Florian
noreply at xfce.org
Sat Apr 17 16:16:26 CEST 2010
Updating branch refs/heads/master
to 10e904cee3dd59e1efee1f6cb2d25488cead1d5c (commit)
from e2ede49414d3d4aac031206e8a98e92a96de28b9 (commit)
commit 10e904cee3dd59e1efee1f6cb2d25488cead1d5c
Author: Florian <frivoal at gmail.com>
Date: Sat Feb 27 22:46:15 2010 +0900
Get rid of non working code
There was a bunch of cpuFreq code lying around, but the critical part
about getting the data didn't work. Maybe this should be fixed, but in
the meanwhile, there is no point in keeping the rest of the system.
Also, when resising history, the past would be filled with invalid data.
Zeroing it is both quicker and more accurate.
panel-plugin/cpu.c | 24 ++++--------------------
panel-plugin/mode.c | 11 +----------
panel-plugin/os.c | 8 --------
panel-plugin/os.h | 4 ----
panel-plugin/properties.c | 1 -
5 files changed, 5 insertions(+), 43 deletions(-)
diff --git a/panel-plugin/cpu.c b/panel-plugin/cpu.c
index f521525..8e0201d 100644
--- a/panel-plugin/cpu.c
+++ b/panel-plugin/cpu.c
@@ -116,8 +116,6 @@ void UpdateTooltip( CPUGraph * base )
{
gchar tooltip[32];
int pos = g_snprintf( tooltip, 32, "Usage: %d%%", (int)base->m_CpuData[0].load*100/CPU_SCALE );
- if( base->m_CpuData[0].scalCurFreq )
- g_snprintf( tooltip+pos, 32-pos, " (%d MHz)", base->m_CpuData[0].scalCurFreq/1000 );
gtk_widget_set_tooltip_text( base->m_FrameWidget, tooltip );
}
@@ -168,16 +166,11 @@ gboolean UpdateCPU( CPUGraph * base )
if( a < b ) a++;
int factor = (i*2);
base->m_History[i--] = (a * (factor-1) + b) / factor;
-
- a = base->m_History[j], b = base->m_History[j-1];
- if( a < b ) a++;
- base->m_History[j--] = (a * (factor-1) + b) / factor;
}
} else {
- memmove( base->m_History + 1 , base->m_History , (base->m_Values * 2 - 1) * sizeof( int ) );
+ memmove( base->m_History + 1 , base->m_History , (base->m_Values - 1) * sizeof( int ) );
}
base->m_History[0] = (long)base->m_CpuData[0].load;
- base->m_History[base->m_Values] = base->m_CpuData[0].scalCurFreq;
/* Tooltip */
UpdateTooltip( base );
@@ -293,18 +286,9 @@ void set_update_rate( CPUGraph *base, int rate )
void set_width( CPUGraph *base, int width )
{
base->m_Width = width;
- int i;
- base->m_History = (long *) g_realloc( base->m_History, 2 * width * sizeof( long ) );
-
- base->m_CpuData = cpuData_read();
- base->m_CpuData[0].pUsed = 0;
- base->m_CpuData[0].pTotal = 0;
- long usage = base->m_CpuData[0].load;
- for( i = width - 1; i >= base->m_Values; i-- )
- {
- base->m_History[i] = usage;
- base->m_History[i+width] = base->m_CpuData[0].scalCurFreq;
- }
+ base->m_History = (long *) g_realloc( base->m_History, width * sizeof( long ) );
+ if( width > base->m_Values )
+ memset( base->m_History + base->m_Values, 0, (width - base->m_Values) * sizeof( long ) );
base->m_Values = width;
UserSetSize( base );
}
diff --git a/panel-plugin/mode.c b/panel-plugin/mode.c
index 1199f1c..2d19ed2 100644
--- a/panel-plugin/mode.c
+++ b/panel-plugin/mode.c
@@ -57,16 +57,7 @@ void drawGraphModeNormal( CPUGraph *base, GdkGC *fg1, GtkWidget *da, int w, int
{
gdk_draw_line( da->window, fg1, x, h-usage, x, h-1 );
}
- else if( base->m_ColorMode == 3 ) /* cpu freq. based */
- {
- t = (double) (base->m_History[base->m_Values+ w -1 - x] - base->m_CpuData[0].scalMinFreq)
- / (base->m_CpuData[0].scalMaxFreq - base->m_CpuData[0].scalMinFreq);
-
- MixAndApplyColors( t, &base->colors[1], &base->colors[2], fg1);
- gdk_draw_line( da->window, fg1 , x, h-usage, x, h-1 );
-
- }
- else /* 1 or 2 */
+ else
{
tmp = 0;
for( y = h-1; y >= h - usage; y--, tmp++ )
diff --git a/panel-plugin/os.c b/panel-plugin/os.c
index 4b539a6..60f1e1d 100644
--- a/panel-plugin/os.c
+++ b/panel-plugin/os.c
@@ -40,14 +40,6 @@ int cpuData_init()
/* Alloc storage for cpu data stuff */
cpudata = (CpuData *) g_malloc0( cpuNr * sizeof( CpuData ) );
- /* init frequency */
- for( i=cpuNr-1; i>=0; i-- )
- {
- cpudata[i].scalCurFreq = 0;
- cpudata[i].scalMinFreq = 0;
- cpudata[i].scalMaxFreq = -1;
- }
-
return nrCpus = cpuNr;
}
diff --git a/panel-plugin/os.h b/panel-plugin/os.h
index d22fba4..b2ebac6 100644
--- a/panel-plugin/os.h
+++ b/panel-plugin/os.h
@@ -41,15 +41,11 @@ typedef struct s_cpuData
float load; /* cpu utilization */
unsigned long pUsed; /* Previous value of used cpu time */
unsigned long pTotal; /* Previous value of total cpu time */
- long scalCurFreq;
- long scalMinFreq;
- long scalMaxFreq;
} CpuData;
int cpuData_init();
void cpuData_free();
CpuData *cpuData_read();
-void setFrequencyScaling( int cpuId );
#endif
diff --git a/panel-plugin/properties.c b/panel-plugin/properties.c
index 21e66a7..0871413 100644
--- a/panel-plugin/properties.c
+++ b/panel-plugin/properties.c
@@ -221,7 +221,6 @@ static void SetupColormodeOption( GtkBox *vbox, GtkSizeGroup *sg, CPUGraph *base
const char *items[] = { _("None"),
_("Gradient"),
_("Fire"),
- _("cpufreq")
};
size_t nb_items = sizeof( items ) / sizeof( char* );
More information about the Xfce4-commits
mailing list