#!/bin/sh -ef
# NAME=CPU benchmark: Dhrystone
# DESCRIPTION=A synthetic computing benchmark that measures CPU integer performance. Inquisitor uses a C version and runs the specified number of loops, testing each CPU separately, with testing process running affined to particular CPU. Performance rating is in terms of MIPS.
# DESTROYS_HDD=false
# POWEROFF_DURING_TEST=false
# VERSION=0.1
# TAGS=benchmark,cpu
# DEPENDS=CPU
# VAR=DURATION:int:300:Benchmark duration (sec)

. _inq-config-global; . $SHARE_DIR/functions-test

exit_handler()
{
	[ -f "$RESULT_FILE" ] && rm -f $RESULT_FILE
}

CPU_QUANTITY=`cpu_quantity`

test_promise_time $DURATION

for i in `seq 0 $(($CPU_QUANTITY - 1))`; do
	echo -n "Dhrystone on core $i"
	result=`taskset -c $i dhrystone $DURATION 2>&1 | awk '{print $1}'`
	echo_success
	benchmark_submit_float "Core $i" "$result" "loops"
	test_progress $(( $i + 1 )) $CPU_QUANTITY
done

test_succeeded
