1821549 Members
1992 Online
109633 Solutions
New Discussion юеВ

CPU & Memory Utilization

 
unixguy_1
Regular Advisor

CPU & Memory Utilization

How to check the CPU utilization and Memory Utilization?

Pls guide me the tasks in Command oriented.

Thanks in advance.

7 REPLIES 7

Re: CPU & Memory Utilization

a good starting point are the commands sar and vmstat

so for example, sample CPU utilisation every 2 seconds for 10 iterations:

sar -u 2 10

or sample virtual memory utilisation every 2 seconds for 10 iterations:

vmstat 2 10

(look at the avm and free fields)
Note that vmstat reports memory in 4k pages so multiply by 4096 to get bytes.

HTH

Duncan

I am an HPE Employee
Accept or Kudo
rariasn
Honored Contributor

Re: CPU & Memory Utilization

He,

# top

rgs
Sharma Sanjeev
Respected Contributor

Re: CPU & Memory Utilization

Hi

Please run Glance

Regards
Sanjeev
Everything is Possible as " IMPOSSIBLE" word itself says I M POSSIBLE
щ╗ЮчЗГ
Valued Contributor

Re: CPU & Memory Utilization

You can use glance.
Run glance and press 'c' for CPU report and press 'm' for memory report.

Top/sar are also very useful.

regards!
Man's mind, once stretched by a new idea, never regains its original dimensions
Taifur
Respected Contributor

Re: CPU & Memory Utilization

Hi unixguy

YOu can check CPU and memory utilization by,

#top
#sar
#glance

For more details you can check sar:
======================================
In the first form above, sar samples cumulative activity counters in the operating system at n intervals of t seconds. If the -o option is specified, it saves the samples in file in binary format. The default value of n is 1. In the second form, with no sampling interval specified, sar extracts data from a previously recorded file, either the one specified by -f option or, by default, the standard system activity daily data file /var/adm/sa/sadd for the current day dd. The starting and ending times of the report can be bounded via the -s and -e time arguments of the form hh[:mm[:ss]]. The -i option selects records at sec-second intervals. Otherwise, all intervals found in the data file are reported.

In either case, subsets of data to be printed are specified by option:

-u
Report CPU utilization (the default); portion of time running in one of several modes. On a multi-processor system, if the -M option is used together with the -u option, per-CPU utilization as well as the average CPU utilization of all the active processors are reported. If the -M option is not used, only the average CPU utilization of all the active processors is reported. On a multi-processor ProcessorSet (pset) configured system, if the -P option is used together with the -M and -u options, the column for pset mapping to processor will be displayed before the cpu column.

pset
pset id (only on a multi-processor pset configured system with the -P , -M and -u option);

cpu
cpu number (only on a multi-processor system with the -M option);

%usr
user mode;

%sys
system mode;

%wio
idle with some process waiting for I/O (only block I/O, raw I/O, or VM pageins/swapins indicated);

%idle
otherwise idle.


-b
Report buffer activity:

bread/s
Number of physical reads per second from the disk (or other block devices) to the buffer cache;

bwrit/s
Number of physical writes per second from the buffer cache to the disk (or other block device);

lread/s
Number of reads per second from buffer cache;

lwrit/s
Number of writes per second to buffer cache;

%rcache
Buffer cache hit ratio for read requests e.g., 1 - bread/lread;

%wcache
Buffer cache hit ratio for write requests e.g., 1 - bwrit/lwrit;

pread/s
Number of reads per second from character device using the physio() (raw I/O) mechanism;

pwrit/s
Number of writes per second to character device using the physio() (i.e., raw I/O) mechanism; mechanism.


-d
Report activity for each block device, e.g., disk or tape drive. One line is printed for each device that had activity during the last interval. If no devices were active, a blank line is printed. Each line contains the following data:

device
Logical name of the device and its corresponding instance. Devices are categorized into the following device types:

disk3 - SCSI and NIO FL disks

sdisk - SCSI disks;


%busy
Portion of time device was busy servicing a request;

avque
Average number of requests outstanding for the device;

r+w/s
Number of data transfers per second (read and writes) from and to the device;

blks/s
Number of bytes transferred (in 512-byte units) from and to the device;

avwait
Average time (in milliseconds) that transfer requests waited idly on queue for the device;

avserv
Average time (in milliseconds) to service each transfer request (includes seek, rotational latency, and data transfer times) for the device.


-y
Report tty device activity:

rawch/s
Raw input characters per second;

canch/s
Input characters per second processed by canon();

outch/s
Output characters per second;

rcvin/s
Receive incoming character interrupts per second;

xmtin/s
Transmit outgoing character interrupts per second;

mdmin/s
Modem interrupt rate (not supported; always 0).


-c
Report system calls:

