From 6257a2752e39c55bfb03d6db94af0c6033feb8df Mon Sep 17 00:00:00 2001 From: Stefano Brivio Date: Thu, 21 Oct 2021 01:24:22 +0200 Subject: test/perf: Try sourcing maximum scaling frequency from cpufreq On most recent CPUs, that's a better indication of all-core turbo frequency, or non-turbo frequency, than /proc/cpuinfo. Signed-off-by: Stefano Brivio --- test/perf/passt_tcp | 4 +++- test/perf/passt_udp | 5 ++++- test/perf/pasta_tcp | 5 ++++- test/perf/pasta_udp | 4 +++- 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/test/perf/passt_tcp b/test/perf/passt_tcp index 9c4d5e5..0db12ea 100644 --- a/test/perf/passt_tcp +++ b/test/perf/passt_tcp @@ -33,8 +33,10 @@ ns sysctl -w net.ipv4.tcp_timestamps=0 gout GW ip -j -4 ro sh|jq -rM '.[] | select(.dst == "default").gateway' gout GW6 ip -j -6 ro sh|jq -rM '.[] | select(.dst == "default").gateway' gout IFNAME ip -j li sh | jq -rM '.[] | select(.link_type == "ether").ifname' -hout FREQ (echo "scale=1"; sed -n 's/cpu MHz.*: \([0-9]*\)\..*$/(\1+10^2\/2)\/10^3/p' /proc/cpuinfo) | bc -l | head -n1 +hout FREQ_PROCFS (echo "scale=1"; sed -n 's/cpu MHz.*: \([0-9]*\)\..*$/(\1+10^2\/2)\/10^3/p' /proc/cpuinfo) | bc -l | head -n1 +hout FREQ_CPUFREQ (echo "scale=1"; printf '( %i + 10^5 / 2 ) / 10^6\n' $(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq) ) | bc -l +hout FREQ [ -n "__FREQ_CPUFREQ__" ] && echo __FREQ_CPUFREQ__ || echo __FREQ_PROCFS__ set THREADS 1 set STREAMS 8 diff --git a/test/perf/passt_udp b/test/perf/passt_udp index e351987..1385c86 100644 --- a/test/perf/passt_udp +++ b/test/perf/passt_udp @@ -26,7 +26,10 @@ guest /sbin/sysctl -w net.core.wmem_default=16777216 gout GW ip -j -4 ro sh|jq -rM '.[] | select(.dst == "default").gateway' gout GW6 ip -j -6 ro sh|jq -rM '.[] | select(.dst == "default").gateway' gout IFNAME ip -j li sh | jq -rM '.[] | select(.link_type == "ether").ifname' -hout FREQ (echo "scale=1"; sed -n 's/cpu MHz.*: \([0-9]*\)\..*$/(\1+10^2\/2)\/10^3/p' /proc/cpuinfo) | bc -l | head -n1 + +hout FREQ_PROCFS (echo "scale=1"; sed -n 's/cpu MHz.*: \([0-9]*\)\..*$/(\1+10^2\/2)\/10^3/p' /proc/cpuinfo) | bc -l | head -n1 +hout FREQ_CPUFREQ (echo "scale=1"; printf '( %i + 10^5 / 2 ) / 10^6\n' $(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq) ) | bc -l +hout FREQ [ -n "__FREQ_CPUFREQ__" ] && echo __FREQ_CPUFREQ__ || echo __FREQ_PROCFS__ set THREADS 2 set STREAMS 1 diff --git a/test/perf/pasta_tcp b/test/perf/pasta_tcp index ac4cd60..a330bb4 100644 --- a/test/perf/pasta_tcp +++ b/test/perf/pasta_tcp @@ -25,7 +25,10 @@ ns sysctl -w net.ipv4.tcp_timestamps=0 set THREADS 2 set STREAMS 2 set OPTS -Z -w 4M -l 1M -P __STREAMS__ -i1 -t30 -O5 --pacing-timer 10000 -hout FREQ (echo "scale=1"; sed -n 's/cpu MHz.*: \([0-9]*\)\..*$/(\1+10^2\/2)\/10^3/p' /proc/cpuinfo) | bc -l | head -n1 + +hout FREQ_PROCFS (echo "scale=1"; sed -n 's/cpu MHz.*: \([0-9]*\)\..*$/(\1+10^2\/2)\/10^3/p' /proc/cpuinfo) | bc -l | head -n1 +hout FREQ_CPUFREQ (echo "scale=1"; printf '( %i + 10^5 / 2 ) / 10^6\n' $(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq) ) | bc -l +hout FREQ [ -n "__FREQ_CPUFREQ__" ] && echo __FREQ_CPUFREQ__ || echo __FREQ_PROCFS__ info Throughput in Gbps, latency in µs, __THREADS__ threads at __FREQ__ GHz, __STREAMS__ streams each diff --git a/test/perf/pasta_udp b/test/perf/pasta_udp index adaebd0..0968379 100644 --- a/test/perf/pasta_udp +++ b/test/perf/pasta_udp @@ -17,7 +17,9 @@ nstools ip sleep iperf3 udp_rr jq sed test pasta: throughput and latency (local traffic) -hout FREQ (echo "scale=1"; sed -n 's/cpu MHz.*: \([0-9]*\)\..*$/(\1+10^2\/2)\/10^3/p' /proc/cpuinfo) | bc -l | head -n1 +hout FREQ_PROCFS (echo "scale=1"; sed -n 's/cpu MHz.*: \([0-9]*\)\..*$/(\1+10^2\/2)\/10^3/p' /proc/cpuinfo) | bc -l | head -n1 +hout FREQ_CPUFREQ (echo "scale=1"; printf '( %i + 10^5 / 2 ) / 10^6\n' $(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq) ) | bc -l +hout FREQ [ -n "__FREQ_CPUFREQ__" ] && echo __FREQ_CPUFREQ__ || echo __FREQ_PROCFS__ set THREADS 1 set STREAMS 4 -- cgit v1.2.3