#!/bin/sh -ef
# NAME=CPU benchmark: Whetstone
# DESCRIPTION=A synthetic computing benchmark that measures CPU floating-point 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=LOOPS:int:200000:Loop count

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

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

CPU_QUANTITY=`cpu_quantity`

for i in `seq 0 $(($CPU_QUANTITY - 1))`; do
	echo -n "Whetstone on core $i"
	result=`taskset -c $i whetstone $LOOPS 2>&1 | grep Whetstones | \
		awk '{print $6}'`
	echo_success
	benchmark_submit_float "Core $i" "$result" "whetstones"
	test_progress $(( $i + 1 )) $CPU_QUANTITY
done

test_succeeded
