3 class MeasurementAdaptor {
7 formatMap.forEach(function (key, index) {
10 this._idIndex = nameMap['id'];
11 this._commitTimeIndex = nameMap['commitTime'];
12 this._countIndex = nameMap['iterationCount'];
13 this._meanIndex = nameMap['mean'];
14 this._sumIndex = nameMap['sum'];
15 this._squareSumIndex = nameMap['squareSum'];
16 this._markedOutlierIndex = nameMap['markedOutlier'];
17 this._revisionsIndex = nameMap['revisions'];
18 this._buildIndex = nameMap['build'];
19 this._buildTimeIndex = nameMap['buildTime'];
20 this._buildNumberIndex = nameMap['buildNumber'];
21 this._builderIndex = nameMap['builder'];
22 this._metricIndex = nameMap['metric'];
23 this._configTypeIndex = nameMap['configType'];
28 return row[this._idIndex];
33 return row[this._markedOutlierIndex];
36 applyToAnalysisResults(row)
38 var adaptedRow = this.applyTo(row);
39 adaptedRow.metricId = row[this._metricIndex];
40 adaptedRow.configType = row[this._configTypeIndex];
46 var id = row[this._idIndex];
47 var mean = row[this._meanIndex];
48 var sum = row[this._sumIndex];
49 var squareSum = row[this._squareSumIndex];
50 var revisionList = row[this._revisionsIndex];
51 var buildId = row[this._buildIndex];
52 var builderId = row[this._builderIndex];
53 var buildNumber = row[this._buildNumberIndex];
54 var buildTime = row[this._buildTimeIndex];
58 markedOutlier: row[this._markedOutlierIndex],
62 rootSet: function () { return MeasurementRootSet.ensureSingleton(id, revisionList); },
63 build: function () { return new Build(buildId, Builder.findById(builderId), buildNumber, buildTime); },
64 time: row[this._commitTimeIndex],
68 iterationCount: row[this._countIndex],
69 interval: MeasurementAdaptor.computeConfidenceInterval(row[this._countIndex], mean, sum, squareSum)
73 static aggregateAnalysisResults(results)
76 var totalSquareSum = 0;
77 var totalIterationCount = 0;
79 for (var result of results) {
80 means.push(result.value);
81 totalSum += result.sum;
82 totalSquareSum += result.squareSum;
83 totalIterationCount += result.iterationCount;
85 var mean = totalSum / totalIterationCount;
88 interval = this.computeConfidenceInterval(totalIterationCount, mean, totalSum, totalSquareSum)
90 interval = this.computeConfidenceInterval(results.length, mean, Statistics.sum(means), Statistics.squareSum(means));
92 return { value: mean, interval: interval };
95 static computeConfidenceInterval(iterationCount, mean, sum, squareSum)
97 var delta = Statistics.confidenceIntervalDelta(0.95, iterationCount, sum, squareSum);
98 return isNaN(delta) ? null : [mean - delta, mean + delta];
102 if (typeof module != 'undefined')
103 module.exports.MeasurementAdaptor = MeasurementAdaptor;