Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
i programmed my own reporting client/server which reports host load
it ran last night, very well, but i don't understand this:
the logging intervall is every 30 seconds
i log the cpu load using /proc/stat
and i log the top 3 processes using top
my problem now is
i got some very high cpu load spikes over a half an hour
but the top processes were as low as ever!?
is it possible, that the /proc/stat cpu load is high but, top reports nearly sleeping processes?
maybe /proc/stat is a relative
for top i'm using the command
top -n 1 -b
what also could be a problem is that top influences it's own statistics
which means
if i run top -n 1 -b and the cpu is idle, the top process will consum high cpu time
which could also influence my measures
anybody knows an alternative to top?
can i read in /proc which processes consume most cpu?
and my question is:
is it possible, that cpu load is very high, but "top" reports just 3.8% cpu for the process "top" and every other process is nearly 0.0%?
Well, I solved the problem on my machine. As it turns out, the problem was transparency. I had all my terminals set to transparent backgrounds - and I guess this old company machine doesn't have enough power to handle that.
well just basically you got to dig.
all the stats in /poc got limitations thats for sure, or they would have to spend lots of time doing /proc junk instead of writing system code.
its very confusing when you say tranperance fixed BUT X was not showing up as the culprit.
see X has the video card memory and what not to deal with
perhaps it would help also to turn down RT tick frequencies ? do you interupt frequencies turnrd way up ?
i killed a P4 like that once faster than you can say, "why does my system keep freezing up"
Subtract top's cpu idle time (%id) from 100% and you'll see it's the same number gkrellm is reporting. I think they're both getting that info from vmstat anyway.
Code:
[climber@lode ~]$ top
top - 05:33:19 up 16 days, 13:48, 2 users, load average: 0.09, 0.20, 0.18
Tasks: 141 total, 2 running, 139 sleeping, 0 stopped, 0 zombie
Cpu(s): 0.0%us, 0.0%sy, 0.0%ni, 99.7%id, 0.0%wa, 0.3%hi, 0.0%si, 0.0%st
Mem: 954560k total, 902380k used, 52180k free, 196300k buffers
Swap: 4192924k total, 38984k used, 4153940k free, 355816k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
27584 root 16 0 12708 1076 792 S 0.3 0.1 0:00.27 top
1 root 15 0 10304 568 540 S 0.0 0.1 0:00.73 init
2 root RT 0 0 0 0 S 0.0 0.0 0:00.00 migration/0
3 root 34 19 0 0 0 S 0.0 0.0 0:10.10 ksoftirqd/0
4 root RT 0 0 0 0 S 0.0 0.0 0:00.00 watchdog/0
5 root 10 -5 0 0 0 S 0.0 0.0 0:18.86 events/0
6 root 12 -5 0 0 0 S 0.0 0.0 0:00.00 khelper
7 root 13 -5 0 0 0 S 0.0 0.0 0:00.00 kthread
9 root 10 -5 0 0 0 S 0.0 0.0 0:00.00 xenwatch
10 root 10 -5 0 0 0 S 0.0 0.0 0:00.00 xenbus
49 root 10 -5 0 0 0 S 0.0 0.0 0:00.05 kblockd/0
50 root 20 -5 0 0 0 S 0.0 0.0 0:00.00 kacpid
169 root 20 -5 0 0 0 S 0.0 0.0 0:00.00 cqueue/0
171 root 20 -5 0 0 0 S 0.0 0.0 0:00.00 ksuspend_usbd
174 root 10 -5 0 0 0 S 0.0 0.0 0:00.00 khubd
176 root 10 -5 0 0 0 S 0.0 0.0 0:00.00 kseriod
198 root 15 0 0 0 0 S 0.0 0.0 0:00.16 pdflush
[climber@lode ~]$ vmstat
procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------
r b swpd free buff cache si so bi bo in cs us sy id wa st
0 0 38984 44296 196536 356332 0 0 2 6 3 29 4 2 93 0 0
And from vmstat's man page FWIW:
Code:
CPU
These are percentages of total CPU time.
us: Time spent running non-kernel code. (user time, including nice time)
sy: Time spent running kernel code. (system time)
id: Time spent idle. Prior to Linux 2.5.41, this includes IO-wait time.
wa: Time spent waiting for IO. Prior to Linux 2.5.41, included in idle.
st: Time stolen from a virtual machine. Prior to Linux 2.6.11, unknown.
as the link describes the values in /proc/stat identify the amount of time (that's why it doesn't decrease, cause time continues ) the cpu has spent in what kind of "work"
for example, the first /proc/stat line shows like this at t0
cpu user nice system idle iowait irq softirq (dont know)
cpu 736324 49874 581102 298162832 3012015 120311 0 0
a few seconds later (t1):
cpu 736334 49874 581102 298162971 3012015 120311 0 0
differences:
cpu 10 0 0 139 0 0 0 0
all numbers together at t0 are: 302662458
a few seconds later (t1): 302662607
difference (t1-t0): 149
the difference 149 is 100% cpu time
so it seems the cpu has spent 93.28% (139 time unit's (seems to be USER_HZ)) in cpu idle
and 6.72% in user mode
i think the problem with top is that top causes cpu load too, which tapmers the cpu values
i think the problem with top is that top causes cpu load too, which tapmers the cpu values
Mmmm - see this discussion on the observer effect.
At the default 3 second interval, I would say top is the lightest of the samplers - they all probe /proc after all.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.