]>
git.saurik.com Git - apple/xnu.git/blob - tools/tests/libMicro/multiview.sh
5 # The contents of this file are subject to the terms
6 # of the Common Development and Distribution License
7 # (the "License"). You may not use this file except
8 # in compliance with the License.
10 # You can obtain a copy of the license at
11 # src/OPENSOLARIS.LICENSE
12 # or http://www.opensolaris.org/os/licensing.
13 # See the License for the specific language governing
14 # permissions and limitations under the License.
16 # When distributing Covered Code, include this CDDL
17 # HEADER in each file and include the License file at
18 # usr/src/OPENSOLARIS.LICENSE. If applicable,
19 # add the following below this CDDL HEADER, with the
20 # fields enclosed by brackets "[]" replaced with your
21 # own identifying information: Portions Copyright [yyyy]
22 # [name of copyright owner]
28 # Copyright 2005 Sun Microsystems, Inc. All rights reserved.
29 # Use is subject to license terms.
33 # output html comparison of several libmicro output data files
34 # usage: multiview file1 file2 file3 file4 ...
36 # relative ranking is calculated using first as reference
37 # color interpolation is done to indicate relative performance;
38 # the redder the color, the slower the result, the greener the
52 split($0, A_header, ":");
53 name = substr(A_header[1],2);
55 header_data[name,FILENAME] = substr($0, length(name) + 3);
56 if (header_names[name] == 0) {
57 header_names[name] = ++header_count;
58 headers[header_count] = name;
65 if (benchmark_names[$1] == 0) {
66 benchmark_names[$1] = ++benchmark_count;
67 benchmarks[benchmark_count] = $1;
70 benchmark_data[$1,FILENAME] = $4;
72 benchmark_data[$1,FILENAME] = -1;
77 printf("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n");
78 printf("\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n");
79 printf("<html xmlns=\"http://www.w3.org/1999/xhtml\">\n");
81 printf("<meta http-equiv=\"content-type\" content=\"text/html; charset=ISO-8859-1\" />\n");
82 printf("<meta name=\"author\" content=\"autogen\" />\n");
83 printf("<title>multiview comparison</title>\n")
84 printf("<style type=\"text/css\">\n");
85 printf("body { font-family: sans-serif; }\n");
86 printf("table { border-collapse: collapse; }\n");
87 printf("td { padding: 0.1em; border: 1px solid #ccc; text-align: right; }\n");
88 printf("td.header { text-align: left; }\n");
89 printf("pre { margin-top: 0em; margin-bottom: 0em; }\n");
92 printf("<body bgcolor=\"#ffffff\" link=\"#0000ee\" vlink=\"#cc0000\" alink=\"#0000ee\">\n");
93 printf("<table border=\"1\" cellspacing=\"1\">\n");
95 for(i = 1; i <= header_count; i++) {
97 printf("<tr><td class=\"header\">%s</td>\n", hname);
99 for (j = 1; j < ARGC; j++) {
100 sub("^[\t ]+", "", header_data[hname, ARGV[j]]);
101 printf("<td class=\"header\">%s</td>\n", header_data[hname, ARGV[j]]);
106 printf("<th>BENCHMARK</th>\n");
107 printf("<th align=\"right\">USECS</th>\n");
109 for (i = 2; i < ARGC; i++)
110 printf("<th align=\"right\">USECS [percentage]</th>\n");
113 for(i = 1; i < benchmark_count; i++) {
114 for(j = 1; j < benchmark_count; j++) {
115 if (benchmarks[j] > benchmarks[j + 1]) {
117 benchmarks[j] = benchmarks[j+1];
118 benchmarks[j+1] = tmp;
123 for(i = 1; i <= benchmark_count; i++) {
124 name = benchmarks[i];
125 a = benchmark_data[name, ARGV[1]];
128 printf("<td>%s</td>\n", name);
130 printf("<td><pre>%f</pre></td>\n", a);
133 printf("<td bgcolor=\"#ff0000\">%s</td>\n", "ERRORS");
135 printf("<td>%s</td>\n", "missing");
137 for (j = 2; j < ARGC; j++)
138 printf("<td>%s</td>\n", "not computed");
142 for (j = 2; j < ARGC; j++) {
143 b = benchmark_data[name, ARGV[j]];
146 bgcolor = colormap(factor);
148 percentage = -(factor * 100 - 100);
150 percentage = 100/factor - 100;
152 printf("<td bgcolor=\"%s\"><pre>%11.5f[%#+7.1f%%]</pre></td>\n",
153 bgcolor, b, percentage);
157 printf("<td bgcolor=\"#ff0000\">%s</td>\n", "ERRORS");
159 printf("<td>%25s</td>\n", "missing");
165 printf("</tbody></table></body></html>\n");
169 function colormap(value, bgcolor, r, g, b)
177 r = colorcalc(.2, value, .9, 0, 255);
178 g = colorcalc(.2, value, .9, 153, 255);
179 b = colorcalc(.2, value, .9, 0, 255);
180 bgcolor=sprintf("#%2.2x%2.2x%2.2x", r, g, b);
182 else if (value < 1.1)
186 g = colorcalc(1.1, value, 5, 255, 0);
187 b = colorcalc(1.1, value, 5, 255, 0);
188 bgcolor=sprintf("#%2.2x%2.2x%2.2x", r, g, b);
194 function colorcalc(min, value, max, mincolor, maxcolor)
196 return((value - min)/(max-min) * (maxcolor-mincolor) + mincolor);