<p>Roll period (in points):
<input type="text" id="roll_period_input" size="20"
onchange="updatePlot();"></p>
+ <p>Repetitions:
+ <input type="text" id="repetitions" size="20"
+ onchange="updatePlot();"></p>
<br>
<br>
<div id="plot"></div>
<div id="message"></div>
+ <div id="metrics"></div>
<script type="text/javascript">
var plot;
parseInt(document.getElementById('num_points_input').value);
var numSeries =
parseInt(document.getElementById('num_series_input').value);
+ var repetitions =
+ parseInt(document.getElementById('repetitions').value);
var data = [];
var xmin = 0.0;
var rollPeriod = parseInt(
document.getElementById('roll_period_input').value);
var opts = {labels: labels, rollPeriod: rollPeriod};
- var start = new Date();
- plot = new Dygraph(plotDiv, data, opts);
- var end = new Date();
- document.getElementById('message').innerHTML =
- "completed in " + (end - start) + " milliseconds.";
+ var durations = [];
+ for (var i = 0; i < repetitions; i++) {
+ var start = new Date();
+ plot = new Dygraph(plotDiv, data, opts);
+ var end = new Date();
+ durations.push(end - start);
+ }
+ if (repetitions == 1) {
+ document.getElementById('message').innerHTML =
+ "completed in " + (end - start) + " milliseconds.";
+ } else {
+ document.getElementById('message').innerHTML =
+ "Durations: " + durations;
+ }
+ updateMetrics(durations);
};
+ updateMetrics = function(data) {
+ var d = "run,ms\n";
+ for (var i = 0; i < data.length; i++) {
+ d = d + i + "," + data[i] + "\n";
+ }
+ var g = new Dygraph(document.getElementById('metrics'), d,
+ {highlightCircleSize: 4});
+ }
+
document.getElementById('num_points_input').value = '100';
document.getElementById('num_series_input').value = '1';
document.getElementById('roll_period_input').value = '1';
+ document.getElementById('repetitions').value = '1';
updatePlot();
</script>
</body>