#! /bin/sh
# The SPIMS software is covered by a license. The use of the software
# represents acceptance of the terms and conditions in the license.
# ******************************************************************
# Copyright (c) 1989, Swedish Institute of Computer Science
awk '
BEGIN 		{ i = 0; } 
$1 == "ERROR" 	{ print }
$1 == "pagerecl"	{ print }
$1 == "pageio" 		{ print }
$1 == "swaps" 		{ print }
$3 == "iterations" 	{ it = $4 }
$1 == "Constant" && $2 == "value" { ms = $3;} 
$1 == "cputime"		{
	cpu = $2
	printf "%d\t%f ", ms, et/it; i++;
	if (et != 0) {
		printf "\tCPU usage %.2f%%", 100*cpu/et;
		if (min != 0 && max != 0) { 
			printf "\t(min %.1f, max %.1f, std dev. %.3f)\n", \
						min/it, max/it, std/et;
		} else {	
			printf "\n";
		}
	}
}
$1 == "elapsed" {
	et = $2;
	if (length($3) != 0) min = $3; else min = 0; 
	if (length($4) != 0) max = $4; else max = 0; 
	if (length($5) != 0) std = $5; else std = 0; 
} 
' $*
