1# $Id: report.awk,v 1.3 2008/01/02 15:54:03 bostic Exp $ 2 3/^[^#]/ { 4 total[$1] += $2 5 sum[$1] += $2 * $2 6 ++count[$1]; 7} 8END { 9 # Compute the average, find the maximum. 10 for (i in total) { 11 avg[i] = total[i] / count[i]; 12 if (max < avg[i]) 13 max = avg[i] 14 } 15 16 for (i in total) { 17 # Calculate variance by raw score method. 18 var = (sum[i] - ((total[i] * total[i]) / count[i])) / count[i]; 19 20 # The standard deviation is the square root of the variance. 21 stdv = sqrt(var); 22 23 # Display the release value, the average score, and run count. 24 printf("%s:%.2f:%d:", i, avg[i], count[i]); 25 26 # If this run wasn't the fastest, display the percent by which 27 # this run was slower. 28 if (max != avg[i]) 29 printf("%.0f%%", ((max - avg[i]) / max) * 100); 30 31 printf(":"); 32 33 # If there was more than a single run, display the relative 34 # standard deviation. 35 if (count[i] > 1) 36 printf("%.0f%%", stdv * 100 / avg[i]); 37 38 printf("\n"); 39 } 40} 41