screen-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Display system monitoring counter on hard-status line?


From: Karl.
Subject: Re: Display system monitoring counter on hard-status line?
Date: Thu, 6 Sep 2007 12:25:54 +1200

On Wed, Sep 05, 2007 at 04:47:01PM -0400, cga2000 wrote:
> On Wed, Sep 05, 2007 at 01:01:12AM EDT, Karl. wrote:
> > This isn't quite directly useful, 
> .. course it does.

I'm glad you found it useful  :-)   I was really trying to say "you 
can't just directly whack this into your screenrc, but it should give 
you some clues about what you might do"

> > but here's a snippet of lua code I use 
> > for getting cpu usage for the status bar of my window manager:

I updated my website a bit and put the whole lua script online, just in 
case you feel like seeing it more in context.
http://mowson.org/karl/articles/dwm/

> If you sample CPU activity every second and find process A used the 
> CPU .02 seconds and process B .01 second and nothing else was 
> dispatched during that time frame .. that would add up to 3% CPU ..  
> with the CPU idle 97% of the time.

Seems reasonable.  Of course there will be buckets of background 
processes using cpu time as well as what I assume are your foreground A 
+ B.  Note that ideally you need to calculate time elapsed between 
samples (as my script does) in case the scheduling of your sampling is 
not exactly every 1s, otherwise you may find yourself going over 100% 
apparent usage...

You can also look at /proc/loadavg for cpu usage info, but I find that 
it doesn't tell me what I really want to know.  My primary interest in 
load is for those times when the computer seems to be unresponsive and I 
want to know if it is cpu-bound or i/o-bound or whatever.  In which 
case, a 1-minute average is of no use.

In case you haven't noticed, 'man proc' tells you much about what you 
can find in the proc filesystem.  (you can read the manpage online:
http://www.linuxmanpages.com/man5/proc.5.php)

> Not sure why my "ps" + "add up what's in the %CPU column" does not 
> give me the same results as the usual suspects, though.

Are you including *all* processes in your ps?  Don't forget rounding 
errors too.

> > A completely different approach, which I used briefly but abandoned 
> > for various reasons, is to run conky in stdout mode.  In this mode 
> > you can set up all sorts of status monitors and have it spit them 
> > out on stdout, ready to be piped into something.
> 
> Not familiar with this mode.  
> 
> OTOH, the reason I'm adding some monitoring to screen is that I'm
> dumping conky .. the overhead mostly.  So ..

Same here.  Conky is pretty, but if you're only using it to output text, 
and not pretty graphics, then other tools start to become more 
attractive.  I was mostly using PII-400 machines, in which processing 
power is best not squandered.

Karl.
-- 
http://mowson.org/karl




reply via email to

[Prev in Thread] Current Thread [Next in Thread]