#!/usr/bin/env bash
#
# Multi Proc Test
#
# To output report:
#   grep -e ^@ -e "start bench" -e ^[0-9] <log>
#

HERE="$(cd -P "$(dirname "${BASH_SOURCE:-$0}")" && pwd -P)"

# trap INT QUIT TERM
trap 'exit' 2 3 15

# 10 part
{
  echo "@@@@@ 10 partitions"
  bash "$HERE"/partition_test.sh setup --part 1000 10
  bash "$HERE"/partition_test.sh bench --procnum 5 part 1000 1 10

  bash "$HERE"/partition_test.sh setup --part 1000 10
  bash "$HERE"/partition_test.sh bench --procnum 5 part_child 1000 1 10

  bash "$HERE"/partition_test.sh setup 1000 10
  bash "$HERE"/partition_test.sh bench --procnum 5 nopart 1000 1 10
}

echo


# 100 part
{
  echo "@@@@@ 100 partitions"
  bash "$HERE"/partition_test.sh setup --part 1000 100
  bash "$HERE"/partition_test.sh bench --procnum 5 part 1000 1 10

  bash "$HERE"/partition_test.sh setup --part 1000 100
  bash "$HERE"/partition_test.sh bench --procnum 5 part_child 1000 1 10

  bash "$HERE"/partition_test.sh setup 1000 100
  bash "$HERE"/partition_test.sh bench --procnum 5 nopart 1000 1 10
}

echo

# 1000 part
{
  echo "@@@@@ 1000 partitions"
  bash "$HERE"/partition_test.sh setup --part 1000 1000
  bash "$HERE"/partition_test.sh bench --procnum 5 part 1000 1 10

  bash "$HERE"/partition_test.sh setup --part 1000 1000
  bash "$HERE"/partition_test.sh bench --procnum 5 part_child 1000 1 10

  bash "$HERE"/partition_test.sh setup 1000 1000
  bash "$HERE"/partition_test.sh bench --procnum 5 nopart 1000 1 10
}

# 2000 part
{
  echo "@@@@@ 2000 partitions"
  bash "$HERE"/partition_test.sh setup --part 1000 2000
  bash "$HERE"/partition_test.sh bench --procnum 5 part 1000 1 10

  bash "$HERE"/partition_test.sh setup --part 1000 2000
  bash "$HERE"/partition_test.sh bench --procnum 5 part_child 1000 1 10

  bash "$HERE"/partition_test.sh setup 1000 2000
  bash "$HERE"/partition_test.sh bench --procnum 5 nopart 1000 1 10
}
