Created
August 28, 2014 11:46
-
-
Save insideClaw/5bc0c39f43d863d70ae2 to your computer and use it in GitHub Desktop.
Snippet to get CPU usage per process. Takes PID as an argument.
This file contains hidden or 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 [ $# != 1 ]; then | |
echo "Usage: Provide the PID to check for CPU usage as an argument." | |
exit 1 | |
else | |
PID=$1 | |
fi | |
sleep 1 && pkill prstat & | |
prstat -p $PID | grep .*\..% | awk '{ print $9 }' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment