#!/bin/bash

# script for executing benchmark for high contention, high conflict

# create/clear benchmark subdirectory
mkdir -p hchc
rm -rf hchc/*

# copy raw file to correct location
cp /home/kreft/benchmark/benchmarks/fill_hchc_sqlite ./fill.txt

echo "Executing hchc benchmark"
for updates in 1 2 3 4 5 6 7 8 9 10
do
  # create/clear subdirectories for different parameters
  dir_name="upd_$updates"
  mkdir -p ./hchc/$dir_name
  rm -f ./hchc/$dir_name/*.txt

  # copy raw file to correct location
  cp /home/kreft/benchmark/benchmarks/mixed_hchc_$((updates))_sqlite ./mixed.txt

  echo "Executing runs for $updates updates"
  for run in 1 2 3 4 5
  do
    echo "Executing run $run"
		cat benchmark_run.txt | ../sqlite_binary ":memory:" >> ./hchc/$dir_name/messung.txt
    echo "Executing run $run with index"
		cat benchmark_run_index.txt | ../sqlite_binary ":memory:" >> ./hchc/$dir_name/messung_index.txt
  done
done