scall/s
Number of system calls of all types per second;

sread/s
Number of read() and/or readv() system calls per second;

swrit/s
Number of write() and/or writev() system calls per second;

fork/s
Number of fork() and/or vfork() system calls per second;

exec/s
Number of exec() system calls per second;

rchar/s
Number of characters transferred by read system calls block devices only) per second;

wchar/s
Number of characters transferred by write system calls (block devices only) per second.
-w
Report system swapping and switching activity:

swpin/s
Number of process swapins per second;

swpot/s
Number of process swapouts per second;

bswin/s
Number of 512-byte units transferred for swapins per second;

bswot/s
Number of 512-byte units transferred for swapouts per second;

pswch/s
Number of process context switches per second.


-a
Report use of file access system routines:

iget/s
Number of file system iget() calls per second;

namei/s
Number of file system lookuppn() (pathname translation) calls per second;

dirblk/s
Number of file system blocks read per second doing directory lookup.


-q
Report average queue length while occupied, and percent of time occupied. On a multi-processor machine, if the -M option is used together with the -q option, the per-CPU run queue as well as the average run queue of all the active processors are reported. If the -M option is not used, only the average run queue information of all the active processors is reported. In a multi-processor pset configured system if the -M option is used with the option -P then pset column will will be displayed before cpu column:

pset
pset id (only on a multi-processor and pset configured system, used with -P , -M and -q option)

cpu
cpu number (only on a multi-processor system and used with the -M option)

runq-sz
Average length of the run queue(s) of processes (in memory and runnable);

%runocc
The percentage of time the run queue(s) were occupied by processes (in memory and runnable);

swpq-sz
Average length of the swap queue of runnable processes (processes swapped out but ready to run). This column will not be displayed when -p option is used to display a particular ProcessorSet (pset) information in a pset configured system.

%swpocc
The percentage of time the swap queue of runnable processes (processes swapped out but ready to run) was occupied. This column will not be displayed when -p option is used to display a particular ProcessorSet (pset) information in a pset configured system.


-v
Report status of text, process, inode and file tables:

text-sz
(Not Applicable);

proc-sz
The current-size and maximum-size of the process table;

inod-sz
The current-size and maximum-size of the inode table (inode cache);

file-sz
The current-size and maximum-size of the system file table;

text-ov
(Not Applicable);

proc-ov
The number of times the process table overflowed (number of times the kernel could not find any available process table entries) between sample points;

inod-ov
The number of times the inode table (inode cache) overflowed (number of times the kernel could not find any available inode table entries) between sample points;

file-ov
The number of times the system file table overflowed (number of times the kernel could not find any available file table entries) between sample points.


-m
Report message and semaphore activities:

msg/s
Number of System V msgrcv() calls per second;

sema/s
Number of System V semop() calls per second;

select/s
Number of System V select() calls per second. This value will only be reported if the "-S" option is also explicitly specified.


-p
Report the specified ProcessorSet (pset) information. This option should be used with -u or -q option.

-A
Report all data. Equivalent to -udqbwcayvm.

-M
Report the per-processor data on a multi-processor system when used with -q and/or -u options. If the -M option is not used on a multi-processor system, the output format of the -u and -q options is the same as the uni-processor output format and the data reported is the average value of all the active processors.

-P
Report ProcessorSet (pset) information, mapping to the processor in the system or the specified pset. This option can only be used with -M and -q, or -M and -u options. It can also be combined with -p option to display information for a particular pset. If system is not pset configured it will display a warning message.


EXAMPLES
Watch CPU activity evolve for 5 seconds:

sar 1 5 Watch CPU activity evolve for 10 minutes and save data:

sar -o temp 60 10 Review disk and tape activity from that period later:

sar -d -f temp Review cpu utilization on a multi-processor system later:

sar -u -M -f temp WARNINGS
Users of sar must not rely on the exact field widths and spacing of its output, as these will vary depending on the system, the release of HP-UX, and the data to be displayed.


The link as follows:

http://docs.hp.com/en/B2355-60127/sar.1M.html

Rgds//
Taifur
Avinash20
Honored Contributor

Re: CPU & Memory Utilization

"CPU utilization and Memory Utilization?"

CPU Utilization:

Check top and sar -Mu 1 1

Also have the %idle high

Memory Utilization:

# top

Check the memory section for XXXX K free

This is the free memory available on the server

# vmstat 1 1

Check the po(page-out) section.
It should always be zero.
If high then swapping is taking place due to less free memory available on the server.
"Light travels faster than sound. That's why some people appear bright until you hear them speak."
Dennis Handly
Acclaimed Contributor

Re: CPU & Memory Utilization

>Taifur: For more details you can check sar:

Instead of providing the massive man page entry, please summarize it and then give your URL.