about summary refs log tree commit diff stats
path: root/archive/2024/winter/bsc_dichler/experiments/malloc/benchmark.sh
blob: 9b640d6c28e773476dc2d9e2c6ee9495fc5ac894 (plain) (blame)
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
#!/usr/bin/env bash

set -o errexit  # when a command fails, exist
set -o nounset  # fail when accessing an unset variable
set -o pipefail # fail pipeline if any command errors

ARRAY=(16 128 256 1024 2048 4096 8192)
CORE=5

run_experiment() {
    local executable=$1
    local output_file=$2
    local option=$3

    rm -f "$output_file"
    touch "$output_file"
    echo "size;allocation;duration_allocation;duration_deallocation" >> "$output_file"
    
    for size in "${ARRAY[@]}"; do
       MEMTAG_OPTIONS="$option" taskset -c "$CORE" "$executable" 9 "$size" | tee -a "$output_file"
    done
}

rm -rf results
mkdir results

run_experiment "./malloc" "results/malloc.csv" "off"
run_experiment "./malloc_mte" "results/malloc_mte.csv" "sync"