From 1dd5fd3a69698a8ee628a4892620787d03de87a6 Mon Sep 17 00:00:00 2001 From: Laurent MAZET Date: Thu, 2 Oct 2025 12:00:42 +0200 Subject: [PATCH] add test scripts --- getinfo.sh | 8 ++++++++ gettable.awk | 6 ++++-- gettable.sh | 11 +++++++++++ sync.sh | 7 +++++++ test.sh | 9 +++++---- 5 files changed, 35 insertions(+), 6 deletions(-) create mode 100755 gettable.sh create mode 100755 sync.sh diff --git a/getinfo.sh b/getinfo.sh index a475916..af285eb 100755 --- a/getinfo.sh +++ b/getinfo.sh @@ -1,6 +1,14 @@ #!/bin/sh echo OS: $(uname -a 2>/dev/null || cat /proc/version) +echo "Model: $(cat /proc/cpuinfo | awk -F: '/[mM]odel/ {print $2; exit}')" cat /proc/cpuinfo | awk '/Features/ { sub(/\t/, ""); print; exit }' echo Nb cores: $(grep -c processor /proc/cpuinfo) cat /proc/meminfo | awk '/MemTotal/ { printf "Memory: %dGB\n", ($2+2^20-1)/2^20 }' + +config="/boot/config-$(uname -r)" +[ -f "$config" ] && hz=$(cat "$config" | grep '^[^#].*HZ=') +config=/proc/config.gz +[ -f "$config" ] && hz=$(zcat "$config" | grep '^[^#].*HZ=') +echo "Jiffies config: $(echo $hz)" + diff --git a/gettable.awk b/gettable.awk index bfb9175..1fdb526 100755 --- a/gettable.awk +++ b/gettable.awk @@ -1,8 +1,8 @@ -#!/bin/awk -f +#!/usr/bin/awk -f BEGIN { OFS=" & " - print "Test", "Load", "Minimum", "Average", "Maximun", "Standard Dev.", "25th %", "Median", "75th %" + #print "Test", "Load", "Minimum (us)", "Average (us)", "Maximun (us)", "Standard Dev. (us)", "25th % (us)", "Median (us)", "75th % (us)" } /Test:/ { @@ -10,6 +10,8 @@ BEGIN { test=$0 } +{ sub (/us$/, "") } + /Minimum/ { min=$3 } /Maximum/ { max=$3 } /Average/ { avg=$3 } diff --git a/gettable.sh b/gettable.sh new file mode 100755 index 0000000..1280967 --- /dev/null +++ b/gettable.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +echo "Test & Load & Minimum (us) & Average (us) & Maximun (us) & Standard Dev. (us) & 25th % (us) & Median (us) & 75th % (us)" + +for t in *.exe; do + t=${t/.exe/}; + for p in 0 50 100; do + f=$t-$p%.log + [ -f $f ] && awk -f gettable.awk -v COMMENT=$p% $f + done +done diff --git a/sync.sh b/sync.sh new file mode 100755 index 0000000..ad85a02 --- /dev/null +++ b/sync.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +# ssh-keygen +# cat ~/.ssh/id_rsa.pub | ssh mazet@192.168.1.1 "cat >> ~/.ssh/authorized_keys" +for f in cyclictest getinfo.sh gettable.awk hackbench load.exe mq.exe mutex.exe pipe.exe semaphore.exe test.sh thread.exe udp.exe; do +scp mazet@192.168.1.1:benchmarks/$f . +done diff --git a/test.sh b/test.sh index 3e158a3..ee986e6 100755 --- a/test.sh +++ b/test.sh @@ -3,12 +3,13 @@ export pid function run() { + load=$1 for test in mutex semaphore thread mq pipe udp; do - ./getinfo.sh + ./getinfo.sh | tee $test-$load.log pid=-1 - { ./$test.exe -d 1 -n 10000 -s -o $test-$1.dat; \ + { ./$test.exe -d 1 -n 10000 -s -o $test-$load.dat | tee -a $test-$load.log; \ kill -2 $(ps -e | awk '/[h]ackbench/ || /[s]leep/ { print $1 }') 2>/dev/null; } & - case "$1" in + case "$load" in 0%) sleep 60;; 50%) ./hackbench -p -g 1 -f 1 -T 1 -P 1 -s $((100 * 1000)) -l $((2 * 1000 * 1000));; 100%) ./hackbench -p -g 20 -l $((100 * 1000));; @@ -19,5 +20,5 @@ function run() { } for p in 0 50 100; do - run $p% | tee test-$p%.log + run $p% done -- 2.30.2