Link to home
Start Free TrialLog in
Avatar of monto1
monto1

asked on

interpretation of TOP command

Can anybody makes me understand the output of TOP command .and how can i know much CPU this box has.

System: hawk                                          Wed Nov 14 18:57:02 2007
Load averages: 3.90, 3.41, 3.69
239 processes: 217 sleeping, 22 running
Cpu states:
 LOAD   USER   NICE    SYS   IDLE  BLOCK  SWAIT   INTR   SSYS
 3.90   6.9%   0.0%   3.0%  90.1%   0.0%   0.0%   0.0%   0.0%

Memory: 2479160K (1624320K) real, 4883816K (3706360K) virtual, 326932K free  Page# 1/8

 TTY  PID USERNAME PRI NI   SIZE    RES STATE    TIME %WCPU  %CPU COMMAND
  ? 12409 aauasqa1 152 20   228M 41992K run      0:06  8.28  7.49 n
  ? 12386 aauasqa1 152 20   228M 42232K run      0:06  6.56  6.03 n
  ? 12367 aauasqa1 152 20   229M 43052K run      0:06  6.31  5.81 n
  ? 16576 root     152 20   319M 73480K run    668:09  1.51  1.51 java
  ?  2188 aduasqa1 154 20   607M 11436K sleep  363:54  1.49  1.48 oracleamuasqa1
  ?  6564 oracle   154 20  8312K   656K sleep    0:00  0.57  0.57 sshd:
  ? 23644 aduasqa1 152 20   518M 94708K run     10:25  0.53  0.53 java
  ?    31 root     152 20  7424K  7424K run    325:07  0.42  0.42 vxfsd
  ? 12451 aduasqa1 154 20   602M  5668K sleep    0:00  0.45  0.38 oracleamuasqa1
  ?  2430 aauasqa1 152 20   682M 40008K run      5:54  0.37  0.37 n
  ? 12408 qa1forte 154 20 21620K  6936K sleep  246:14  0.34  0.34 nodemgr
  ? 12612 root     152 20   295M   124M run    129:20  0.32  0.32 java
  ? 12443 aduasqa1 154 20   602M  5668K sleep    0:00  0.35  0.31 oracleamuasqa1
  ? 12447 aduasqa1 154 20   602M  5668K sleep    0:00  0.35  0.30 oracleamuasqa1
  ? 12457 aduasqa1 154 20   603M  6020K sleep    0:00  0.27  0.21 oracleamuasqa1
  ?  1503 root      50 20 23928K  2308K run    911:44  0.20  0.20 midaemon
  ?  2379 aduasqa1 154 20   603M  7740K sleep   11:24  0.19  0.19 oracleamuasqa1
  ?  2136 root     152 20 16096K  2528K run     22:10  0.18  0.18 rep_server
  ?  2138 root     152 20 13528K  1572K run     17:00  0.18  0.18 agdbserver
  ? 12449 aduasqa1 154 20   601M  4980K sleep    0:00  0.20  0.17 oracleamuasqa1
  ? 12455 aduasqa1 154 20   602M  5940K sleep    0:00  0.21  0.17 oracleamuasqa1
  ? 12453 aduasqa1 154 20   602M  6132K sleep    0:00  0.20  0.17 oracleamuasqa1
  ? 21673 aduasqa1 152 20   652M   602M run      7:21  0.16  0.16 emagent
  ?  1535 root     127 20 45656K 13336K sleep  245:32  0.16  0.16 scopeux
  ? 24707 amwmqa   152 20 20324K  5400K run      1:06  0.16  0.16 nodemgr
  ? 12445 aduasqa1 154 20   601M  4980K sleep    0:00  0.18  0.16 oracleamuasqa1
  ? 12463 aduasqa1 154 20   600M  3940K sleep    0:00  0.21  0.16 oracleamuasqa1
  ?  1744 aduasqa1 152 20 41708K  6264K run      8:40  0.15  0.15 tnslsnr
  ? 12441 aduasqa1 154 20   601M  4980K sleep    0:00  0.17  0.15 oracleamuasqa1
  ? 18762 amufsqa1 154 20   331M  1464K sleep    1:43  0.14  0.14 oracleamufsqa1
  ? 12459 aduasqa1 154 20   600M  3940K sleep    0:00  0.17  0.13 oracleamuasqa1
  ? 12461 aduasqa1 154 20   600M  3940K sleep    0:00  0.17  0.13 oracleamuasqa1
  ?  2139 root     152 20 14012K  1564K run     37:21  0.12  0.12 alarmgen
  ?  2264 aduasqa1 154 20   605M  7804K sleep    5:10  0.10  0.10 oracleamuasqa1

