Another product of my boredom, these programs look over the virtual memory being used by a process. psmap.sh include dynamic libraries and files:
psmap.sh
#!/bin/sh
if [ $# -lt 1 ]; then
echo "Usage: $0 pname" > /dev/stderr
exit 1
fi
PIDS=( `pidof "$1"` )
if [ ${#PIDS[*]} -lt 1 ]; then
echo "No such process running: $1" > /dev/stderr
exit 2
fi
pmap -q ${PIDS[0]} | sort -k2,2 -n -r
panonmap.sh only gets the anonymous parts:
panonmap.sh
#!/bin/sh
if [ $# -lt 1 ]; then
echo "Usage: $0 pname" > /dev/stderr
exit 1
fi
PIDS=( `pidof "$1"` )
if [ ${#PIDS[*]} -lt 1 ]; then
echo "No such process running: $1" > /dev/stderr
exit 2
fi
pmap -q ${PIDS[0]} | sort -k2,2 -n -r | awk '/\[ anon \]/ {total = total + int($2); print}; END { print "Total anon: " total "K"}'
No comments:
Post a Comment