内存使用率 script

#!/bin/bash
ps -C $1 -O rss | gawk '{ count ++; sum += $2 }; \
END {count --; print "Number of processes =",count; \
print "Memory usage per procsss =",sum/1024/count, "MB"; \
print "Total memory usage =", sum/1024, "MB" ;};'


 

使用方法如下

[root@Linux29 ~]# ./mem.sh  java
Number of processes = 3
Memory usage per process = 153.672 MB
Total memory usage = 461.016 MB
[root@Linux29 ~]# ./mem.sh oracle
Number of processes = 71
Memory usage per process = 47.5638 MB
Total memory usage = 3377.03 MB


方便统计 

上一篇:Symantec Endpoint Protection 客户端无法启动、重装、卸载的问题


下一篇:python 回溯法 记录