File: memused

package info (click to toggle)
kissplice 2.6.7-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 16,752 kB
  • sloc: cpp: 8,783; python: 1,618; perl: 389; sh: 72; makefile: 18
file content (21 lines) | stat: -rwxr-xr-x 292 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/bash 

"$@" &

cd /proc/$!

max=0
while [ -f status ]
do 
sleep 0.1
if [ -f status ]
then
    mem=`cat status | grep VmHWM | tr -s [:blank:] | cut -d ' ' -f 2` 
    if [ "$mem" -gt "$max" ] 
	then    
	max=$mem
    fi 
fi;
done

echo "maximal memory used ( kilobyte(s) (K / Kb))" $max