Linux Ask!

Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.

May 052010
 

Display multiprocessor usage with mpstat

Answer:

To displays all the activities for the available processor(s) in your system, you can use mpstat

E.g.

# mpstat -P ALL
Linux 2.6.31-14-server (localhost)     04/30/10        _x86_64_        (1 CPU)

00:00:44     CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest   %idle
00:00:44     all    4.01    0.00    0.07    0.03    0.00    0.05    0.03    0.00   95.81
00:00:44       0    4.01    0.00    0.07    0.03    0.00    0.05    0.03    0.00   95.81
May 042010
 

Display process' memory usage

Answer:

To display memory usage of a process, you can use the command pmap

E.g. To show the emory usage of mysqld

# sudo pmap -d 1076 

Address           Kbytes Mode  Offset           Device    Mapping
00007fddabb89000  147444 rw--- 0000000000000000 000:00000   [ anon ]
00007fddb4b86000      48 r-x-- 0000000000000000 0ca:00001 libnss_files-2.10.1.so
00007fddb4b92000    2044 ----- 000000000000c000 0ca:00001 libnss_files-2.10.1.so
00007fddb4d91000       4 r---- 000000000000b000 0ca:00001 libnss_files-2.10.1.so
00007fddb4d92000       4 rw--- 000000000000c000 0ca:00001 libnss_files-2.10.1.so
00007fddb4d93000      40 r-x-- 0000000000000000 0ca:00001 libnss_nis-2.10.1.so
00007fddb4d9d000    2044 ----- 000000000000a000 0ca:00001 libnss_nis-2.10.1.so
00007fddb4f9c000       4 r---- 0000000000009000 0ca:00001 libnss_nis-2.10.1.so
00007fddb4f9d000       4 rw--- 000000000000a000 0ca:00001 libnss_nis-2.10.1.so
00007fddb4f9e000      28 r-x-- 0000000000000000 0ca:00001 libnss_compat-2.10.1.so
00007fddb4fa5000    2048 ----- 0000000000007000 0ca:00001 libnss_compat-2.10.1.so
00007fddb51a5000       4 r---- 0000000000007000 0ca:00001 libnss_compat-2.10.1.so
00007fddb51a6000       4 rw--- 0000000000008000 0ca:00001 libnss_compat-2.10.1.so
00007fddb51a7000       4 ----- 0000000000000000 000:00000   [ anon ]
00007fddb51a8000   10240 rw--- 0000000000000000 000:00000   [ anon ]
00007fddb5ba8000    1432 r-x-- 0000000000000000 0ca:00001 libc-2.10.1.so
00007fddb5d0e000    2044 ----- 0000000000166000 0ca:00001 libc-2.10.1.so
00007fddb5f0d000      16 r---- 0000000000165000 0ca:00001 libc-2.10.1.so
00007fddb5f11000       4 rw--- 0000000000169000 0ca:00001 libc-2.10.1.so
00007fddb5f12000      20 rw--- 0000000000000000 000:00000   [ anon ]
00007fddb5f17000      88 r-x-- 0000000000000000 0ca:00001 libgcc_s.so.1
...