Thanks in advance
Avatar of jgordos
jgordos
Flag of United States of America image

The TOP command's output is basically two different "chunks".

The upper part is about the entire system:

>System: hawk                                          Wed Nov 14 18:57:02 2007
>Load averages: 3.90, 3.41, 3.69
>239 processes: 217 sleeping, 22 running
>Cpu states:
> LOAD   USER   NICE    SYS   IDLE  BLOCK  SWAIT   INTR   SSYS
> 3.90   6.9%   0.0%   3.0%  90.1%   0.0%   0.0%   0.0%   0.0%
>Memory: 2479160K (1624320K) real, 4883816K (3706360K) virtual, 326932K free  Page# 1/8

From this part, you get information about the system, as a whole.  The LOAD AVERAGE line:
> Load averages: 3.90, 3.41, 3.69
Shows the number of processes that are WAITING for cpu at three time intervals (so you get three numbers there.  It's "now", a minute ago, and five minutes ago, I think.  In your instance, you can see that there are 3 processes that are RUNNABLE, but are WAITING on the scheduler to give them some CPU.

Next line:
>239 processes: 217 sleeping, 22 running

You have 22 processes that are RUNNABLE, and 217 are sleeping (usually waiting on some form of I/O event or trigger to happen.

The next part:
>Cpu states:
> LOAD   USER   NICE    SYS   IDLE  BLOCK  SWAIT   INTR   SSYS
> 3.90   6.9%   0.0%   3.0%  90.1%   0.0%   0.0%   0.0%   0.0%

Shows that most of the processes on the box (90%) of them are idle.  (217/239=.907) 6.9% of them (16 of the RUNNABLE ones) are running in USER space (ie, their own code), and the remainder (6) are in SYSTEM space, which generally means running a kernel routine, or at an elevated system priv level.

Lastly in the system chunk:
> Memory: 2479160K (1624320K) real, 4883816K (3706360K) virtual, 326932K free  Page# 1/8
This shows the memory usage of the system. Looks like the box has 2.5Gb of RAM, with 1.6Gb in use, and 4.5ishGbs of swap space, with nearly 3.5Gbs of that in use.   Processes will swap to disk when they are BLOCKED, or waiting on some kind of IO or whatever.

The rest of the chart shows a list of the processes that make up the 239 running processes on the system.  This information is "generally" sorted by the amount of CPU the process is using, but you can sort it different ways by pressing keys to change the sort columns.

>TTY  PID USERNAME PRI NI   SIZE    RES STATE    TIME %WCPU  %CPU COMMAND
>? 12409 aauasqa1 152 20   228M 41992K run      0:06  8.28  7.49 n

The TTY (TTY stands for TELETYPE) is the terminal that the process was associated with.  In other words, if you had a physical terminal connected to your system, the TTY is that terminal.  Nowadays, that almost never happens, so the TTY is a pseudo-tty, which some systems show here. Others don't.  The PID is the Process ID, the USERNAME is the user who started the process (aauasqua1) , the PRI is the PRIority of the system (the system administrator can set this higher or lower), NI is the NICE value (this has been niced to 20) (nice is a way to be "nice" to your fellow users of the system.  I can start a process that I know will take significant resources, and "nice" it to a lower priority, so that other interactive users can get some CPU slices at the expense of my process.)  SIZE is the size of the process in memory, and RES is the amount of total RAM the process is requesting in TOTAL. STATE is the processes current state ( These vary based on the "unix" you're running but generally are things like RUNNING/SLEEPING/DEAD/TRACE/ZOMBIE).  The TIME column is the total amount of CPU time used, in SECONDS.  Most things don't take a ton of CPU time/most are blocked waiting on some sort of I/O.  Large numbers here indicate CPU intensive tasks, or infinite loops.  %WCPU is "percentage of time spent waiting on the CPU", and %CPU is "of the available CPU time, how much of it have I used?".  The COMMAND column is the name of the command as started by the shell. It could be a cron process or an interactive command or whatever. In this instance, 'n' is the name of the command.

This is a long explanation.

What are you looking for?

With all the wisdom of my years, I'd say you need a bigger CPU, but that's just me.  Ideally, I never want to see LOAD averages over 2.5 on a consistent basis; but I have seen loads as high as 35 or 40 on production servers, at times.

-john


Oh, second part.

And you can't tell, from this, what kind of CPU is in the box.

You *might* be able to tell from running

cat /proc/cpuinfo

depending on the version of linux you're running.

-john

Avatar of monto1
monto1

ASKER

On hpux how can i find CPU.
ASKER CERTIFIED SOLUTION
Avatar of jgordos
jgordos
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial