From 28e7865afb3593d7351937ccb2d9fbb6dcd6bd4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=89=E8=99=8E?= Date: Mon, 16 Oct 2023 14:50:20 +0800 Subject: [PATCH] Fixed processor name contains processor string issue (#114) When model name contain processor, such as 'Common KVM processor', it will cause a false calculate in processor. To prevent this, add ^ to make sure it only count the line start with processor. --- bench.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bench.sh b/bench.sh index 395583d..34381d6 100644 --- a/bench.sh +++ b/bench.sh @@ -235,7 +235,7 @@ print_intro() { # Get System information get_system_info() { cname=$(awk -F: '/model name/ {name=$2} END {print name}' /proc/cpuinfo | sed 's/^[ \t]*//;s/[ \t]*$//') - cores=$(awk -F: '/processor/ {core++} END {print core}' /proc/cpuinfo) + cores=$(awk -F: '/^processor/ {core++} END {print core}' /proc/cpuinfo) freq=$(awk -F'[ :]' '/cpu MHz/ {print $4;exit}' /proc/cpuinfo) ccache=$(awk -F: '/cache size/ {cache=$2} END {print cache}' /proc/cpuinfo | sed 's/^[ \t]*//;s/[ \t]*$//') cpu_aes=$(grep -i 'aes' /proc/cpuinfo)