Re: top -b -n 1

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Dec 23, 2007 6:09 AM, Peter Lauri <peterlauri@xxxxxxxxx> wrote:
> -d is just giving the "Delay Time" so it is not giving me what I need. I
> need top to just output the current status to STDOUT and after that exit.
> The only way to do that is to go with the -b option, but that one seams to
> be "averaging" the values instead of giving the current status.
>
> So to move out of the "top box": how can I get a "snap shot" of the current
> CPU load?
>
> /Peter
>
>
>
>
> On Dec 23, 2007 1:18 AM, John Summerfield < debian@xxxxxxxxxxxxxxxxxxxxxx>
> wrote:
> >
> > -d
> > but be realistic, you don't want top dominating the system.
> >
> >
> > --
> >
> > Cheers
> > John
> >
> > -- spambait
> > 1aaaaaaa@xxxxxxxxxxxxxxxx  Z1aaaaaaa@xxxxxxxxxxxxxxxx
> > -- Advice
> > http://webfoot.com/advice/email.top.php
> > http://www.catb.org/~esr/faqs/smart-questions.html
> > http://support.microsoft.com/kb/555375
> >
> > You cannot reply off-list:-)
> >
> > --
> > fedora-list mailing list
> > fedora-list@xxxxxxxxxx
> > To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
> >
>
>
> --
> fedora-list mailing list
> fedora-list@xxxxxxxxxx
> To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
>

Hi Peter Lauri!

Thanks! You moved me to find a cool tool.  In the sysstat package is a
command called sar. Please note the following session:
----------------------------------------------------------------------------------
[tod@localhost ~]$ sar -u 1 5
Linux 2.6.23.8-34.fc7 (localhost.localdomain)   12/25/2007

02:46:47 AM     CPU     %user     %nice   %system   %iowait    %steal     %idle
02:46:48 AM     all      7.07      0.00      2.02      0.00      0.00     90.91
02:46:49 AM     all     85.00      0.00      4.00      0.00      0.00     11.00
02:46:50 AM     all      8.00      0.00      3.00      0.00      0.00     89.00
02:46:51 AM     all      7.00      0.00      1.00      0.00      0.00     92.00
02:46:52 AM     all      6.00      0.00      3.00      0.00      0.00     91.00
Average:        all     22.65      0.00      2.61      0.00      0.00     74.75
[tod@localhost ~]$ sar -u 1 5
Linux 2.6.23.8-34.fc7 (localhost.localdomain)   12/25/2007

02:47:11 AM     CPU     %user     %nice   %system   %iowait    %steal     %idle
02:47:12 AM     all      8.00      0.00      2.00      0.00      0.00     90.00
02:47:13 AM     all      7.00      0.00      3.00      0.00      0.00     90.00
02:47:14 AM     all      7.00      0.00      3.00      0.00      0.00     90.00
02:47:15 AM     all      7.07      0.00      2.02      0.00      0.00     90.91
02:47:16 AM     all      6.93      0.00      2.97      0.00      0.00     90.10
Average:        all      7.20      0.00      2.60      0.00      0.00     90.20
[tod@localhost ~]$ sar -u 1 5 > cpu.txt
[tod@localhost ~]$ cat cpu.txt
Linux 2.6.23.8-34.fc7 (localhost.localdomain)   12/25/2007

02:47:35 AM     CPU     %user     %nice   %system   %iowait    %steal     %idle
02:47:36 AM     all      7.00      0.00      2.00      0.00      0.00     91.00
02:47:37 AM     all      7.92      0.00      2.97      0.99      0.00     88.12
02:47:38 AM     all      5.10      0.00      1.02      0.00      0.00     93.88
02:47:39 AM     all      4.95      0.00      1.98      0.00      0.00     93.07
02:47:40 AM     all      6.06      0.00      2.02      0.00      0.00     91.92
Average:        all      6.21      0.00      2.00      0.20      0.00     91.58
[tod@localhost ~]$
--------------------------------------------------------------------------
Actually you can cause the program to create a binary file and then
use it again to display the binary data normally.  You have full
control of interval.  You also have a lot of cool troubleshooting
options such as finding how much a specific process is using the CPU.

I found the package for my Fedora 7 using Applications > Add/Remove
Software, clicking the Search tab, and then entering sysstat.

Enjoy!

Tod


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux