File: run-benchmarks-for.sh

package info (click to toggle)
libatomic-queue 0.0%2Bgit20220518.83774a2-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 10,352 kB
  • sloc: cpp: 1,620; javascript: 353; makefile: 131; python: 82; ansic: 74; sh: 59
file content (28 lines) | stat: -rwxr-xr-x 754 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/bash

# Copyright (c) 2019 Maxim Egorushkin. MIT License. See the full licence in file LICENSE.

lb="/usr/bin/stdbuf --output=L"

minutes=${1:-10}
$lb echo "Running benchmarks for ${minutes} minutes."
end_time=$(($(date +%s) + minutes * 60))

now=$(date --utc +%Y%m%dT%H%M%S)
cpucount=$(grep -c ^processor /proc/cpuinfo)
exe="$(dirname "$0")/../benchmarks"

function benchmark() {
    i=0
    while((1)); do
        remaining=$((end_time - $(date +%s)))
        ((remaining <= 0)) && break
        ((++i))
        $lb echo "[$i] $((remaining / 60))m:$((remaining % 60))s to go..."
        sudo chrt -f 50 "$exe"
    done
}

$(dirname "$0")/benchmark-prologue.sh
benchmark | tee results-${cpucount}.${now}.txt
$(dirname "$0")/benchmark-epilogue.sh