#!/bin/bash # Get current swap usage for all running processes SUM=0 OVERALL=0 for DIR in `find /proc/ -maxdepth 1 -type d | egrep "^/proc/[0-9]"` ; do PID=`echo $DIR | cut -d / -f 3` PROGNAME=`ps -p $PID -o comm --no-headers` for SWAP in `grep Swap $DIR/smaps 2>/dev/null| awk '{ print $2 }'` do let SUM=$SUM+$SWAP done echo "PID=$PID - Swap used: $SUM - ($PROGNAME )" let OVERALL=$OVERALL+$SUM SUM=0 done echo "Overall swap used: $OVERALL"
计算SWAP 占用进程
精选 转载swq499809608 博主文章分类:Python Shell GO
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
LINUX进程内存占用查看
LINUX进程内存占用查看
linux 职场 内存 休闲 查看