#!/bin/bash
source ../machines/occigen-bdw/env 
cd $bench_dir/PROD/

log_file=`ls -thlx run_* | awk -F " " '{ print $1 }'`
start_t=`grep startup $log_file | awk '{ print $5 }'`
end_t=`grep "Total elapsed time:"  $log_file | awk '{ print $4 }'`
perf=`bc -l <<< $end_t-$start_t`

if [ -z "$perf" ] || [ -z "$end_t" ]
then
    echo "bench is not validated"
else
    echo "bench is validated"
    echo "end = $end_t s"
    echo "perf = $perf s (total simulation time excluding initialization and i/o)"
fi