[Kde-hardware-devel] Ksysguardd and solid
John Tapsell
johnflux at gmail.com
Thu Jun 29 20:37:35 CEST 2006
Hey all,
In ksysguard there is a daemon, ksysguardd. This is a C/C++ program
with a different source for each OS (Linux, FreeBSD etc). This is in
kdebase/workspace/ksysguard/ksysguardd/Linux/
ksysguard runs ksysguardd and talks to it via stdin and stdout. It
conversation is like:
ksysguardd> ps?
Name PID PPID UID GID Status User% System% Nice
VmSize VmRss Login Command
s d d d d S f f d
D D s s
ksysguardd>
Then to get the data for ps:
ksysguardd> ps
init 1 0 0 0 sleeping 0.00 0.00
0 2640 580 root init [2]
migration/0 2 1 0 0 sleeping 0.00
0.00 0 0 12 root
...
There is also an xres command, which looks like:
ksysguardd> xres?
XPid XIdentifier XPxmMem XNumPxm XMemOther
d s D d D
and:
4969 KDE Desktop 7919176 78 8032
5139 http://mail.google.com - Google Mail - Compose Mail - Mozilla
Firefox 23449584 1194 26056
5001 KDE Wallet Manager 20024 11 888
...
In ksysguard, I call "ps" every 2 seconds (it's very fast) and xres
every 6 seconds or so (it can take about 2 seconds to run sometimes)
What I do next is a bit complicated. I basically look at the new data
and compare it against what I already know. Thus I can deduce what
are new processes, what processes disapeared, which processes have
changed, and so on. I then emit changed information only for what has
changed.
This allows the view to update smoothly, allows selections to be kept,
and reduces the redrawing needed.
Now I mention this because I think it would be nice to keep this model
in solid, so that any app can use the model.
More information about the Kde-hardware-devel
mailing list