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

xload is NOT a CPU usage meter

#1 Post by disciple »

I just thought I needed to burst some bubbles, because there are far too many people who think xload (the little graph in the JWM tray) shows the proportion of CPU being used. (N.B. if you use Icewm or Lxpanel or something you may have a similar graph that DOES show this).
It actually shows the number of processes (or threads or something) that want to use the cpu and therefore varies between 0 and infinity, rather than 0 and 1. This is why it changes scale, and you can get a whole lot of white horizontal lines to indicate the change.

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.

BTW if you Google it you'll find an app called xcpuload that I think does what a lot of people expect xload to do. But I can't get it to compile.
Last edited by disciple on Fri 15 Aug 2008, 21:45, 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
Eyes-Only
Posts: 1043
Joined: Thu 10 Aug 2006, 06:32
Location: La Confederation Abenaquaise

#2 Post by Eyes-Only »

Hi Disciple,

Not sure if I'm following you here 100% so I may be way off base. If so please feel free to disregard this, okie? :)

I use Conky myself on all my desktops, and on that I have a "CPU graph" of a sort. It's a box inside a transparent window going across the window's width (I have it set for 200px I believe) and as the bar goes across it'll give me a percentage of how much of the CPU is being used.

Then, not much further down from that I also have "Process" which is like a "ultra-mini-top", just telling me how many programmes are running in the background---the first number is "sleeping" and the second is "active".

So with Conky I have both which I've found to be far more accurate than either of the bar graphs in JWM/IceWM, which is why I run it of course. ;)

However, unlike others you may have seen with huge Conky readouts onto the desktop (like torsomo?), I have mine in a small window with just the very basic of data. Mine doesn't make my coffee for me. :D

Doubtful any of this helps but I thought I'd throw it in. Conky you can get from Mark's PSI I believe, and definitely GSlapt if using 3.0.x

Amicalement,

Eyes-Only
"L'Peau-Rouge"
*~*~*~*~*~*
Proud user of LXpup and 3-Headed Dog. 8)
*~*~*~*~*~*

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

#3 Post by disciple »

Yes, but Conky and Torsmo seem to be a reasonable drain on older systems, and it would be nice if there was something that could be swallowed in the taskbar like xload :)
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

#4 Post by disciple »

BTW from my post in another thread:
The VERY few times I have stability problems in Puppy, it is generally because a buggy application (notably fotox, but we got it fixed) is causing huge cpu load, but usually isn't actually using the cpu much. Don't ask me how this is possible, but it happens. Do you have the white lines? Usually I find the cpu load start to climb and I see more and more lines, and everything gets slower and slower, until it is essentially frozen.
Do you know a good gtkdialog program? Please post a link here

Classic Puppy quotes

ROOT FOREVER
GTK2 FOREVER

User avatar
zigbert
Posts: 6621
Joined: Wed 29 Mar 2006, 18:13
Location: Valåmoen, Norway
Contact:

#5 Post by zigbert »

I made a small experiment trying to get jwm-tray to swallow a tiny conky.
- I'm just not good enough :cry:

My thought was that conky could replace xload, freemem and battery applet.
This would have 'cleaned up' the tray-mess.

Do anyone know if it is possible to swallow conky?


Sigmund

mrd
Posts: 124
Joined: Wed 28 Nov 2007, 02:04

#6 Post by mrd »

Why is this so hard to do? All I want is asapm in the tray. I guess I could write a perlTK app that does it brute force?

Does anyone know how to do this?

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

#7 Post by vtpup »

I'm kind of curious what the purpose of xload is, therefore. If the scale changes dynamically (it is scaleless also) and it just shows some graphic non-regular view of processes "or threads or whatever" what use is it? How, by looking at it can you tell anything useful? Seems like it's kind of alarmist to a newbie.

There is not only no scale, but no indication what kind of (changing) divisions are shown -- linear -- logarithmic?

The only comment here that seems to indicate someone got some info from it is that when his system had a problem, the number of horizontal lines increased. But of course he had other more obvious indications that something was wrong -- like the fact that his system had slowed to a standstill.

Is there any advice about what to do with what you see in xload? Stop and do this, if you see that? I haven't seen any.

If there is no obvious purpose, then why have it?

jeffrey
Posts: 168
Joined: Mon 16 Jan 2006, 04:20
Location: Christchurch, New Zealand

#8 Post by jeffrey »

The purpose of xload is to indicate how heavily utilised the CPU has been over the past minute or so. This helps the user to determine if the CPU is busy and also if it is overworked. If your xload indicator is not very active either your machine is idle or your CPU is fast enough to cope with the work that you are giving it.
Personally I find it quite a useful indicator and I sometimes miss it when running other distributions, especially if I think that I asked it to start some process but noting has appeared several seconds later.

Stevo954
Posts: 14
Joined: Thu 27 Nov 2008, 05:05

#9 Post by Stevo954 »

It helps me know when I have too many programs open. When I see a big spike in the graph, the computer will usually start to slow down (Which makes since, because it is the number of requests going to the processor).

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

#10 Post by vtpup »

