Sponsored Content
Top Forums UNIX for Advanced & Expert Users unix top command (memory usage) Post 102220 by Nemesis on Thursday 16th of March 2006 09:57:58 AM
Old 03-16-2006
Tools RE: memory usage

Top isn't showing you info on wired pages (pages in use that can't be used for paging).

Use "vmstat -P" to get a breakdown on memory usage.

Total memory = (Active Pages + UBC Pages + Wired Pages + Free Pages) * 8192/1048576

Top's act = (Active Pages + UBC PAges) * 8192/1048576
Top's Free = Free Pages * 8192/1048576

Use "swapon -s" for swap used/total, and "vmstat -s" for detailed info about swap activity.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How to get system memory usage like top

Hello all im working on sunos machine that dont have the top installed and can't be install , now i need to get information similar to what top gives me about the cpu usage and so can it be done somehow else where ? (3 Replies)
Discussion started by: umen
3 Replies

2. HP-UX

how can I find cpu usage memory usage swap usage and logical volume usage

how can I find cpu usage memory usage swap usage and I want to know CPU usage above X% and contiue Y times and memory usage above X % and contiue Y times my final destination is monitor process logical volume usage above X % and number of Logical voluage above can I not to... (3 Replies)
Discussion started by: alert0919
3 Replies

3. UNIX for Dummies Questions & Answers

top command + %CPU usage exceeds 100%?

Hi there. I was looking at the output from running top and for short amounts of time, when I see all the process running and add up the values in the %CPU column the value exceeds 100% (I just add them quickly in my head). I assume that if I were to add up all my processes in the entire list,... (2 Replies)
Discussion started by: Carl1976
2 Replies

4. UNIX for Dummies Questions & Answers

Unix Top Command and sorting by CPU Usage

Ok, so I am using the Top command on my linux VPS to try and see the processes using the most CPU %. I hit the P to sort by CPU % but it wants to sort them from lowest to highest (ascending). My Telnet-SSH screen is only about 60 rows high so the processes with the highest CPU % usage are at the... (6 Replies)
Discussion started by: davemehta
6 Replies

5. Shell Programming and Scripting

Command to find the Memory and CPU utilization using 'top' command

Hi all, I found like top command could be used to find the Memory and CPU utilization. But i want to know how to find the Memory and CPU utilization for a particular user using top command. Thanks in advance. Thanks, Ananthi.U (2 Replies)
Discussion started by: ananthi_ku
2 Replies

6. Solaris

Memory usage, free and used, using sar, top and vmstat in Solaris zone/container

Hi all, I have a server running an Oracle database that is part of a Solaris M5000 container. Presumably this is referred to as a zone within a cluster, not sure if I get the terminology right. Anyway, a third-party manages the zone and unfortunately is not "helpful/friendly" to assist me on... (1 Reply)
Discussion started by: newbie_01
1 Replies

7. Solaris

HELP - memory usage on Solaris : ps -efl and top

Hi all, OS Version: SunOS <hostname> 5.10 Generic_142900-13 sun4v sparc SUNW,Sun-Blade-T6340 I need some expert guidance on investigating memory usage on Solaris. I want to know whether am interpreting the output from ps -efl correctly and whether the command top is showing the right... (3 Replies)
Discussion started by: newbie_01
3 Replies

8. UNIX for Dummies Questions & Answers

HOWTO - Total memory and CPU usage ... without top?

Hi all, Is it possible to get total memory usage and free memory usage without top? By Googling I found for total memory usage, use vmstat, for CPU, use mpstat, for disk I/O use iostat, is this correct? Will using sar gives the same result as ALL of these three (3) commands? What about if I... (2 Replies)
Discussion started by: newbie_01
2 Replies

9. UNIX for Dummies Questions & Answers

Command to display the space usage (memory usage) of a specific directory.

Hi all, Can you please tell me the command, with which one can know the amount of space a specific directory has used. df -k . ---> Displays, the amount of space allocated, and used for a directory. du -k <dir name> - gives me the memory used of all the files inside <dir> But i... (2 Replies)
Discussion started by: abhisheksunkari
2 Replies

10. Linux

Unkown memory usage, top doesn't know

Hi, Yersterday I started monitoring my homeserver memory consumition due some errors found in the system (network hangs). I've detected almost all the memory used (~10 MB free from 1GB). First I thought it was because of the MySQL configuration, so I monitored it with top and found it wasn't... (6 Replies)
Discussion started by: nefeli
6 Replies
TOP(1)								Linux User's Manual							    TOP(1)

