xload is NOT a CPU usage meter

Using applications, configuring, problems
Message
Author
disciple
Posts: 6984
Joined: Sun 21 May 2006, 01:46
Location: Auckland, New Zealand

#16 Post by disciple »

What's wrong with this sentence:
AFAICS what's wrong with it is that I wasn't certain about the correct terminology because I hadn't investigated it properly. I don't think getting the terminology precisely right will make much difference to the understanding of most users unless we define the terminology as well.

I'm not much of a hacker, and the last I heard xload was going to be switched off in Puppy 4.2, but when I get a chance I might have a look to see if I can add a tooltip or a context menu.
Do you know a good gtkdialog program? Please post a link here

Classic Puppy quotes

ROOT FOREVER
GTK2 FOREVER

User avatar
vtpup
Posts: 1420
Joined: Thu 16 Oct 2008, 01:42
Location: Republic of Vermont
Contact:

#17 Post by vtpup »

Peace be with you, my friend.

User avatar
HairyWill
Posts: 2928
Joined: Fri 26 May 2006, 23:29
Location: Southampton, UK

#18 Post by HairyWill »

My previous load average example giving a 1 minute average was a bit lacking in granularity. This might be more promising

Code: Select all

while [ 1 ]; do top -n 1 | head -2 | tail -n 1 | awk '{print $8}'| sed 's/%//';sleep 2;done
it displays the idle value from top, subtract it from 100 and you have the current cpu utilization (I think). I have hooked this into brads battery monitor so that you get a green square in the taskbar with 8 levels of red filling it up depending on the utilization. The icon is just created from 9 32x32 png files ranging from all green to all red. It is not very pretty!
Attachments
cpumon.png
(2.04 KiB) Downloaded 6281 times
Will
contribute: [url=http://www.puppylinux.org]community website[/url], [url=http://tinyurl.com/6c3nm6]screenshots[/url], [url=http://tinyurl.com/6j2gbz]puplets[/url], [url=http://tinyurl.com/57gykn]wiki[/url], [url=http://tinyurl.com/5dgr83]rss[/url]

User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#19 Post by MU »

cpu usage from deskicons002:

Code: Select all

#!/bin/bash
# by Paul Colby (http://colby.id.au), no rights reserved ;)

####cd ../icons

####cp -ax terminal-black.png /tmp/deskiconsramdrive/terminal.png

PREV_TOTAL=0
PREV_IDLE=0

while true; do
  CPU=(`cat /proc/stat | grep '^cpu '`) # Get the total CPU statistics.
  unset CPU[0]                          # Discard the "cpu" prefix.
  IDLE=${CPU[4]}                        # Get the idle CPU time.

  # Calculate the total CPU time.
  TOTAL=0
  for VALUE in "${CPU[@]}"; do
    let "TOTAL=$TOTAL+$VALUE"
  done

  # Calculate the CPU usage since we last checked.
  let "DIFF_IDLE=$IDLE-$PREV_IDLE"
  let "DIFF_TOTAL=$TOTAL-$PREV_TOTAL"
  let "DIFF_USAGE=(1000*($DIFF_TOTAL-$DIFF_IDLE)/$DIFF_TOTAL+5)/10"

#### comment next line for use with deskicons
  echo -en "\rCPU: $DIFF_USAGE%  \b\b"

####pic=terminal-green.png
####if [ $DIFF_USAGE -gt 33 ];then
####	pic=terminal-yellow.png
####fi
####if [ $DIFF_USAGE -gt 66 ];then
####	pic=terminal-red.png
####fi

####cp -ax $pic /tmp/deskiconsramdrive/terminal.png

  # Remember the total and idle CPU times for the next check.
  PREV_TOTAL="$TOTAL"
  PREV_IDLE="$IDLE"

  # Wait before checking again.
  sleep 1
done
I commented with #### the desktopicons specific lines, so it is reverted back to the original script I found in the web.
Like this it prints the values to the console.
With slight modifications concerning the pictures, you might adapt it for the jwm tray.

Mark
[url=http://murga-linux.com/puppy/viewtopic.php?p=173456#173456]my recommended links[/url]

User avatar
HairyWill
Posts: 2928
Joined: Fri 26 May 2006, 23:29
Location: Southampton, UK

#20 Post by HairyWill »

thanks Mark
That confirms that the value I am using is sensible, I'm just collecting it in an expensive way. I will probably try and do a complete solution in C to avoid the cost of opening a shell every couple of seconds. I do find it interesting how my cpu bounces from 2-30% whilst I am not interacting with my machine.
Will
contribute: [url=http://www.puppylinux.org]community website[/url], [url=http://tinyurl.com/6c3nm6]screenshots[/url], [url=http://tinyurl.com/6j2gbz]puplets[/url], [url=http://tinyurl.com/57gykn]wiki[/url], [url=http://tinyurl.com/5dgr83]rss[/url]

User avatar
DaveS
Posts: 3685
Joined: Thu 09 Oct 2008, 16:01
Location: UK

#21 Post by DaveS »

I read through this thread a few times now, and oddly have come to the conclusion that a monitor for running processes is actually a lot more useful as a diagnostic tool than a CPU meter.
Spup Frugal HD and USB
Root forever!

asdf42
Posts: 2
Joined: Mon 21 Dec 2009, 21:40

#22 Post by asdf42 »

A few things about xload and CPU meters:

* I use puppy for web browsing, often with many pages opened. Xload increases before my PC gets unresponsive. It is a very useful information. Until I read this thred, I never knew how it detects it, but I used it.

* For a very long time, I didnt pay attention to the white lines across it. It took me *very* long to realize that these are the scales and thus their number is more important than the graph itself. - I believe a tooltip saying how the graph should be read and what it means is VERY important and it should be included in the next version of puppy.

* If anybody wants to monitor the CPU usage, I recommend running a console and calling "top". It is a standard unix command that gives info about processes sorted by CPU usage, about memory usage and similar things. If you dont know it, just try it! I believe this info about managing your processes should be in all starter guides.

disciple
Posts: 6984
Joined: Sun 21 May 2006, 01:46
Location: Auckland, New Zealand

Great idea

#23 Post by disciple »

I believe a tooltip saying how the graph should be read and what it means is VERY important and it should be included in the next version of puppy.
Yes, good point. freememapplet needs the same thing. But I don't think jwm can provide tooltips for swallowed items though, so you'd either need to modify jwm or xload and freememapplet, or perhaps run them via alltray or something...
I believe this info about managing your processes should be in all starter guides.
Yes, although you shouldn't really need to know it. Puppy should just work :wink:
Do you know a good gtkdialog program? Please post a link here

Classic Puppy quotes

ROOT FOREVER
GTK2 FOREVER

DMcCunney
Posts: 889
Joined: Tue 03 Feb 2009, 00:45

#24 Post by DMcCunney »

asdf42 wrote:* If anybody wants to monitor the CPU usage, I recommend running a console and calling "top". It is a standard unix command that gives info about processes sorted by CPU usage, about memory usage and similar things. If you dont know it, just try it! I believe this info about managing your processes should be in all starter guides.
I use top regularly. But it should be noted that the implementation Puppy uses is the cut down version included in busybox. The real thing has a much larger feature set. See http://linux.die.net/man/1/top

I have Ubuntu in another partition on the box that runs Puppy, and copied Ubuntu's full version over for use in Puppy.
______
Dennis

proximityinfotech1

#25 Post by proximityinfotech1 »

Now the question is, is there a similar app that DOES graph CPU usage, and can be used in JWM?
There is xloadtime, which is a fork of xload, that can display an extra bar for it, but it doesn't show a graph over time, just a single bar per CPU.

_____________________________________________

disciple
Posts: 6984
Joined: Sun 21 May 2006, 01:46
Location: Auckland, New Zealand

#26 Post by disciple »

Somebody found some sort of easy tool for making tray apps a while ago and several apps were made - one of them may have been for CPU usage.
I think this was in the thread for 2.14R or something - can anybody remember?
Do you know a good gtkdialog program? Please post a link here

Classic Puppy quotes

ROOT FOREVER
GTK2 FOREVER

User avatar
01micko
Posts: 8741
Joined: Sat 11 Oct 2008, 13:39
Location: qld
Contact:

#27 Post by 01micko »

disciple

Is this the one? http://www.murga-linux.com/puppy/viewtopic.php?t=44986

I still have it installed on my old machine.
Puppy Linux Blog - contact me for access

disciple
Posts: 6984
Joined: Sun 21 May 2006, 01:46
Location: Auckland, New Zealand

#28 Post by disciple »

No, at least not the first version posted there. As I described there, it seems to show the CPU speed, so is useful on a laptop or something with dynamic CPU scaling or whatever it's called..
I can't remember for sure what the "modified" version there shows, but from my second comment it sounds like it isn't conventional "cpu usage" either.
Do you know a good gtkdialog program? Please post a link here

Classic Puppy quotes

ROOT FOREVER
GTK2 FOREVER

disciple
Posts: 6984
Joined: Sun 21 May 2006, 01:46
Location: Auckland, New Zealand

#29 Post by disciple »

If I haven't imagined it and there really was one, I think it was about the same time as that post though... maybe a couple of months later.
Do you know a good gtkdialog program? Please post a link here

Classic Puppy quotes

ROOT FOREVER
GTK2 FOREVER

mulluysavage
Posts: 53
Joined: Sat 01 May 2010, 01:49

#30 Post by mulluysavage »

I upgraded to 5.1.1 yesterday. I was concerned about my red blob, which I thought was a cpu meter! :) Today, my red blob has 5 lines, 4 of which are full. My computer runs fine, but I am wondering why I have so many threads! (Do I have a lot, it seems like it)

Asus M3N78 Pro
AMD Phenom Quad-Core @ 2.6 Ghz
3 GB RAM

disciple
Posts: 6984
Joined: Sun 21 May 2006, 01:46
Location: Auckland, New Zealand

#31 Post by disciple »

proximityinfotech1 wrote:Now the question is, is there a similar app that DOES graph CPU usage, and can be used in JWM?
There is gatotray, a proper trayapp http://www.murga-linux.com/puppy/viewto ... 173#493173
Or there is what Hairywill described above, which I seemed to miss at the time.
Last edited by disciple on Fri 06 Jan 2012, 02:05, edited 1 time in total.
Do you know a good gtkdialog program? Please post a link here

Classic Puppy quotes

ROOT FOREVER
GTK2 FOREVER

User avatar
Lobster
Official Crustacean
Posts: 15522
Joined: Wed 04 May 2005, 06:06
Location: Paradox Realm
Contact:

#32 Post by Lobster »

a monitor for running processes is actually a lot more useful as a diagnostic tool than a CPU meter.
Exactly so. 8)
Sometimes the meter is maxed out, a solid block . . .
This means both of my dual cores are occupied.
I should know why . . . I might be watching a video and doing some other task simultaneously . . .

Yesterday the meter was as streaky as bacon
(white lines)
Which indicated that several threads were running
Why? Been doing some pretend programming . . .
:roll:
By running Htop (Menu / System / System Status and Config in Puppy 5.3 or command line 'top') I could work out what they were . . . :idea:
'Restart X' cleared these still running threads . . . :)
Puppy Raspup 8.2Final 8)
Puppy Links Page http://www.smokey01.com/bruceb/puppy.html :D

disciple
Posts: 6984
Joined: Sun 21 May 2006, 01:46
Location: Auckland, New Zealand

#33 Post by disciple »

Lobster - I presume you are talking about a CPU usage meter in your first paragraph, and xload in your second paragraph...
Do you know a good gtkdialog program? Please post a link here

Classic Puppy quotes

ROOT FOREVER
GTK2 FOREVER

User avatar
banger0250
Posts: 44
Joined: Thu 12 Aug 2010, 20:23
Location: Rothwell,Brisbane,Qld,AU

#34 Post by banger0250 »

WOW, i have never checked this thread out, WOW. Wasn't expecting it to be so long. I always setup conky, Didn't know what that thing in the tray was. :)
Taking pup for a walk

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#35 Post by technosaurus »

banger0250 wrote:WOW, i have never checked this thread out, WOW. Wasn't expecting it to be so long. I always setup conky, Didn't know what that thing in the tray was. :)
same here, but I know how to fix it... /proc has a file that does show the 1,5 and 15 minute load average (I'm in my Droid, so can't check). Just use it to generate the image (there is an equivalent c function too) I wrote a script that will generate an xpm image with text and a percent bar which could be used by pnmmon or other generalized tray apps.
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].

Post Reply