Created
January 6, 2012 21:15
-
-
Save taoliu/1572440 to your computer and use it in GitHub Desktop.
Monitor user time and memory usage of a process
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [[ $# < 2 ]];then | |
echo 'need two parameters: $0 <interval> <pid>' | |
exit 1; | |
fi | |
INTERVAL=$1 | |
PID=$2 | |
echo " time rss" | |
while [ $(ps -p $PID|wc -l) -gt 1 ];do | |
ps -o time,rss -p $PID | tail -1 | |
sleep $1 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment