System Monitor chews up to 20% of my CPU.  It's really pretty I know,
but ...this renders it really useless.

This is either caused by (1) the math-algorithm to smooth the graphs, or
(2) the redrawing.

If (1), need to check if the entire curve is re-approximated each
redraw.  if it is, that's VERY BAD.  Only the new point should be
adjusted, thus:  NewPoint = 0.2 * new_val  +  0.8 * LastPoint, or
something.  That's called an IIR filter if anyone's interested.

If (2), I suggest 
a) changing the readout to hospital cardiograph style.  (reading moves from 
left to right, and wraps)
b) lower refresh rate to 5fps, draw a bunch of samples each time
c) if you _really_ want the whole thing to move, blank and repaint each point 
rather than blanking the area and redrawing

This would be fastest, and smooths:

const WIDTH 500
int val[WIDTH];
int x = -1;
float y = 0;

void plot_new_point(int newVal)
{
   x++;
   if (x > graphWidth) 
      x = 0;

   float y_old = y;
   y = 0.8 * y_old + 0.2 * newVal;

   SetPixel( x, val [x], BACKGROUND_COLOR );
   val[x] = y;
   SetPixel( x, val [x], LINE_COLOR );
}

Sorry can't implement.  1) I'm a noob.  2) RSI.  3) ToDo list spans till
xmas.

Sam/Ohmu

-- 
Excessive CPU usage by Gnome System Monitor 
https://bugs.launchpad.net/bugs/93847
You received this bug notification because you are a member of Ubuntu
Desktop Bugs, which is a bug assignee.

-- 
desktop-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/desktop-bugs

Reply via email to