#!/bin/sh # # CDDL HEADER START # # The contents of this file are subject to the terms # of the Common Development and Distribution License # (the "License"). You may not use this file except # in compliance with the License. # # You can obtain a copy of the license at # src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing # permissions and limitations under the License. # # When distributing Covered Code, include this CDDL # HEADER in each file and include the License file at # usr/src/OPENSOLARIS.LICENSE. If applicable, # add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your # own identifying information: Portions Copyright [yyyy] # [name of copyright owner] # # CDDL HEADER END # # # Copyright 2005 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # # output html comparison of several libmicro output data files # usage: multiview file1 file2 file3 file4 ... # # relative ranking is calculated using first as reference # color interpolation is done to indicate relative performance; # the redder the color, the slower the result, the greener the # faster /bin/nawk ' BEGIN { benchmark_count = 0; header_count = 0; } /^#/ { continue; } /errors/ { continue; } /^\!/ { split($0, A_header, ":"); name = substr(A_header[1],2); headers[name]=name; header_data[name,FILENAME] = substr($0, length(name) + 3); if (header_names[name] == 0) { header_names[name] = ++header_count; headers[header_count] = name; } continue; } { if(NF >= 7) { if (benchmark_names[$1] == 0) { benchmark_names[$1] = ++benchmark_count; benchmarks[benchmark_count] = $1; } if ($6 == 0) benchmark_data[$1,FILENAME] = $4; else benchmark_data[$1,FILENAME] = -1; } } END { printf("\n"); printf("\n"); printf("\n"); printf("\n"); printf("\n"); printf("multiview comparison\n") printf("\n"); printf("\n"); printf("\n"); printf("\n"); printf("\n"); for(i = 1; i <= header_count; i++) { hname = headers[i]; printf("\n", hname); for (j = 1; j < ARGC; j++) { sub("^[\t ]+", "", header_data[hname, ARGV[j]]); printf("\n", header_data[hname, ARGV[j]]); } printf("\n"); } printf("\n"); printf("\n"); printf("\n"); for (i = 2; i < ARGC; i++) printf("\n"); printf("\n"); for(i = 1; i < benchmark_count; i++) { for(j = 1; j < benchmark_count; j++) { if (benchmarks[j] > benchmarks[j + 1]) { tmp = benchmarks[j]; benchmarks[j] = benchmarks[j+1]; benchmarks[j+1] = tmp; } } } for(i = 1; i <= benchmark_count; i++) { name = benchmarks[i]; a = benchmark_data[name, ARGV[1]]; printf("\n"); printf("\n", name); if (a > 0) printf("\n", a); else { if (a < 0) printf("\n", "ERRORS"); else printf("\n", "missing"); for (j = 2; j < ARGC; j++) printf("\n", "not computed"); continue; } for (j = 2; j < ARGC; j++) { b = benchmark_data[name, ARGV[j]]; if (b > 0) { factor = b/a; bgcolor = colormap(factor); if (factor > 1) percentage = -(factor * 100 - 100); if (factor <= 1) percentage = 100/factor - 100; printf("\n", bgcolor, b, percentage); } else if (b < 0) printf("\n", "ERRORS"); else printf("\n", "missing"); } printf("\n"); } printf("
%s%s
BENCHMARKUSECSUSECS [percentage]
%s
%f
%s%s%s
%11.5f[%#+7.1f%%]
%s%25s
\n"); } function colormap(value, bgcolor, r, g, b) { if (value <= .2) value = .2; if (value > 5) value = 5; if (value < .9) { r = colorcalc(.2, value, .9, 0, 255); g = colorcalc(.2, value, .9, 153, 255); b = colorcalc(.2, value, .9, 0, 255); bgcolor=sprintf("#%2.2x%2.2x%2.2x", r, g, b); } else if (value < 1.1) bgcolor="#ffffff"; else { r = 255; g = colorcalc(1.1, value, 5, 255, 0); b = colorcalc(1.1, value, 5, 255, 0); bgcolor=sprintf("#%2.2x%2.2x%2.2x", r, g, b); } return (bgcolor); } function colorcalc(min, value, max, mincolor, maxcolor) { return((value - min)/(max-min) * (maxcolor-mincolor) + mincolor); } ' "$@"