Last active
March 18, 2016 08:16
-
-
Save Dih5/61fb204bbbfc8dc6bed3 to your computer and use it in GitHub Desktop.
Check the CPU use of the system, including number of threads in use
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 | |
CPUUSE=`top -b -n2 | grep "Cpu(s)" | tail -1 | sed -e 's/[^0-9]*\([0-9][0-9]*[\.\,][0-9]\).*/\1/'` | |
CORES=`cat /proc/cpuinfo | grep -i 'processor' | wc -l` | |
USEDCORES=`echo "scale=1;$CPUUSE * $CORES / 100" | bc` | |
echo CPU used: $CPUUSE% Threads: $USEDCORES/$CORES |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment