Main index > About new desklets > SystemMonitor

By Jedidiah (Desklet Author), on Wed Mar 23 02:19:36 2005: SystemMonitor.

I just happened upon adesklets and tried to put together my own system monitor so maybe you can use some of the parts. You can find a copy here:

http://jedidiah.stuff.gen.nz/SystemMonitor.tar.gz

example screenshot not using the disk space meter:

http://jedidiah.stuff.gen.nz/system_monitor.jpg

It isn't quite as flexible and themable as your suggestion, but implements a modular system of meters that can include (multiple instances of) CPU, Memory, Network IO, Disk IO, and Disk Usage, with a base class that makes adding more meters (for say processes, and swap) easy.

It won't do any solely text based items (hotname, time, log reading) as I never had any such things in mind, but in principle it wouldn't be hard to add.

It isn't the most optimised thing in the world, but I've trimmed it down from its initial version. ZeroDivide's suggestion with regard to Macro recording could be useful as well. Anyone interested in adding such further optimisation is welcome.

Leland McInnes.

By syfou (Core Developer & Desklet Author), on Wed Mar 23 02:34:07 2005.

Jedidiah,
there is abolutely nothing wrong distributing your deslet code for peer review - In fact, it's a very good idea... But whenever you'll think you desklet is usable, please take the time to prepare and send a submission email for inclusion on main page.

It will not take too much of your time, and it will help both your desklet having more visibility (you will therefore receive better feedback), and adesklets gaining a broader audience and a stronger community.

Thanks for your work on this. I hope hearing again from you soon. :-)

By Jedidiah (Desklet Author), on Wed Mar 23 03:57:30 2005: It's getting there....

If it manages to pass muster amongst people here I'll get around to making a submission.

With regard to speed ups via macros: I just implemented that, and it does make difference. Depending on how much activity it's seeing it's running at around 1% up to a max of about 3% of CPU on my P4 2.2GHz. Not exactly without cost, but starting to get viable.

By CitizenX (Themer / Graphic Artist), on Wed Mar 23 04:50:39 2005.

Looking good!

Very good implementation of various modules....sometimes its good to have everything in one display like that...perhaps a duplication of work, but theres nothing wrong with that, right? ;)

I like the customizability already involved....the background isnt too changeable, so that might be something you want to add. The current image you have as background works, but you might want to look at other monitors to see what they're doing as well...I actually like your method as it uses three images for the background and one could create a more unified concept for the background instead of little pieces. More modules coming up is good...the more the merrier. I like how it works so far!

I'm glad to see you're working on more optimization...I was a little worried when the desklets started sucking up 7% of my CPU (yeah I have a little processor)...then it settled down to 3.4% so far. It's still the highest desklet by far but hopefully the first release will be slimmer. :) Keep working on it.

By DrWoland (Desklet Author), on Wed Mar 23 18:29:36 2005.

I'm working on essentially the same thing, but I think I'll have to scrap what I have so far and start over for the reason of resource use. The idea of a base class is definitely a good one and has crossed my mind. The macros are also a good call, and will be easier to implement with a base class. The amount of CPU usage CitizenX is getting isn't surprising either without using macros.

By CitizenX (Themer / Graphic Artist), on Wed Mar 23 19:35:30 2005.

Well, to be fair, I have an itty bitty processor (Pentium II 400MHz). Now SystemMonitor has settled to about 4%...still too high (I like to use X as my benchmark....anything higher than it and its not something I want running all the time), but it should get better with the next release.

A tips and tricks section would be nice to have in the forum....that way new desklets can start off with tried and true protocols and be already streamlined. I'm not saying lets use cookie-cutter desklets (far be it for me to discourage innovation), but since we're all using each others' code for ideas, why not outline what works and how and why.

Is there a certain type of system we're using as a baseline? For instance, obviously we're not all 1000Ghz Pentium 5's with 6 Gig of RAM (and if you are...;)). I know Sylvain is aiming for platform independability, but is there perhaps a least common denominator we're aiming at? I've got a PII 400 with 440 RAM, so while I'm not exactly low man on the totem pole....I'm close. I'm not advocating a 'Minimum Requirements' kind of system, but where does optimization end? Should it end? Ideally, I don't even want to see any desklet show up on my top 10 processes list, but I don't know if thats reasonable.

By syfou (Core Developer & Desklet Author), on Wed Mar 23 20:17:25 2005, last edited on Wed Mar 23 20:26:14 2005.