NAME
top - display top CPU processes SYNOPSIS
top [-] [d delay] [p pid] [q] [c] [C] [S] [s] [i] [n iter] [b] DESCRIPTION
top provides an ongoing look at processor activity in real time. It displays a listing of the most CPU-intensive tasks on the system, and can provide an interactive interface for manipulating processes. It can sort the tasks by CPU usage, memory usage and runtime. can be better configured than the standard top from the procps suite. Most features can either be selected by an interactive command or by speci- fying the feature in the personal or system-wide configuration file. See below for more information. COMMAND-LINE OPTIONS d Specifies the delay between screen updates. You can change this with the s interactive command. p Monitor only processes with given process id. This flag can be given up to twenty times. This option is neither available interac- tively nor can it be put into the configuration file. q This causes top to refresh without any delay. If the caller has superuser privileges, top runs with the highest possible priority. S Specifies cumulative mode, where each process is listed with the CPU time that it as well as its dead children has spent. This is like the -S flag to ps(1). See the discussion below of the S interactive command. s Tells top to run in secure mode. This disables the potentially dangerous of the interactive commands (see below). A secure top is a nifty thing to leave running on a spare terminal. i Start top ignoring any idle or zombie processes. See the interactive command i below. C display total CPU states instead of individual CPUs. This option only affects SMP systems. c display command line instead of the command name only. The default behavior has been changed as this seems to be more useful. H Show all threads. n Number of iterations. Update the display this number of times and then exit. b Batch mode. Useful for sending output from top to other programs or to a file. In this mode, top will not accept command line input. It runs until it produces the number of iterations requested with the n option or until killed. Output is plain text suitable for dis- play on a dumb terminal. FIELD DESCRIPTIONS
top displays a variety of information about the processor state. The display is updated every 5 seconds by default, but you can change that with the d command-line option or the s interactive command. uptime This line displays the time the system has been up, and the three load averages for the system. The load averages are the average number of process ready to run during the last 1, 5 and 15 minutes. This line is just like the output of uptime(1). The uptime dis- play may be toggled by the interactive l command. processes The total number of processes running at the time of the last update. This is also broken down into the number of tasks which are running, sleeping, stopped, or undead. The processes and states display may be toggled by the t interactive command. CPU states Shows the percentage of CPU time in user mode, system mode, niced tasks, iowait and idle. (Niced tasks are only those whose nice value is positive.) Time spent in niced tasks will also be counted in system and user time, so the total will be more than 100%. The processes and states display may be toggled by the t interactive command. Mem Statistics on memory usage, including total available memory, free memory, used memory, shared memory, and memory used for buffers. The display of memory information may be toggled by the m interactive command. Swap Statistics on swap space, including total swap space, available swap space, and used swap space. This and Mem are just like the out- put of free(1). PID The process ID of each task. PPID The parent process ID each task. UID The user ID of the task's owner. USER The user name of the task's owner. PRI The priority of the task. NI The nice value of the task. Negative nice values are higher priority. SIZE The size of the task's code plus data plus stack space, in kilobytes, is shown here. TSIZE The code size of the task. This gives strange values for kernel processes and is broken for ELF processes. DSIZE Data + Stack size. This is broken for ELF processes. TRS Text resident size. SWAP Size of the swapped out part of the task. D Size of pages marked dirty. LC Last used processor. (That this changes from time to time is not a bug; Linux intentionally uses weak affinity. Also notice that the very act of running top may break weak affinity and cause more processes to change current CPU more often because of the extra demand for CPU time.) RSS The total amount of physical memory used by the task, in kilobytes, is shown here. For ELF processes used library pages are counted here, for a.out processes not. SHARE The amount of shared memory used by the task is shown in this column. STAT The state of the task is shown here. The state is either S for sleeping, D for uninterruptible sleep, R for running, Z for zombies, or T for stopped or traced. These states are modified by trailing < for a process with negative nice value, N for a process with positive nice value, W for a swapped out process (this does not work correctly for kernel processes). WCHAN depending on the availability of either /boot/psdatabase or the kernel link map /boot/System.map this shows the address or the name of the kernel function the task currently is sleeping in. TIME Total CPU time the task has used since it started. If cumulative mode is on, this also includes the CPU time used by the process's children which have died. You can set cumulative mode with the S command line option or toggle it with the interactive command S. The header line will then be changed to CTIME. %CPU The task's share of the CPU time since the last screen update, expressed as a percentage of total CPU time per processor. %MEM The task's share of the physical memory. COMMAND The task's command name, which will be truncated if it is too long to be displayed on one line. Tasks in memory will have a full com- mand line, but swapped-out tasks will only have the name of the program in parentheses (for example, "(getty)"). A , WP these fields from the kmem top are not supported. INTERACTIVE COMMANDS
Several single-key commands are recognized while top is running. Some are disabled if the s option has been given on the command line. space Immediately updates the display. ^L Erases and redraws the screen. h or ? Displays a help screen giving a brief summary of commands, and the status of secure and cumulative modes. k Kill a process. You will be prompted for the PID of the task, and the signal to send to it. For a normal kill, send signal 15. For a sure, but rather abrupt, kill, send signal 9. The default signal, as with kill(1), is 15, SIGTERM. This command is not available in secure mode. i Ignore idle and zombie processes. This is a toggle switch. I Toggle between Solaris (CPU percentage divided by total number of CPUs) and Irix (CPU percentage calculated solely by amount of time) views. This is a toggle switch that affects only SMP systems. n or # Change the number of processes to show. You will be prompted to enter the number. This overrides automatic determination of the num- ber of processes to show, which is based on window size measurement. If 0 is specified, then top will show as many processes as will fit on the screen; this is the default. q Quit. r Re-nice a process. You will be prompted for the PID of the task, and the value to nice it to. Entering a positve value will cause a process to be niced to negative values, and lose priority. If root is running top, a negative value can be entered, causing a process to get a higher than normal priority. The default renice value is 10. This command is not available in secure mode. S This toggles cumulative mode, the equivalent of ps -S, i.e., that CPU times will include a process's defunct children. For some pro- grams, such as compilers, which work by forking into many separate tasks, normal mode will make them appear less demanding than they actually are. For others, however, such as shells and init, this behavior is correct. In any case, try cumulative mode for an alter- native view of CPU use. s Change the delay between updates. You will be prompted to enter the delay time, in seconds, between updates. Fractional values are recognized down to microseconds. Entering 0 causes continuous updates. The default value is 5 seconds. Note that low values cause nearly unreadably fast displays, and greatly raise the load. This command is not available in secure mode. f or F Add fields to display or remove fields from the display. See below for more information. o or O Change order of displayed fields. See below for more information. l toggle display of load average and uptime information. m toggle display of memory information. t toggle display of processes and CPU states information. c toggle display of command name or full command line. N sort tasks by pid (numerically). A sort tasks by age (newest first). P sort tasks by CPU usage (default). M sort tasks by resident memory usage. T sort tasks by time / cumulative time. W Write current setup to ~/.toprc. This is the recommended way to write a top configuration file. The Field and Order Screens After pressing f, F, o or O you will be shown a screen specifying the field order on the top line and short descriptions of the field con- tents. The field order string uses the following syntax: If the letter in the filed string corresponding to a field is upper case, the field will be displayed. This is furthermore indicated by an asterisk in front of the field description. The order of the fields corre- sponds to the order of the letters in the string. From the field select screen you can toggle the display of a field by pressing the corresponding letter. From the order screen you may move a field to the left by pressing the corresponding upper case letter resp. to the right by pressing the lower case one. Configuration Files Top reads it's default configuration from two files, /etc/toprc and ~/.toprc. The global configuration file may be used to restrict the usage of top to the secure mode for non-non-privileged users. If this is desired, the file should contain a 's' to specify secure mode and a digit d (2<=d<=9) for the default delay (in seconds) on a single line. The personal configuration file contains two lines. The first line contains lower and upper letters to specify which fields in what order are to be displayed. The letters correspond to the letters in the Fields or Order screens from top. As this is not very instructive, it is recommended to select fields and order in a running top process and to save this using the W interactive command. The second line is more interesting (and important). It contains information on the other options. Most important, if you have saved a configuration in secure mode, you will not get an insecure top without removing the lower 's' from the second line of your ~/.toprc. A digit specifies the delay time between updates, a capital 'S' cumulative mode, a lower 'i' no-idle mode, a capital 'I' Irix view. As in interactive mode, a lower 'm', 'l', and 't' suppresses the display of memory, uptime resp. process and CPU state information. Currently changing the default sorting order (by CPU usage) is not supported. NOTES
This proc-based top works by reading the files in the proc filesystem, mounted on /proc. If /proc is not mounted, top will not work. %CPU shows the cputime/realtime percentage in the period of time between updates. For the first update, a short delay is used, and top itself dominates the CPU usage. After that, top will drop back, and a more reliable estimate of CPU usage is available. The SIZE and RSS fields don't count the page tables and the task_struct of a process; this is at least 12K of memory that is always resi- dent. SIZE is the virtual size of the process (code+data+stack). Keep in mind that a process must die for its time to be recorded on its parent by cumulative mode. Perhaps more useful behavior would be to follow each process upwards, adding time, but that would be more expensive, possibly prohibitively so. In any case, that would make top's behavior incompatible with ps. FILES
/etc/toprc The global configuration file. ~/.toprc The personal configuration file. SEE ALSO
ps(1), free(1), uptime(1), kill(1), renice(1). BUGS
If the window is less than about 70x7, top will not format information correctly. Many fields still have problems with ELF processes. the help screens are not yet optimized for windows with less than 25 lines AUTHOR
top was originally written by Roger Binns, based on Branko Lankester's <lankeste@fwi.uva.nl> ps program. Robert Nation <nation@rocket.sanders.lockheed.com> re-wrote it significantly to use the proc filesystem, based on Michael K. Johnson's <johnsonm@red- hat.com> proc-based ps program. Michael Shields <mjshield@nyx.cs.du.edu> made many changes, including secure and cumulative modes and a general cleanup. Tim Janik <timj@gtk.org> added age sorting and the ability to monitor specific processes through their ids. Helmut Geyer <Helmut.Geyer@iwr.uni-heidelberg.de> Heavily changed it to include support for configurable fields and other new options, and did further cleanup and use of the new readproc interface. The "b" and "n" options contributed by George Bonser <george@captech.com> for CapTech IT Services. Michael K. Johnson <johnsonm@redhat.com> is now the maintainer. Please send bug reports to <procps-list@redhat.com> Linux Feb 1 1993 TOP(1)
All times are GMT -4. The time now is 09:48 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy