SHARE
TWEET

Untitled

a guest Jan 18th, 2019 51 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2. peak=0
  3. while pid=$1
  4. do
  5.     sample=`cat /proc/$pid/smaps | grep 'Rss:' | awk '{sum += $2} END{print sum}'`
  6.     if [ -n "$sample" ];then
  7.         let peak="sample > peak ? sample : peak"
  8.         sleep 1
  9.     else
  10.         echo "process $pid exit"
  11.         break
  12.     fi
  13. done
  14. echo "memusg: peak=$peak" >&2
  15. echo "pid = $pid"
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top