Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

My system is SUSE 10 and I observe that top occupies 57% CPU usage when I use it.

top with 57% CPU

I don't have too many processes:

ps -eLf | wc -l
106

Here are top's stats:

cat /proc/2913/stat
2913 (top) R 2879 2913 2879 34819 2913 8396800 411 0 0 0 60648 199580 0 0 17 0 1 516504552 4811013274 2383872 285 4294967295 134512640 134596384 3215474448 3215470376 3085449998 0 0 0 138047495 0 0 0 17 3 0 0 0


cat /proc/2913/status 
Name:   top
State:  R (running)
SleepAVG:       79%
Tgid:   2913
Pid:    2913
PPid:   2879
TracerPid:      0
Uid:    0       0       0       0
Gid:    0       0       0       0
FDSize: 256
Groups: 0 
VmPeak:     2360 kB
VmSize:     2328 kB
VmLck:         0 kB
VmHWM:      1144 kB
VmRSS:      1140 kB
VmData:      260 kB
VmStk:        84 kB
VmExe:        84 kB
VmLib:      1788 kB
VmPTE:        16 kB
Threads:        1
SigQ:   2/16383
SigPnd: 0000000000000000
ShdPnd: 0000000000000000
SigBlk: 0000000000000000
SigIgn: 0000000000000000
SigCgt: 00000000083a7007
CapInh: 0000000000000000
CapPrm: 00000000fffffeff
CapEff: 00000000fffffeff
Cpus_allowed:   00000000,00000000,00000000,0000000f
Mems_allowed:   1

## cat /proc/2913/statm
582 285 213 21 0 86 0

What can I do next to find the reason why the top command is using so much CPU?

share|improve this question
    
I find the root cause。 –  DaVid Mar 13 '12 at 2:40
    
top will read /var/run/utmp file to get active user number. But this file is so big with 178M. top spends about 8s to read it that maybe occupies 57% CPU usage. Change utmp size to 10 K, top command doesn't occupy more CPU usage. –  DaVid Mar 13 '12 at 2:42
add comment

1 Answer

Your server is up 556 days. Though this shouldn't be a problem it is possible the long uptime is causing some funky behaviour like you're noticing. Without any identifiable cause. In my experience in such situations a fresh reboot clears up the problem right away. I understand it's a stupid solution, but why waste more time figuring it out?

If a reboot doesn't fix it then it's worth looking into it more deeply.

share|improve this answer
    
As you know, reboot is not a good way. Top command is a more popular tool to investigate other problem for Maintenance Engineer or Operation Engineer. –  DaVid Mar 13 '12 at 2:47
    
Yes but it's his top command that is behaving strangely, i.e. it's using more CPU % than it should. Top normally only uses a couple of %. In this case using top to find out why top is behaving strangely is not the best thing to do. :-) –  aseq Mar 13 '12 at 18:28
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.