- 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.";
+ document.getElementById('rollPeriod').value);
+ var opts = {labels: labels, rollPeriod: rollPeriod, timingName: "x"};
+ opts['fillGraph'] = document.getElementById('fill').checked;
+ var millisecondss = [];
+ for (var i = 0; i < repetitions; i++) {
+ if (graph != null) {
+ graph.destroy(); // release memory from prior graph.
+ }
+ var start = new Date();
+ graph = new Dygraph(plotDiv, data, opts);
+ var end = new Date();
+ durations.push([numRuns++, end - start]);
+ millisecondss.push(end - start);
+ }
+ if (repetitions == 1) {
+ document.getElementById('message').innerHTML =
+ "completed in " + (end - start) + " milliseconds.";
+ } else {
+ var avg = 0;
+ for (var i = 0; i < millisecondss.length; i++) {
+ avg+=millisecondss[i];
+ }
+ avg/=millisecondss.length;
+ document.getElementById('message').innerHTML =
+ "Durations: " + millisecondss + "<br>Average: " + avg;
+ }
+
+ if (durations.length > 0) {
+ var start2 = new Date();
+ if (!metrics) {
+ metrics = new Dygraph(
+ document.getElementById('metrics'),
+ durations,
+ {
+ highlightCircleSize: 4,
+ labels: [ "Date", "ms" ]
+ });
+ } else {
+ metrics.updateOptions({file: durations});
+ }
+ var end2 = new Date();
+ document.getElementById("metaperformance").innerHTML =
+ "completed in " + (end2 - start2) + " milliseconds.";
+ }
+
+ return millisecondss;