ZMEM memory viewing tool use

1 install zmem tool

yum install smem -y
zmem characteristics
System overview list
By process, map, and user list
Filter by user, map, or user
Configurable columns from multiple data sources
Configurable output units and percentages
Configurable title and sum
Read activity data from / proc
Read data snapshot from directory image or compressed package file
Lightweight capture tool for embedded system
Built in chart generation

2 memory related indicators

# smem
  PID User     Command                         Swap      USS      PSS      RSS
 7907 www      php-fpm: pool www               8224        4        5      412
 
PID process
USER
Command command
Swap swap partition
USS residentset size can be queried by using the top command, which is the most commonly used memory indicator, indicating the physical memory size occupied by the process. RSS contains the shared memory among the processes
PSS proportionalset size it averages the size of shared memory and allocates it to each process
RSS unique set size is its own part in PSS. It only calculates the memory size occupied by the process alone, and does not contain any shared part
In kilobytes

3 usage

# smem -h
Usage: smem [options]
 
Options:
  -h, --help            show this help message and exit
  -H, --no-header       disable header line
  -c COLUMNS, --columns=COLUMNS
                        columns to show
  -t, --totals          show totals
  -R REALMEM, --realmem=REALMEM
                        amount of physical RAM
  -K KERNEL, --kernel=KERNEL
                        path to kernel image
  -m, --mappings        show mappings
  -u, --users           show users
  -w, --system          show whole system
  -P PROCESSFILTER, --processfilter=PROCESSFILTER
                        process filter regex
  -M MAPFILTER, --mapfilter=MAPFILTER
                        map filter regex
  -U USERFILTER, --userfilter=USERFILTER
                        user filter regex
  -n, --numeric         numeric output
  -s SORT, --sort=SORT  field to sort on
  -r, --reverse         reverse sort
  -p, --percent         show percentage
  -k, --abbreviate      show unit suffixes
  --pie=PIE             show pie graph
  --bar=BAR             show bar graph
  -S SOURCE, --source=SOURCE
                        /proc data source
 
 
//View the memory used by each process
smem
# smem
  PID User     Command                         Swap      USS      PSS      RSS
 7907 www      php-fpm: pool www               8224        4        5      412
 
//View the memory used by each user
# smem -u
User     Count     Swap      USS      PSS      RSS
chrony       1      224      416      440     1312
dbus         1      308      568      682     1548
view         2        0     1608     2432     5488
polkitd      1     3832     4288     4403     5424
oubao        4        0     5496     7259    13552
www        116  1558664  1020840  1022731  1107504
root        56    54252 26784216 26828282 27015436
//View memory process status percentage
# smem -p
  PID User     Command                         Swap      USS      PSS      RSS
 7907 www      php-fpm: pool www              0.78%    0.00%    0.00%    0.00%
 
//View firmware using memory
# smem -R 32G  -w
Area                           Used      Cache   Noncache
firmware/hardware            775492          0     775492
kernel image                      0          0          0
kernel dynamic memory       4679248    3773032     906216
userspace memory           27858120      99880   27758240
free memory                  241572     241572          0
 
//To view system memory usage:
smem -w
Area                           Used      Cache   Noncache
firmware/hardware                 0          0          0
kernel image                      0          0          0
kernel dynamic memory       4652788    3748408     904380
userspace memory           27869796      99864   27769932
free memory                  256356     256356          0
 
# smem -w -p
Area                           Used      Cache   Noncache
firmware/hardware             0.00%      0.00%      0.00%
kernel image                  0.00%      0.00%      0.00%
kernel dynamic memory        14.20%     11.45%      2.75%
userspace memory             85.01%      0.30%     84.71%
free memory                   0.79%      0.79%      0.00%
 
//View memory to show only columns needed
# smem -c "pid uss"
  PID      USS
 7907        4
 
//View memory sort order by a column
# smem -u -s uss
User     Count     Swap      USS      PSS      RSS
chrony       1      224      416      440     1312
dbus         1      308      568      682     1548
view         2        0     1608     2432     5488
polkitd      1     3832     4288     4403     5424
oubao        4        0     5496     7259    13552
www        116  1558664  1020844  1022735  1107508
root        56    54252 26782984 26827090 27014308
 
//View memory sort in reverse order according to a column
# smem -u -s uss -r
User     Count     Swap      USS      PSS      RSS
root        56    54252 26784368 26828474 27015696
www        116  1558660  1020848  1022739  1107512
oubao        4        0     5496     7259    13552
polkitd      1     3832     4288     4403     5424
view         2        0     1608     2432     5488
dbus         1      308      568      682     1548
chrony       1      224      416      440     1312
 
//View memory filtering processview
# smem -M java
  PID User     Command                         Swap      USS      PSS      RSS
 3850 root     /usr/local/jdk1.8/bin/java         0       20       24       92
 6135 root     /usr/local/jdk1.8/bin/java         0       20       24       88
 6478 root     /usr/local/jdk1.8/bin/java         0       20       24       92
10658 root     /usr/local/jdk1.8/bin/java         0       20       24       92
12035 root     /usr/local/jdk1.8/bin/java         0       20       24       92
12857 root     /usr/local/jdk1.8/bin/java         0       20       24       92
15878 root     /usr/local/jdk1.8/bin/java         0       20       24       88
19064 root     /usr/local/jdk1.8/bin/java         0       20       24       88
25653 root     /usr/local/jdk1.8/bin/java         0       20       24       88
25727 root     /usr/local/jdk1.8/bin/java         0       20       24       92
26798 root     /usr/local/jdk1.8/bin/java         0       20       24       92
31255 root     /usr/local/jdk1.8/bin/java         0       20       24       92
16192 root     /usr/local/jdk1.8/bin/java         0       20       33      120
 1610 root     /usr/local/jdk1.8/bin/java         0       20       49      152
31749 root     /usr/local/jdk1.8/bin/java         0       20       49      152
//Drawing function is not practical

Tags: Java PHP DBus yum

Posted on Thu, 19 Dec 2019 06:56:59 -0800 by amorphous