A big spike can mean you are using 5% the processor's capacity or 95% because of the variable scaling. I have no issue with an absolute percentage scale processor meter. I do have an issue with one which has no obvious relationship to the processor usage of the computer it is running on.

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

#11 Post by disciple »

If your xload indicator is not very active either your machine is idle or your CPU is fast enough to cope with the work that you are giving it.
No. The whole point in this thread was to point out that it isn't a CPU meter, so it doesn't show processor usage.
I have no issue with an absolute percentage scale processor meter.
It is a thread count, and you can't display a thread count as a percentage. If you don't like a thread count you can always get rid of it. Personally I would like something that displayed % CPU usage as well, but I haven't yet found one to use in JWM (and I've done a lot of looking). The most likely way to get one would probably be to hack one from another WM.

The thread count is useful for indicating if programs aren't working properly - e.g. in the past, bugs in Firefox and Thunderbird would cause my thread count to increase and then stay high even after I closed them, and I've seen one or two programs where something would go wrong and the thread count would increase rapidly, eventually freezing X. Xload helped diagnose the problem (which was fixed), and also before the fix warned me when I needed to kill the program in a hurry.
A cpu meter does not give you the same sort of information - if the cpu is running at 100% it gives you no indication of whether it should be running at 100%.
A big spike can mean you are using 5% the processor's capacity or 95% because of the variable scaling.
But it has white lines to tell you when the scale changes...
The only comment here that seems to indicate someone got some info from it is that when his system had a problem, the number of horizontal lines increased. But of course he had other more obvious indications that something was wrong -- like the fact that his system had slowed to a standstill.
As well as the points above, I'd point out that the FF/Thunderbird problems didn't dramatically slow the machine down, so xload was the best indication of a problem.
Is there any advice about what to do with what you see in xload? Stop and do this, if you see that? I haven't seen any.
Maybe only what I've said - unless you can find a manual or something. I think it isn't useful unless you understand what it really means, or maybe if you notice and report what it does when you are experiencing a problem.
If there is no obvious purpose, then why have it?
We could get rid of it (I think it might be turned off by default in 4.2) - or we could educate people about what it really is. It really needs a help page, and for it to be accessible with a right-click. But the free memory applet needs more accessible documentation even more badly.
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:

#12 Post by vtpup »

What newbie knows that a big red peaking blob on the lower right is no problem because it doesn't have white lines?

Should they read a man page first about it before opening puppy from a LiveCD, so it doesn't confuse them? I went several weeks without realizing it was relative, myself. Since my thread count was low and I'd never seen white lines, I sure didn't understand that all that red meant "no problem", no white lines. I thought Puppy seemed pretty resource intensive.

Why don't we put speedometers in cars with scales that change every 10 mph or km and remove all markings, including the label "speed." Make them a big red graph, while we're at it.

Some machines will choke on no white lines and others will need five of them to slow down. How many white lines are permissable for any particular computer? Maybe we should consult a list before using Puppy :lol: .

The very special circumstances where the person knows what this gadget represents, knows their machine, knows what the normal range is for scale ordinates, and for particular programs, and uses this gizmo to troubleshoot in let's face it, a very crude way, is pretty limited.

Limited enough so that those who actually want a variable scale thread graph should load it as an optional .pet rather than confuse everyone else.

I mean why was this thread necessary if the red blob wasn't misunderstood by pretty much everybody. Do we really need a feature that requires this kind of sticky?

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

#13 Post by HairyWill »

Code: Select all

cat /proc/loadavg | cut -f 1 -d ' '
brad-chuck recently wrote a battery monitor that provided a generic interface to a gtk tray icon
bolt these two together and you have a meter showing the 1 minute load average
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]

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

#14 Post by disciple »

What newbie knows that a big red peaking blob on the lower right is no problem because it doesn't have white lines?
Yes, it should say what it is. But why did you assume you had a problem if you didn't know what you were looking at?
Why don't we put speedometers in cars with scales that change every 10 mph or km and remove all markings, including the label "speed."
Because cars have a maximum speed and a lot of space in the dashboard to fit labels. I think it needs a tooltip.
The very special circumstances where the person knows what this gadget represents, knows their machine, knows what the normal range is for scale ordinates, and for particular programs, and uses this gizmo to troubleshoot in let's face it, a very crude way, is pretty limited.
It isn't just for when you need to troubleshoot. It is useful information to see. And it wouldn't be very good if it was a feature we suggested to install when people need to troubleshoot, as then they would have no idea how it normally behaves.
I mean why was this thread necessary if the red blob wasn't misunderstood by pretty much everybody. Do we really need a feature that requires this kind of sticky?
Yes, the thread is needed because lots of people don't understand it. It is a very useful feature if you understand it. But it is the sort of thing that people would never discover if it wasn't in the Livecd. We need information, not to remove features.
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:

#15 Post by vtpup »

disciple wrote: Yes, it should say what it is. But why did you assume you had a problem if you didn't know what you were looking at?
answer:
Because I thought it was a CPU usage meter

quiz:
Name the title of one of only two sticky threads in the USERs section of a 250,000 post forum

bonus question:
What's wrong with this sentence:
It actually shows the number of processes (or threads or something)

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]

Post Reply