File: memused

package info (click to toggle)
bcalm 2.2.3-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 624 kB
  • sloc: cpp: 3,132; python: 314; sh: 87; makefile: 13
file content (22 lines) | stat: -rwxr-xr-x 318 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/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  | sed 's/[^0-9]*//g'`
    if [ "0$mem" -gt "0$max" ]
    then
        max=$mem
    fi
fi;
done

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