summaryrefslogtreecommitdiffstats
path: root/timings/index.html
blob: 79c20393b0b30d1132dea9928fb6c91a1d3e5008 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
<html>
  <head>
    <title>SCons Timings</title>
    <script src="js/common.js"></script>
    <script language="javascript">
      var perf_url = DirName(window.location.href);
      function DisplayGraph(name, heighth, width, thumbnail, graph) {
        var params = ParseParams();
        var url = perf_url + '/' + name + '/graph.html' + '?lookout';
        //var debug = url;
        var debug = '';
        if ('history' in params) {
          url += '&history=' + params.history
        }
        if (typeof graph == 'undefined') {
          if ('graph' in params) {
            graph = params.graph;
          }
          url += '&header=';
        } else if (graph != null) {
          url += '&header=' + graph;
        }
        if (graph != null) {
          url += '&graph=' + graph;
        }
        if (thumbnail) {
          url += '&thumbnail';
        }
        document.write('<td>' + debug + '<iframe' +
                       //' scrolling="no"' +
                       ' height="' + heighth + '"' +
                       ' width="' + width + '"' +
                       ' src="' + url + '">' +
                       '</iframe></td>');
      }
    </script>
  </head>
  <body>
    <center>
      <script language="javascript">
        var params = ParseParams();
        // TODO:  parameterize these in a .dat file
        var builder_map = {
            'Ubuntu': 'ubuntu-timings',
        };
        var graphs_map = {
            'Performance': 'TimeSCons-elapsed',
            'Memory': 'memory-final',
        };
        var test_map = {
            'CPPPATH': 'CPPPATH',
            'ElectricCloud': 'ElectricCloud',
            'Java': 'Java',
            'JTimer': 'JTimer',
            'hundred': 'hundred',
        };
        if ('builder' in params) {
          builder_list = params.builder.split(',');
        } else {
          builder_list = Keys(builder_map);
        }
        if ('graph' in params) {
          graphs_list = param.graph.split(',');
        } else {
          graphs_list = Keys(graphs_map);
        }
        if ('test' in params) {
          test_list = params.test.split(',');
        } else {
          test_list = Keys(test_map);
        }
        function write_builder_table() {
          document.write('<table><tr>');
          for (var tindex=0; tindex < test_list.length; tindex++) {
            test = test_list[tindex];
            test_name = test_map[test];
            DisplayGraph(builder_id + '/' + test, 250, 400, false);
            DisplayGraph(builder_id + '/' + test, 250, 400, false);
            if ((tindex % 3) == 2) {
              document.write('</tr><tr>');
            }
          }
          document.write('</tr></table>');
        }
        function write_test_table() {
          document.write('<table>');
          row = [];
          function write_row(row) {
            document.write('<tr>');
            for (var bidx in row) {
              builder = row[bidx];
              document.write('<th align="center"><p><br>' +
                             builder + '</p></th>');
            }
            document.write('</tr><tr>');
            for (var bidx in row) {
              builder_id = builder_map[row[bidx]];
              DisplayGraph(builder_id + '/' + test, 250, 400, true);
            }
            document.write('</tr>');
          }
          for (var bindex=0; bindex < builder_list.length; bindex++) {
            builder = builder_list[bindex];
            row.push(builder)
            if ((bindex % 3) == 2) {
              write_row(row);
              row = [];
            }
          }
          if (row.length > 0) {
            write_row(row);
          }
          document.write('</table>');
        }
        function write_builders_header_row() {
          document.write('<tr><th>&nbsp;</th>');
          for (var bindex=0; bindex < builder_list.length; bindex++) {
            builder = builder_list[bindex];
            url = MakeURL({'builder':escape(builder)});
            var s ='<th align="center" colspan="' +
                   graphs_list.length +
                   '">' +
                   '<a href="' + url + '">' +
                   builder +
                   '</a></th>';
            document.write(s);
          }
          document.write('</tr>');
        }
        function write_graphs_header_row() {
          document.write('<tr><th>&nbsp;</th>');
          for (var bindex=0; bindex < builder_list.length; bindex++) {
            for (var gindex=0; gindex < graphs_list.length; gindex++) {
              graph = graphs_list[gindex];
              document.write('<th align="center">' + graph + '</th>');
            }
          }
        }
        function write_overview_table() {
          document.write('<table>');
          var width = document.body.scrollWidth / (builder_list.length + 2);
          write_builders_header_row();
          for (var tindex=0; tindex < test_list.length; tindex++) {
            // Write a graphs header every four rows for navigability.
            // TODO:  Use more sophisticated freezing of the header rows?
            if ((tindex % 4) == 0) {
              write_graphs_header_row();
            }
            test = test_list[tindex];
            test_name = test_map[test];
            document.write('<tr>');
            url = MakeURL({'test':escape(test)});
            document.write('<th valign="center"><a href="' + url + '">'
                           + test_name + '</a></th>');
            for (var bindex=0; bindex < builder_list.length; bindex++) {
              builder = builder_list[bindex];
              builder_id = builder_map[builder];
              DisplayGraph(builder_id + '/' + test, 250, width, true, "TimeSCons-elapsed")
              DisplayGraph(builder_id + '/' + test, 250, width, true, "memory-final")
            }
            document.write('<th valign="center"><a href="' + url + '">'
                           + test_name + '</a></th>');
            document.write('</tr>');
          }
          write_graphs_header_row();
          write_builders_header_row();
          document.write('</table>');
        }
        function write_header(header_string, url_string) {
          document.write('<h1><a href="' + window.location.pathname + '">'
                         + 'SCons Timings</a>');
          if (header_string) {
            document.write(':  ' + header_string);
          }
          if ('graph' in params) {
            document.write(':  ' + escape(params.graph))
          } else {
            document.write(':  overview');
          }
          document.write('</h1>');
        }
        if (builder_list.length == 0) {
          builder = builder_list[0];
          builder_id = builder_map[builder];
          write_header(builder, '&builder=' + escape(builder));
          write_builder_table()
        } else if (test_list.length == 1) {
          test = test_list[0];
          test_name = test_map[test];
          write_header(test_name, '&test=' + escape(test));
          write_test_table()
        } else {
          write_header('', '');
          write_overview_table();
        }
      </script>
    </center>
  </body>
</html>