Lowering the update speed to 2sec cuts usage in half
(duh?). Maybe 400x100 is too large a size for this kind of
monitor, but it looks pretty good on my 1680x1050
desktop.
That would not really be optimizing, but lowering your
expectations, isn't it? :-)
Right now I open, read, and close /proc/stat and
/proc/loadavg every update. Is there a better (read
lighter-weight/faster) way to get this information? I don't
like having to open and close the files each update. Is
pystatgrab optimized?
Reading
/proc is in my mind
a bad idea due to the os-specific nature of this
pseudo-filesystem, unless you have alternate ways elsewhere,
which is precicely why libstatgrab is so nice. As for
performance, believe me, it doesn't make a diffence
opening/closing
/proc/stat
once in a while. For what I read from libstatgrab
(
src/libstatgrab/cpu_stats.c), that's
precicely what the library do on linux and cygmin.
Currently I am "sliding" the graph with:
adesklets.context_set_image(self.graph)
adesklets.context_set_blend(False)
adesklets.blend_image_onto_image(self.graph, 1, 1, 0, self.size[0]-1, self.size[1], 0, 0, self.size[0]-1, self.size[1])
I don't know jack about imlib2, is there a preferred way to
move an image like that? My compositing scheme can also be
improved.
No, nothing wrong with that. Although, as you probably
"cache" this image anyway, I would probably not slide things
at all, but use a scrolling buffer, like people did back in
2D platforms games. Normally drawing the graph, and wrap
writing to the beginning of it when the plot reaches its
right side, doing the final blending on foreground on two
steps instead of one.
I will clean the code up and make it presentable and get
some source available for you guys.
Excellent.