CitizenX wrote:


A tips and tricks section would be nice to have in the forum...

I have nothing against the idea, but I am not sure about that, as I am afraid forums will begin to be a little redundant: I already find there are a bit to much of them to my taste. We already have the Miscellany>Python Programming forum that seams awfully similar to that...

CitizenX wrote:


I know Sylvain is aiming for platform independability, but is there perhaps a least common denominator we're aiming at?


Platform independence and Systems requirements are not incompatible... I did not set any of the latter because the core interpreter with my demo desklets run reasonnably on about everything I have, the oldest box being a 486 DX with 32 MB of RAM running FreeBSD 3.x serie. The approach I took myself so far was to built all my desklets in such a way the code taking more cycles could always be turned off or reduced for smaller systems.

So, as I see things, desklets authors are free to perform optimisations as far as they see fit, and users are free to use or not the resulting desklets if they fit their features/performance expectations.

By syfou (Core Developer & Desklet Author), on Wed Mar 23 20:24:35 2005.

DrWoland wrote:

The idea of a base class is definitely a good one and has crossed my mind.

I wrote an exemplification of that two weeks ago for ZeroDivide... So you might want to look at test/widgets.py from adesklets' base package.

By DrWoland (Desklet Author), on Wed Mar 23 22:48:14 2005.

syfou wrote:

DrWoland wrote:

The idea of a base class is definitely a good one and has crossed my mind.

I wrote an exemplification of that two weeks ago for ZeroDivide... So you might want to look at test/widgets.py from adesklets' base package.


Yeah, now that this came out and after your last email, I'm feeling pretty burned out on the whole system monitor thing. I think I'll just bow out of this one until I learn Python better - I'll just keep looking at code and see if I have any awesome ideas later. For now, I don't think I have anything to offer that others don't. I might just focus on Modubar, see if I can make that any more interesting.

By Jedidiah (Desklet Author), on Wed Mar 23 23:10:41 2005: There are limits.

There's only so much something like this can be optimized. On my system the current build uses less CPU either X or gkrellm. If I just load up the CPU portion (rather than a stack of monitors) it is identical in CPU use to acpumon. Naturally the more actively changing meters you have, the more CPU tends to get burned. My machine is relatively high spec however, so all these numbers are crunched to the low end of the scale, and differences are hard to percieve - on a low spec machine it may show up more.

If performance is still seen to be an issue I guess I could try and create a low spec version. In the meantime people seem to be interested in theming and text fields, so if I get some time I will add that in. I am away for easter though, so don't expect results soon.

In the meantime I've submitted what I've got so far. Consider text modules (for hostname, time, uptime etc.), theming, and a low spec version as possible features for the next version.

By syfou (Core Developer & Desklet Author), on Wed Mar 23 23:28:59 2005.

Of course, when someone tries adesklets on a athlon 64 4000+ running linux (just an example), he will not see much. :mrgreen:

But as a fair point of comparison, running six separate instance of acpumon takes about 3% of my home PC (an athlon t-bird 1.4GHz), while running six meters in a single SystemMonitor takes about 7% from your last published code, while the overall aspect is not radically different...

But as I said earlier, how much optimisation you want to do is up to you. If you are happy with your desklet the way it is, so am I, provided it works. But I believe most people will not want to run a cpu monitor using more than a certain threshold (in my case, my psychological limit is around 1% of sys+urs time on average), so making a configurable thrimmed down version or working more on your code for future release will certainly be a big plus.

By Jedidiah (Desklet Author), on Thu Mar 24 18:57:00 2005: Last comments.

I had some spare time today so I converted SystemMonitor over to using a pluggable theme system (it still looks the same by default, but you can now create "theme packages" and specify a theme to use in the config file).

I also had a look at Torsmotoy to see if I could get any ideas for further optimizations. I've made a few improvements, and changed the update rate to be alterable. If I set the update speed to update every 5 seconds (as with Torsmotoy) CPU use is now considerably less than Torsmotoy on my machine. Of course, it may not be that way for everyone - perhaps hardware acceleration via my graphics card (a GeForce4) is coming into play.

Regardless, it is now fully themeable and low on resource use.

I'm off for Easter now.

By syfou (Core Developer & Desklet Author), on Thu Mar 24 19:11:45 2005.

Nice! I am waiting for your entry.

