in MotionMark/resources/runner/motionmark.js [100:128]
function findRegression(series, profile) {
var minIndex = Math.round(.025 * series.length);
var maxIndex = Math.round(.975 * (series.length - 1));
var minComplexity = series.getFieldInDatum(minIndex, Strings.json.complexity);
var maxComplexity = series.getFieldInDatum(maxIndex, Strings.json.complexity);
if (Math.abs(maxComplexity - minComplexity) < 20 && maxIndex - minIndex < 20) {
minIndex = 0;
maxIndex = series.length - 1;
minComplexity = series.getFieldInDatum(minIndex, Strings.json.complexity);
maxComplexity = series.getFieldInDatum(maxIndex, Strings.json.complexity);
}
var complexityIndex = series.fieldMap[Strings.json.complexity];
var frameLengthIndex = series.fieldMap[Strings.json.frameLength];
var regressionOptions = { desiredFrameLength: 1000/this._targetFrameRate };
if (profile)
regressionOptions.preferredProfile = profile;
return {
minComplexity: minComplexity,
maxComplexity: maxComplexity,
samples: series.slice(minIndex, maxIndex + 1),
regression: new Regression(
series.data,
function (data, i) { return data[i][complexityIndex]; },
function (data, i) { return data[i][frameLengthIndex]; },
minIndex, maxIndex, regressionOptions)
};
}