aboutsummaryrefslogtreecommitdiff
path: root/etc/cpufreq
diff options
context:
space:
mode:
authorGravatar Andres Erbsen <andreser@mit.edu>2017-07-05 12:10:43 -0400
committerGravatar Andres Erbsen <andreser@mit.edu>2017-07-05 12:11:37 -0400
commit0a0a7db3bd132eab9a36c1f8fa901dc7ea20b8e7 (patch)
treec61be242b33278f640c84360def3e8c092042d83 /etc/cpufreq
parentd950635488d888960d876cd50d3b92ee1d48a6da (diff)
benchmarking: correct for differences in CPU and TSC frequency
Diffstat (limited to 'etc/cpufreq')
-rwxr-xr-xetc/cpufreq14
1 files changed, 14 insertions, 0 deletions
diff --git a/etc/cpufreq b/etc/cpufreq
new file mode 100755
index 000000000..bc5a66a85
--- /dev/null
+++ b/etc/cpufreq
@@ -0,0 +1,14 @@
+#!/bin/sh
+set -eu
+
+for cpu in $(seq 1 $(nproc)); do
+ echo "scale=100000;pi=4*a(1);0" | bc -l &
+ echo $!
+done | ( \
+ sleep .1 ;
+ mhz=$(cat /proc/cpuinfo | grep "^[c]pu MHz" | cut -d: -f2 | tr -d ' ' | sort -nr | head -1);
+ printf "$(echo "scale=2; ($mhz + 5)/1000" | bc)\n"
+ while IFS= read -r pid; do
+ kill "$pid";
+ done )
+