About torsmotoy: the demo is about extensibility, not performance (See the README). Torsmo uses a stream-like format to describe its output, with possible dynamic placement, which forced me to emit a full refresh command-set for the whole window at each iteration to fully comply with the spec with minimum fuss. When I drop this requirement (compiling static placement), I can make the CPU hit on refresh almost completely vanish, but it is not Torsmo anymore... And I do not know what entry you used, as default torsmo output contains an awfull lot of information in a small space... When I limit myself to display the very same information SystemMonitor gives, TorsmoToy still burn less cycles than the latest code I have from you - which is normal, since the output is less complex...

And no, your graphic card should not have significant impact on this...

By ZeroDivide (Desklet Author), on Thu Mar 24 21:09:19 2005.

syfou wrote:

running six separate instance of acpumon takes about 3% of my home PC (an athlon t-bird 1.4GHz)


I just wanted to mention that the the current version of acpumon has a bug where it draws the whole window twice per update. ( dont ask )
It will be fixed in the next release.. hopefully soon

jedidiah wrote:

I had some spare time today so I converted SystemMonitor over to using a pluggable theme system


I recently added something similar to the network monitor ive been working on. Maybe we can use the same theme format so we can share themes.

ZeroDivide

By syfou (Core Developer & Desklet Author), on Thu Mar 24 21:36:28 2005: Just for you to know....

ZeroDivide wrote:


I recently added something similar to the network monitor ive been working on. Maybe we can use the same theme format so we can share themes.

Mike Pirnat and I are evaluating the possibility to provide to Python desklets writers a set of more high level interfaces (purely optional of course) to give more flexibility and to generally speed-up desklets development when display elements needed are pretty standards (canvas, text box, gauges, etc.)... Those elements could then be reused as a base to bridge adesklets to gDesklets ADL (see chapter four of the gDesklets Developer's Book). So I will closely follow your effort concerning theming, since this is a features important to gDesklets maintainers as well...

If you have suggestions or insights on how things should be done, you are of course very welcomed to share them now or when we will begin releasing test code. I personally really dislike changing interfaces, and I know by experience that a set of high-level classes is really more likely to be bad than a low-level set of procedurals hooks: the more you participate or give feedback, the more likely the job will fit your tastes. :-)

By Jedidiah (Desklet Author), on Sun Mar 27 23:17:42 2005.

syfou wrote:


About torsmotoy: the demo is about extensibility, not performance (See the README). Torsmo uses a stream-like format to describe its output, with possible dynamic placement, which forced me to emit a full refresh command-set for the whole window at each iteration to fully comply with the spec with minimum fuss.


I do understand that Torsmotoy is more interested in flexiblity (my system, in its turn, is more interested in pure eye candy). It is worth noting that SystemMonitor does allow for dynamic placement of meters into any order or arrangement you like.

I was mostly using Torsmotoy as a CPU gauge as I presumed you had optimized it to at least be close to meeting your requirements.

I've beefed up the flexibility of throttling the meters (individual meters can now having differing update speeds - the CPU meter updates every 2 seconds, but the Memory meter only updates every 10 seconds etc.) so it is quite possible to get low CPU use by adjusting everything downward accordingly yet still getting timely updates on those statistics that need it. If you adjust CPU, Network and DiskIO to 5 second updates, and Mem, Swap and DiskSpace to minute updates it runs fairly frugally.

ZeroDivide wrote:

I recently added something similar to the network monitor ive been working on. Maybe we can use the same theme format so we can share themes.


That would definitely be nice, but may be tricky - I construct my meter backgrounds a little differently than you (I think). We'll see I guess - perhaps we can converge towards an agreed standard.

syfou wrote:

Mike Pirnat and I are evaluating the possibility to provide to Python desklets writers a set of more high level interfaces (purely optional of course) to give more flexibility and to generally speed-up desklets development when display elements needed are pretty standards (canvas, text box, gauges, etc.)...


Interesting you should say that. I was contemplating rewriting things a little using Hbox and Vbox widget packing to organise things (instead of my current crude push and shove method). I do think a base library of some standard bits and pieces is a very good idea indeed. I look forward to what comes from it.

By syfou (Core Developer & Desklet Author), on Mon Mar 28 02:38:50 2005.

Jedidiah wrote:


I was mostly using Torsmotoy as a CPU gauge as I presumed you had optimized it to at least be close to meeting your requirements.

