diff --git a/bench.sh b/bench.sh index 7babcc3..0cb59f5 100644 --- a/bench.sh +++ b/bench.sh @@ -6,18 +6,11 @@ # Visit: https://teddysun.com # #==============================================================# -cname=$( awk -F: '/model name/ {name=$2} END {print name}' /proc/cpuinfo | sed 's/^[ \t]*//;s/[ \t]*$//' ) -cores=$( awk -F: '/model name/ {core++} END {print core}' /proc/cpuinfo ) -freq=$( awk -F: '/cpu MHz/ {freq=$2} END {print freq}' /proc/cpuinfo | sed 's/^[ \t]*//;s/[ \t]*$//' ) -tram=$( free -m | awk '/Mem/ {print $2}' ) -swap=$( free -m | awk '/Swap/ {print $2}' ) -up=$( awk '{a=$1/86400;b=($1%86400)/3600;c=($1%3600)/60;d=$1%60} {printf("%ddays, %d:%d:%d\n",a,b,c,d)}' /proc/uptime ) -opsy=$( cat /etc/issue.net | awk 'NR==1 {print}' ) -arch=$( uname -m ) -lbit=$( getconf LONG_BIT ) -host=$( hostname ) -kern=$( uname -r ) -ipv6=$( wget -qO- -t1 -T2 ipv6.icanhazip.com ) +get_opsy() { + [ -f /etc/os-release ] && awk -F'[= "]' '/PRETTY_NAME/{print $3,$4,$5}' && return + [ -f /etc/lsb-release ] && awk -F'[="]+' '/DESCRIPTION/{print $2}' /etc/lsb-release && return + [ -f /etc/redhat-release ] && awk '{print ($1,$3~/^[0-9]/?$3:$4)}' /etc/redhat-release && return +} next() { printf "%-70s\n" "-" | sed 's/\s/-/g' @@ -86,6 +79,19 @@ io_test() { (dd if=/dev/zero of=test_$$ bs=64k count=16k conv=fdatasync && rm -f test_$$ ) 2>&1 | awk -F, '{io=$NF} END { print io}' | sed 's/^[ \t]*//;s/[ \t]*$//' } +cname=$( awk -F: '/model name/ {name=$2} END {print name}' /proc/cpuinfo | sed 's/^[ \t]*//;s/[ \t]*$//' ) +cores=$( awk -F: '/model name/ {core++} END {print core}' /proc/cpuinfo ) +freq=$( awk -F: '/cpu MHz/ {freq=$2} END {print freq}' /proc/cpuinfo | sed 's/^[ \t]*//;s/[ \t]*$//' ) +tram=$( free -m | awk '/Mem/ {print $2}' ) +swap=$( free -m | awk '/Swap/ {print $2}' ) +up=$( awk '{a=$1/86400;b=($1%86400)/3600;c=($1%3600)/60;d=$1%60} {printf("%ddays, %d:%d:%d\n",a,b,c,d)}' /proc/uptime ) +opsy=$( get_opsy ) +arch=$( uname -m ) +lbit=$( getconf LONG_BIT ) +host=$( hostname ) +kern=$( uname -r ) +ipv6=$( wget -qO- -t1 -T2 ipv6.icanhazip.com ) + clear next echo "CPU model : $cname"