summaryrefslogtreecommitdiff
path: root/memory-usage
blob: 5c2104fa0e6628b704913556489a09fdaa53d884 (plain)
1
2
3
4
5
6
7
8
9
10
11
#!/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%% *} / 1024)) m"