Created
November 23, 2015 13:10
-
-
Save lonefreak/dd38631b7ebaed44b4ee to your computer and use it in GitHub Desktop.
Parse information from /proc/cpuinfo to help check if HT is enabled
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/sh | |
CPUFILE=/proc/cpuinfo | |
test -f $CPUFILE || exit 1 | |
NUMPHY=`grep "physical id" $CPUFILE | sort -u | wc -l` | |
NUMLOG=`grep "processor" $CPUFILE | wc -l` | |
if [ $NUMPHY -eq 1 ] | |
then | |
echo This system has one physical CPU, | |
else | |
echo This system has $NUMPHY physical CPUs, | |
fi | |
if [ $NUMLOG -gt 1 ] | |
then | |
echo and $NUMLOG logical CPUs. | |
NUMCORE=`grep "core id" $CPUFILE | sort -u | wc -l` | |
if [ $NUMCORE -gt 1 ] | |
then | |
echo For every physical CPU there are $NUMCORE cores. | |
fi | |
else | |
echo and one logical CPU. | |
fi | |
echo -n The CPU is a `grep "model name" $CPUFILE | sort -u | cut -d : -f 2-` | |
echo " with`grep "cache size" $CPUFILE | sort -u | cut -d : -f 2-` cache" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This was fetched from
http://unix.stackexchange.com/questions/33450/checking-if-hyperthreading-is-enabled-or-not/33509#33509