#!/bin/bash # Save path the current path that will be used to store the results. BASE_PATH=$(pwd) # Local variable to store if cpu or gpu directed benchmark TYPE=$3 # Check if we need to create the directories to store the results if [ ! -d "results" ]; then mkdir results fi if [ ! -d "results/$TYPE" ]; then mkdir results/$TYPE fi # Enter in the directory passed as first parameter, then execute run and save the results in the file passed as second parameter cd $1 BENCH_NAME=$1 # Start the actual benchmark BENCH_TIME=`(/usr/bin/time -f "%e" ./run-$TYPE) 2>&1 > /dev/zero | tail -1` # Save execution time in the log echo "$BENCH_NAME $BENCH_TIME" >> $BASE_PATH/results/$TYPE/$2 # Sleep in order to give time to the power measurement script to reset. sleep 5