1N/A# The contents of this file are subject to the terms 1N/A# of the Common Development and Distribution License 1N/A# (the "License"). You may not use this file except 1N/A# in compliance with the License. 1N/A# You can obtain a copy of the license at 1N/A# See the License for the specific language governing 1N/A# permissions and limitations under the License. 1N/A# When distributing Covered Code, include this CDDL 1N/A# HEADER in each file and include the License file at 1N/A# add the following below this CDDL HEADER, with the 1N/A# fields enclosed by brackets "[]" replaced with your 1N/A# own identifying information: Portions Copyright [yyyy] 1N/A# [name of copyright owner] 1N/A# Copyright 2005 Sun Microsystems, Inc. All rights reserved. 1N/A# Use is subject to license terms. 1N/A# output html comparison of several libmicro output data files 1N/A# usage: multiview file1 file2 file3 file4 ... 1N/A# relative ranking is calculated using first as reference 1N/A# color interpolation is done to indicate relative performance; 1N/A# the redder the color, the slower the result, the greener the 1N/A benchmark_count = 0; 1N/A split($0, A_header, ":"); 1N/A name = substr(A_header[1],2); 1N/A header_data[name,FILENAME] = substr($0, length(name) + 3); 1N/A if (header_names[name] == 0) { 1N/A header_names[name] = ++header_count; 1N/A headers[header_count] = name; 1N/A if (benchmark_names[$1] == 0) { 1N/A benchmark_names[$1] = ++benchmark_count; 1N/A benchmarks[benchmark_count] = $1; 1N/A benchmark_data[$1,FILENAME] = $4; 1N/A benchmark_data[$1,FILENAME] = -1; 3N/A printf("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n"); 3N/A printf("<meta http-equiv=\"content-type\" content=\"text/html; charset=ISO-8859-1\" />\n"); 3N/A printf("<meta name=\"author\" content=\"autogen\" />\n"); 1N/A printf("<title>multiview comparison</title>\n") 3N/A printf("body { font-family: sans-serif; }\n"); 3N/A printf("table { border-collapse: collapse; }\n"); 3N/A printf("td { padding: 0.1em; border: 1px solid #ccc; text-align: right; }\n"); 3N/A printf("pre { margin-top: 0em; margin-bottom: 0em; }\n"); 3N/A printf("</style>\n"); 1N/A printf("</head>\n"); 1N/A printf("<body bgcolor=\"#ffffff\" link=\"#0000ee\" vlink=\"#cc0000\" alink=\"#0000ee\">\n"); 1N/A printf("<table border=\"1\" cellspacing=\"1\">\n"); 1N/A printf("<tbody>\n"); 1N/A for(i = 1; i <= header_count; i++) { 3N/A printf("<tr><td class=\"header\">%s</td>\n", hname); 3N/A for (j = 1; j < ARGC; j++) { 3N/A sub("^[\t ]+", "", header_data[hname, ARGV[j]]); 3N/A printf("<td class=\"header\">%s</td>\n", header_data[hname, ARGV[j]]); 3N/A printf("<th>BENCHMARK</th>\n"); 3N/A printf("<th align=\"right\">USECS</th>\n"); 1N/A for (i = 2; i < ARGC; i++) 7N/A printf("<th align=\"right\">USECS [percentage]</th>\n"); 1N/A for(i = 1; i < benchmark_count; i++) { 1N/A for(j = 1; j < benchmark_count; j++) { 1N/A if (benchmarks[j] > benchmarks[j + 1]) { 1N/A tmp = benchmarks[j]; 1N/A benchmarks[j] = benchmarks[j+1]; 1N/A benchmarks[j+1] = tmp; 1N/A for(i = 1; i <= benchmark_count; i++) { 1N/A name = benchmarks[i]; 1N/A a = benchmark_data[name, ARGV[1]]; 3N/A printf("<td>%s</td>\n", name); 3N/A printf("<td><pre>%f</pre></td>\n", a); 3N/A printf("<td bgcolor=\"#ff0000\">%s</td>\n", "ERRORS"); 3N/A printf("<td>%s</td>\n", "missing"); 1N/A for (j = 2; j < ARGC; j++) 3N/A printf("<td>%s</td>\n", "not computed"); 1N/A for (j = 2; j < ARGC; j++) { 1N/A b = benchmark_data[name, ARGV[j]]; 1N/A bgcolor = colormap(factor); 1N/A percentage = -(factor * 100 - 100); 1N/A percentage = 100/factor - 100; 3N/A printf("<td bgcolor=\"%s\"><pre>%11.5f[%#+7.1f%%]</pre></td>\n", 1N/A bgcolor, b, percentage); 3N/A printf("<td bgcolor=\"#ff0000\">%s</td>\n", "ERRORS"); 3N/A printf("<td>%25s</td>\n", "missing"); 3N/A printf("</tbody></table></body></html>\n"); 1N/Afunction colormap(value, bgcolor, r, g, b) 1N/A r = colorcalc(.2, value, .9, 0, 255); 1N/A g = colorcalc(.2, value, .9, 153, 255); 1N/A b = colorcalc(.2, value, .9, 0, 255); 3N/A bgcolor=sprintf("#%2.2x%2.2x%2.2x", r, g, b); 1N/A else if (value < 1.1) 1N/A g = colorcalc(1.1, value, 5, 255, 0); 1N/A b = colorcalc(1.1, value, 5, 255, 0); 3N/A bgcolor=sprintf("#%2.2x%2.2x%2.2x", r, g, b); 1N/Afunction colorcalc(min, value, max, mincolor, maxcolor) 1N/A return((value - min)/(max-min) * (maxcolor-mincolor) + mincolor);