Date: Sat, 1 Oct 2011 19:06:36 -0500 From: Dan Nelson <dnelson@allantgroup.com> To: ??????? ??????? <kes-kes@yandex.ru> Cc: freebsd-questions@freebsd.org Subject: Re: top: how to obtain which process take CPU time Message-ID: <20111002000636.GM9801@dan.emsphone.com> In-Reply-To: <3691887.20111001203849@yandex.ru> References: <3691887.20111001203849@yandex.ru>
next in thread | previous in thread | raw e-mail | index | archive | help
In the last episode (Oct 01), ??????? ??????? said: > hi, Freebsd-questions. > > last pid: 92665; load averages: 2.40, 2.68, 4.75 up 5+02:45:23 20:29:07 > 218 processes: 3 running, 215 sleeping > CPU: 59.6% user, 0.0% nice, 40.4% system, 0.0% interrupt, 0.0% idle > Mem: 225M Active, 81M Inact, 115M Wired, 3936K Cache, 60M Buf, 64M Free > Swap: 2048M Total, 190M Used, 1857M Free, 9% Inuse > > PID USERNAME THR PRI NICE SIZE RES STATE TIME WCPU COMMAND > 92520 cacti 1 -8 0 22796K 12656K piperd 0:00 1.46% php > 92593 cacti 1 -8 0 4620K 2316K piperd 0:00 1.46% perl5.8.8 > 92594 cacti 1 8 0 3460K 1120K wait 0:00 1.46% sh > 92592 cacti 1 8 0 3460K 1120K wait 0:00 1.46% sh > 92595 cacti 1 55 0 5448K 2692K select 0:00 1.37% snmpget > > top -SIHP > last pid: 99336; load averages: 1.47, 2.05, 3.66 up 5+02:52:06 20:35:50 > 291 processes: 6 running, 266 sleeping, 18 waiting, 1 lock > CPU: 52.2% user, 0.0% nice, 27.9% system, 0.0% interrupt, 19.9% idle > Mem: 236M Active, 81M Inact, 115M Wired, 3436K Cache, 60M Buf, 54M Free > Swap: 2048M Total, 189M Used, 1858M Free, 9% Inuse > > PID USERNAME PRI NICE SIZE RES STATE TIME WCPU COMMAND > 11 root 171 ki31 0K 8K RUN 70.1H 27.59% idle: cpu0 > 98502 cacti 8 0 23820K 12932K nanslp 0:00 0.20% php > 44054 root 8 0 3124K 524K nanslp 0:56 0.10% monitord > 99051 root 44 0 3496K 2020K RUN 0:00 0.10% top > 99331 cacti -8 0 4620K 2332K piperd 0:00 0.00% perl5.8.8 > 99326 cacti -8 0 4620K 2332K piperd 0:00 0.00% perl5.8.8 > > It is unclear which process take CPU time. > is there any other tool, which help me to see processes that take CPU? Take a look at the "last pid" values and the time of each top snapshot: > last pid: 92665; load averages: 2.40, 2.68, 4.75 up 5+02:45:23 20:29:07 > last pid: 99336; load averages: 1.47, 2.05, 3.66 up 5+02:52:06 20:35:50 So, in 7 minutes your system has launched 6671 processes, and in your first top snapshot I see sh and snmpget processses. The reason you don't see any processes in top consuming CPU is that they are being created and then exit before top can print them. If you turn process accounting on (add accounting_enable="YES" to /etc/rc.conf, then run "/etc/rc.d.d/accounting start"), you can run the "lastcomm" command to see a log of every process that has exited and its CPU usage. It won't really tell you any more than "you are running Cacti and monitoring a lot of devices" :) -- Dan Nelson dnelson@allantgroup.com
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20111002000636.GM9801>