#!/bin/bash core=$1 maxJobs=$2 runID=$3 benchmark=${4,} template_input=inputs/$4/in1 wss_settings=inputs/WSSS cache_settings=inputs/caches if [ $# -lt 4 ]; then echo "Usage $0 [template input] [DIS WSS file] [DIS cache file]" exit fi if [ $# -gt 4 ]; then echo "Using alternate input template from $5" template_input=$5 fi if [ $# -gt 5 ]; then echo "Using alternate WSS settings from $6" wss_settings=$6 fi if [ $# -gt 6 ]; then echo "Using alternate cache settings from $7" cache_settings=$7 fi echo "Making sure that binary is up to date..." make $benchmark echo "Done. Disabling real-time throttling..." # Turn off rt throttling echo -1 > /proc/sys/kernel/sched_rt_runtime_us echo "Done. Redirecting all interrupts to core 0..." # TODO: Make this cleaner # Redirect all interrupts to core 0 i=0 for IRQ in /proc/irq/* do # Skip default_smp_affinity if [ -d $IRQ ]; then irqList[$i]=$(cat $IRQ/smp_affinity_list) echo 0 > $IRQ/smp_affinity_list fi i=$(( $i + 1 )) done echo "Done. Beginning benchmarks..." # Setup cache control group mount -t resctrl resctrl /sys/fs/resctrl mkdir /sys/fs/resctrl/benchmarks sleep 1 # Wait a second for the group to initialize echo $core > /sys/fs/resctrl/benchmarks/cpus_list # Execute the benchmark for each WSS and cache config while read j; do echo $j > /sys/fs/resctrl/benchmarks/schemata while read i; do if grep -q "#define LITMUS 1" ../../baseline/source/extra.h; then echo "Using LITMUS-RT!" ./gen_input.py $benchmark $template_input $i | ./$benchmark $benchmark-$i-$j $maxJobs $core $runID 1 else ./gen_input.py $benchmark $template_input $i | chrt -r 97 taskset -c $core ./$benchmark $benchmark-$i-$j $maxJobs $core $runID 1 fi done < $wss_settings done < $cache_settings # Put IRQs back as they were i=0 for IRQ in /proc/irq/* do if [ -d $IRQ ]; then echo ${irqList[$i]} > $IRQ/smp_affinity_list fi i=$(( $i + 1 )) done