That would have made sense indeed. :oops: As I tried to explain (poorly I guess), what I wanted here was to "mimicry" the original Torsmo behavior as much as I could, just to show it was possible with not to much work using a proper Python structure... It was more an exercise in style than anything else. That's why I supported some placement features I clearly woudn't normally under adesklets, just for the sake of compatibility.

This, combined with what other people are doing with the software lead me to confirm something I already knew at design time: dynamic desklets are difficult to write under strict cpu usage conditions. This lead me to this. Do not hesitate if you wish to comment on it (replying to the mailing list would be even better.in that case).

Thanks for your newly submitted SystemMonitor entry on adesklets site, by the way. I will be glad to accept you right away in the "Desklet Author" group (see the Usegroups menu above) if you choose to apply for membership.

Regards,

By Jedidiah (Desklet Author), on Mon Mar 28 17:04:12 2005.

Well, I sat down and tried to wring every last bit of performance I could out of my code, and have a new version (already submitted) that does make significant gains. The problem is that there's only so much you can do with these monitors: in the end you are drawing a lot of data to screen on a very regular basis. That's going to be expensive. I think the best that can be done is to set some realistic expectations on performance. I decided that gkrellm would make a reasonable performance benchmark for me - it's a popular system monitor, so if I can beat that, then I should be doing okay. Here's how it pans out on my system (2.2 GHz P4) with SystemMonitor configured to be slightly more expensive than the default setup:

Code:

                                                                         
  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
 8164 root      15   0  202m  61m 6392 S  7.0 12.1   1445:37 X
 8264 jedidiah  16   0 33808 5692 3888 S  2.3  1.1 656:43.32 gkrellm
 8054 jedidiah  15   0 10068 5568 2552 S  0.7  1.1   0:08.11 adesklets
 8053 jedidiah  17   0  8216 4672 2108 S  0.3  0.9   0:08.10 python



The gains mostly come from trying to everywhere minimize any drawing and using little localized buffers. I'm unsure if there's much you could do to make such code easier to write really. At best we could try and write a short guide to writing such desklets.

(And yes, I'm well aware that gkrellm does more than SystemMonitor. I think SystemMonitor looks a lot prettier though, and it does what it does more cheaply too (now), so it makes an acceptable replacement for me)

By syfou (Core Developer & Desklet Author), on Sat Apr 2 15:07:02 2005.

Just a remarlk on your benchmark: I suspect that adesklets is responsible for a fair amount of cycles spent in X here, and the overall cycles spent are more around 8% of your CPU time than 1%... But I haven't verified any of this yet.

By Jedidiah (Desklet Author), on Sat Apr 2 22:10:07 2005.

Yes, I was rather surprised about X, but that seems to be anomolous - a consequence of other stuff running, as X CPU use has in general been much lower than that particular figure (despite the adesklets running). I am honestly not sure why it was running as high as that at the time.

By mbokil (Desklet Author), on Sat Dec 10 20:00:06 2005.

Quote:

If you have suggestions or insights on how things should be done, you are of course very welcomed to share them now or when we will begin releasing test code.


I like the simplicity of superkaramba's high level interface for desklets. It would be great if something like this was available for adesklets. Here is a code example of a network status desklet.

Code:

TEXT x=135 y=0 sensor=network onclick="toggleNetworkEnabled()" DEVICE="eth0" format="%out Kb" interval=500 align=center

graph x=5 y=20 w=155 h=50 color=0,255,174 sensor=network DEVICE="eth0" format="%out" interval=500 max=32


Or maybe it could be an XML format with a structure of something similar to Mozilla's XUL. It would be helpful for translators if the text could be spelled out in a DTD file.

Code:


<!DOCTYPE desklet SYSTEM "dtd/en-US.dtd">
<desklet id="SuperVolumeCtrl" background="images/background.png" onload="initSensors()">
    <label value="&volume.lbl;" style="color:black;"/>
    <image width="100" height="100" src="images/image.png" onclick="doVolumeCtrl()"/>
    <meter id="volume" style="color:#FFFFFF;background:transparent" interval="1000" sensor="MyVolumeControl.py"/>
    <context>
         <menuitem value="Quit" onclick="quit()"/>
         <menuitem value="Restart" onclick="restart()"/>
         <menuitem value="Configure" onclick="configure()"/>
    <context>
</desklet>



adesklets is proud to be hosted on:

SourceForge.net Logo

Back to adesklets.sf.net.