Created
August 7, 2013 14:46
-
-
Save jamesstout/6174698 to your computer and use it in GitHub Desktop.
test
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
function cpuuu (){ | |
declare pids=($(ps aux | grep -E *(ImageOp|ImageAl) | grep -v grep | awk '{print $3}')) | |
pidCount=${#pids[@]} | |
while [ "$pidCount" -gt 0 ] | |
do | |
let timeSpent=0 | |
for index in ${!pids[*]} | |
do | |
tmp=${pids[$index]} | |
tmp=${tmp/\.*} | |
let timeSpent+=$tmp | |
done | |
echo "CPU Utilisation: $timeSpent%" | |
sleep 3 | |
pids=($(ps aux | grep -E *(ImageOp|ImageAl) | grep -v grep | awk '{print $3}')) | |
pidCount=${#pids[@]} | |
done | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment