From Wiki-UX.info

How to analize process memory footprint
Jump to: navigation, search

How to analize process memory footprint

Memory footprint

export DELAY=10
export UNIX95=
 
for sample in 1 2 3 4 5 6
do
ps -eo pid,sz,user | grep -v PID | awk '{printf "%d %d %d %s\n", $1, '$sample', $2, $3}'
sleep $DELAY
done | sort -n -k 1,2 | awk 'BEGIN {ID=1; SZ=0; INC=0}
      { if ($1 == ID) {
           if ($3 > SZ) {
            INC = INC + 1
            if (INC > 1) { printf "ID=%d SZ=%d DELTA=%d\n", $1, $3, $3 - SZ }
            }
         SZ = $3
         } else {
         ID = $1; INC = 0; SZ=0
         }
      }'

Example:

ID=1 SZ=300 DELTA=38
ID=5499 SZ=300 DELTA=138
ID=5499 SZ=400 DELTA=100
ID=5499 SZ=500 DELTA=100
This page was last modified on 4 December 2008, at 20:46. This page has been accessed 1,370 times.