From won.derick at yahoo.com Fri Aug 15 07:26:38 2008 From: won.derick at yahoo.com (Won De Erick) Date: Fri Aug 15 07:26:51 2008 Subject: Fw: CPU Utilization on IBM x3755 Message-ID: <847976.42317.qm@web45803.mail.sp1.yahoo.com> forwarding the thread to freebsd-testing@freebsd.org, freebsd-performance@freebsd.org Hello, I was wondering what are the processes running on my machine after checking the CPU utilization using ps and top commands. My Platform is IBM x3755 (w/ 8 CPUs) running FreeBSD 6.2. 1. Using top -S last pid: 90083; load averages: 0.22, 0.19, 0.17 up 5+00:26:5515:27:07 186 processes: 19 running, 152 sleeping, 15 waiting CPU states: 0.9 % user, 0.0 % nice, 7.2 % system, 0.0 % interrupt, 91.9% idle Mem: 54M Active, 22M Inact, 76M Wired, 26M Buf, 29G Free Swap: 6144M Total, 6144M Free PID USERNAME THR PRI NICE SIZE RES STATE C TIME WCPU COMMAND 17 root 1 171 52 0K 16K RUN 0 101.2H 98.97% idle: cpu0 13 root 1 171 52 0K 16K RUN 4 105.7H 96.83% idle: cpu4 15 root 1 171 52 0K 16K RUN 2 114.1H 96.04% idle: cpu2 12 root 1 171 52 0K 16K CPU5 5 109.8H 93.75% idle: cpu5 16 root 1 171 52 0K 16K RUN 1 109.5H 86.18% idle: cpu1 14 root 1 171 52 0K 16K RUN 3 113.7H 86.04% idle: cpu3 10 root 1 171 52 0K 16K RUN 7 111.4H 83.98% idle: cpu7 11 root 1 171 52 0K 16K RUN 6 110.8H 81.98% idle: cpu6 57213 root 10 20 0 14512K 4548K RUN 7 388:19 0.00% smd 18 root 1 -32 -151 0K 16K CPU0 0 83:07 0.00% swi4: clock sio 45 root 1 171 52 0K 16K pgzero 3 3:05 0.00% pagezero . . . 57094 root 1 8 0 31356K 9180K wait 6 0:01 0.00% php-cgi 18533 admin 1 96 0 30732K 4308K select 6 0:01 0.00% sshd90137 0.29, 0.20, 0.17 up 5+00:26:5715:27:09 [a] Average CPU Utilization = 0.9 % user + 7.2 % system = 8.1% = 100 - 91.9 = 8.1% 98.97 + 96.83 + 96.04 + 93.75 + 86.18 + 86.04 + 83.98 + 81.98 [b] Average CPU Utilization = 100 - ----------------------------------------------------------------------- = 9.53 % 8 2. Using ps -aux USER PID %CPU %MEM VSZ RSS TT STAT STARTED TIME COMMAND root 17 99.0 0.0 0 16 ?? RL Fri03PM 6074:32.36 [idle: cpu0] root 13 97.0 0.0 0 16 ?? RL Fri03PM 6339:48.43 [idle: cpu4] root 15 96.2 0.0 0 16 ?? RL Fri03PM 6847:42.20 [idle: cpu2] root 12 94.4 0.0 0 16 ?? RL Fri03PM 6586:50.10 [idle: cpu5] root 16 85.9 0.0 0 16 ?? RL Fri03PM 6567:57.05 [idle: cpu1] root 14 85.4 0.0 0 16 ?? RL Fri03PM 6823:20.19 [idle: cpu3] root 10 85.2 0.0 0 16 ?? RL Fri03PM 6683:28.54 [idle: cpu7] root 11 81.9 0.0 0 16 ?? RL Fri03PM 6646:11.63 [idle: cpu6] root 0 0.0 0.0 0 0 ?? WLs Fri03PM 0:00.00 [swapper] root 1 0.0 0.0 912 460 ?? ILs Fri03PM 0:00.58 /sbin/init -- . . . admin 19027 0.0 0.0 12480 3384 p2 Ss+ 12:06PM 0:00.13 -clish (clish) root 19207 0.0 0.0 2604 940 p2 S+ 12:07PM 0:07.65 /usr/sbin/clog -f /var/log/dhcpd.log 99 + 97 + 96.2 + 94.4 + 85.9+ 85.4 + 85.2 + 81.9 Average CPU Utilization = 100 - --------------------------------------------------------- = 9.375 % 8 Question 1: What is the difference between 1 [a] and 1 [b]? Question 2: What are the processes (system?) that are running that resulted to 1 [b]? top -S is just giving a name idle: cpu0, idle: cpu1, etc. under the command column. Question 3: Is it logical to compare the average CPU utilization results obtained in number 1 and 2? How are they differ? Question 4. Are there other tools that I can use to accurately get the running processes that are eating the actual CPU resources on the machine? Please shed me some lights.. Thanks, Won From koitsu at FreeBSD.org Fri Aug 15 12:06:49 2008 From: koitsu at FreeBSD.org (Jeremy Chadwick) Date: Fri Aug 15 12:07:01 2008 Subject: CPU Utilization on IBM x3755 In-Reply-To: <224002.6575.qm@web45816.mail.sp1.yahoo.com> References: <224002.6575.qm@web45816.mail.sp1.yahoo.com> Message-ID: <20080815114655.GA83634@eos.sc1.parodius.com> On Fri, Aug 15, 2008 at 02:03:06AM -0700, Won De Erick wrote: > > The utilities you're using are correct (ps and top), but I don't know > > why you're using top -S since it's pretty apparent you don't know how to > > read the output. :-) > > thanks for the lights. > > I may not be well verse in interpreting the output, but I am using top -S to make other system processes (like pager, swapper) visible. > I just wondered why the command name should be idle : cpu0, etc. instead of giving a little bit more descriptive name (like what you said, kernel thread bla bla). With this, it would be more understandable. An ordinary user like me could mistakenly interpret it as an "actual" process. First and foremost, I'm not sure why you cross-posted this on 3 separate lists (testing, performance, and hardware). You probably should have posted this on freebsd-questions, and if no response after a week or so, again on freebsd-stable (although you're using FreeBSD 6.2). It's generally shunned by the FreeBSD mailing list community to cross-post to so many lists. Just something to keep in mind for the future. > > You shouldn't be using -S if you're just interested in actual processes > > on the UNIX machine itself. > > Then what should I use? I am interested in getting the detailed info to justify the %CPU idles and utilization. Of the entire machine? You can see that in top's header: last pid: 84636; load averages: 0.47, 0.14, 0.04 up 79+01:15:18 04:46:01 75 processes: 2 running, 70 sleeping, 3 stopped CPU: 28.6% user, 0.0% nice, 8.2% system, 0.0% interrupt, 63.3% idle Mem: 207M Active, 2433M Inact, 212M Wired, 91M Cache, 112M Buf, 57M Free Swap: 8192M Total, 228K Used, 8192M Free Regarding why you're adding up all the individual process statistics: I can imagine they would vary a slight bit, but I cannot explain a 7% variance. Someone with more knowledge will have to assist there. -- | Jeremy Chadwick jdc at parodius.com | | Parodius Networking http://www.parodius.com/ | | UNIX Systems Administrator Mountain View, CA, USA | | Making life hard for others since 1977. PGP: 4BD6C0CB | From won.derick at yahoo.com Sat Aug 16 08:18:20 2008 From: won.derick at yahoo.com (Won De Erick) Date: Sat Aug 16 08:18:32 2008 Subject: CPU Utilization on IBM x3755 Message-ID: <897559.10614.qm@web45814.mail.sp1.yahoo.com> >First and foremost, I'm not sure why you cross-posted this on 3 separate >lists (testing, performance, and hardware). You probably should have >posted this on freebsd-questions, and if no response after a week or so, >again on freebsd-stable (although you're using FreeBSD 6.2). >It's generally shunned by the FreeBSD mailing list community to >cross-post to so many lists. Just something to keep in mind for the >future. Thanks for this reminder. I am testing my hardware against FreeBSD, and I just want to reach those people under the said areas (testing, performance, hardware) with the hope to get speedy response. >> Then what should I use? I am interested in getting the detailed info to justify the %CPU idles and utilization. >Of the entire machine? You can see that in top's header: >last pid: 84636; load averages: 0.47, 0.14, 0.04 up 79+01:15:18 04:46:01 >75 processes: 2 running, 70 sleeping, 3 stopped >CPU: 28.6% user, 0.0% nice, 8.2% system, 0.0% interrupt, 63.3% idle >Mem: 207M Active, 2433M Inact, 212M Wired, 91M Cache, 112M Buf, 57M Free >Swap: 8192M Total, 228K Used, 8192M Free >Regarding why you're adding up all the individual process statistics: I >can imagine they would vary a slight bit, but I cannot explain a 7% >variance. Someone with more knowledge will have to assist there. Though the header could be conclusive, I should want the specific processes (or threads). And come up with a list of breakdowns, like: User (28.6%) 1. Program1 -- 20.0% 2. Program2 -- 8.6% System(8.2%) 1. SystemProcess1 -- X % 2. (and so on) -- Y % Then match this by adding up all individual processes statistics. And if I couldn't match, at least I could tell some factors that cause variance. This variance has really struck my attention. When I run "top -SI", the result was: last pid: 2746; load averages: 0.20, 0.16, 0.10 up 0+00:07:38 15:54:26 125 processes: 12 running, 100 sleeping, 16 waiting CPU states: 0.3% user, 0.0% nice, 6.4% system, 0.0% interrupt, 93.2% idle Mem: 42M Active, 18M Inact, 62M Wired, 20M Buf, 27G Free Swap: PID USERNAME THR PRI NICE SIZE RES STATE C TIME WCPU COMMAND 17 root 1 171 52 0K 16K RUN 0 6:05 99.02% idle: cpu0 15 root 1 171 52 0K 16K CPU2 2 6:05 99.02% idle: cpu2 14 root 1 171 52 0K 16K CPU3 3 6:28 96.58% idle: cpu3 10 root 1 171 52 0K 16K CPU7 7 6:19 92.24% idle: cpu7 11 root 1 171 52 0K 16K CPU6 6 6:22 92.09% idle: cpu6 16 root 1 171 52 0K 16K CPU1 1 6:30 91.26% idle: cpu1 12 root 1 171 52 0K 16K CPU5 5 6:26 84.47% idle: cpu5 13 root 1 171 52 0K 16K CPU4 4 6:36 83.50% idle: cpu4 The header says 12, but there were only 8 processes displayed. Sometimes it goes down to 10, but not 8. Hope you can shed me more lights on this. From chris at shagged.org Sat Aug 16 17:33:41 2008 From: chris at shagged.org (Chris Elsworth) Date: Sat Aug 16 17:33:53 2008 Subject: CPU Utilization on IBM x3755 In-Reply-To: <897559.10614.qm@web45814.mail.sp1.yahoo.com> References: <897559.10614.qm@web45814.mail.sp1.yahoo.com> Message-ID: <20080816173339.GA34116@thestra.telon.net> On Sat, Aug 16, 2008 at 01:18:18AM -0700, Won De Erick wrote: > >Regarding why you're adding up all the individual process statistics: I > >can imagine they would vary a slight bit, but I cannot explain a 7% > >variance. Someone with more knowledge will have to assist there. > > Though the header could be conclusive, I should want the specific processes (or threads). > And come up with a list of breakdowns, like: > > Then match this by adding up all individual processes statistics. And if I couldn't match, at least I could tell some factors that cause variance. At the bottom of man top, reformatted for email width: As with ps(1), things can change while top is collecting information for an update. The picture it gives is only a close approximation to reality. Could this explain the variations you are seeing? top never gives you an accurate snapshot of what the system is doing at any one instant in time, afaik. -- Chris From won.derick at yahoo.com Sun Aug 17 08:36:18 2008 From: won.derick at yahoo.com (Won De Erick) Date: Sun Aug 17 08:36:24 2008 Subject: CPU Utilization on IBM x3755 Message-ID: <117484.97387.qm@web45813.mail.sp1.yahoo.com> On Sat, Aug 16, 2008 at 01:18:18AM -0700, Won De Erick wrote: >> >Regarding why you're adding up all the individual process statistics: I >> >can imagine they would vary a slight bit, but I cannot explain a 7% >> >variance. Someone with more knowledge will have to assist there. >> >> Though the header could be conclusive, I should want the specific processes (or threads). >> And come up with a list of breakdowns, like: >> >> Then match this by adding up all individual processes statistics. And if I couldn't match, at least I could tell some factors that cause variance. > >At the bottom of man top, reformatted for email width: > > As with ps(1), things can change while top is collecting > information for an update. The picture it gives is only > a close approximation to reality. > >Could this explain the variations you are seeing? top never gives you >an accurate snapshot of what the system is doing at any one instant in >time, afaik. >-- >Chris I'm aware with this limitation as displayed using man top. But when I ran top -SI, I only got 8 processes out of 12 processes [actively] running as displayed on the header making it far from reality. I did this several times, restarting the machine, bootstrapping, etc, but I got same result. I don't know what kernel threads are causing top -S to display the command as "idle: cpu0", "idle : cpu1", ... "idle:cpu7". Though Jeremy had mentioned them as simply kernel threads (due to lack of term), I should at least dig deeper on this matter and be able to specifically classify them.