summaryrefslogtreecommitdiff
path: root/memusg.sh
blob: e3b6f905505a9695329905af5ad39a83c3c21a2c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
#!/bin/bash


"$@" &
pid=$! peak=0
while true; do
  sleep 1
  sample="$(ps -o rss= $pid 2> /dev/null)" || break
  let peak='sample > peak ? sample : peak'
done
#echo "Peak: $peak" 1>&2
echo "$(( ${peak%% *} / 1024)) m"