4 echo "Usage: $0 [-s <pool size> -i <number of iterations> -t <CPU_INTENSIVE|IO_INTENSIVE>] [-n <number of tasks>]" 1>&2
8 while getopts "s:i:t:n:h" option
24 echo "Error: Missing option argument for '-${OPTARG}'" >&2;
29 echo "Error: Unknown or invalid option for '-${OPTARG}'" >&2;
38 taskType
=${taskType:-'CPU_INTENSIVE'}
39 taskSize
=${taskSize:-5000}
40 poolSize
=${poolSize:-$(nproc --all)}
41 iterations
=${iterations:-100000}
43 echo 'Running benchmarks with pool size:' ${poolSize}', number of iterations:' ${iterations}', task type:' ${taskType} 'and task size:' ${taskSize}
44 export NODE_ENV
=production
45 export TASK_TYPE
=${taskType}
46 export TASK_SIZE
=${taskSize}
47 export POOL_SIZE
=${poolSize}
48 export NUM_ITERATIONS
=${iterations}
51 caffeinate .
/hyperfine_benchmarks.sh
54 systemd-inhibit .
/hyperfine_benchmarks.sh
57 echo "Unsupported $OSTYPE"