}
// runs to collect Dev Tools performance metrics
if (numPerfTimelineRuns > 0) {
perfRunMode = PerfRunMode.TIMELINE;
PerfRunsCollector runsCollector = new PerfRunsCollector();
for (int i = 0; i < numPerfTimelineRuns; i++) {
try {
perBrowserSetUp();
PerfMetricsCollector metricsCollector = new PerfMetricsCollector(this, perfRunMode);
metricsCollector.startCollecting();
superRunTest();
PerfMetrics metrics = metricsCollector.stopCollecting();
runsCollector.addRun(metrics);
if (logger.isLoggable(Level.INFO)) {
runFiles.add(PerfResultsUtil.writeDevToolsLog(metrics.getDevToolsLog(), getGoldFileName() + '_'
+ (i + 1),
auraUITestingUtil.getUserAgent()));
runFiles.add(PerfResultsUtil
.writeGoldFile(metrics, getGoldFileName() + '_' + runNumber++, true));
}
} finally {
perBrowserTearDown();
}
}
// use the median run for timeline metrics so individual metrics and dev tools logs match
timelineMetrics = runsCollector.getMedianRun();
}
// runs to collect JavaScript profiling metrics, run separately because affect overall metrics
if (numPerfProfileRuns > 0) {
perfRunMode = PerfRunMode.PROFILE;
PerfRunsCollector runsCollector = new PerfRunsCollector();
for (int i = 0; i < numPerfProfileRuns; i++) {
try {
perBrowserSetUp();
PerfMetricsCollector metricsCollector = new PerfMetricsCollector(this, perfRunMode);
metricsCollector.startCollecting();
superRunTest();
PerfMetrics metrics = metricsCollector.stopCollecting();
runsCollector.addRun(metrics);
if (logger.isLoggable(Level.INFO)) {
Map<String, ?> jsProfilerData = metrics.getJSProfilerData();
if (jsProfilerData != null) {
runFiles.add(PerfResultsUtil.writeJSProfilerData(jsProfilerData, getGoldFileName() + '_'
+ (i + 1)));
}
Map<String, ?> heapSnapshot = metrics.getHeapSnapshot();
if (heapSnapshot != null) {
runFiles.add(PerfResultsUtil.writeHeapSnapshot(heapSnapshot, getGoldFileName() + '_'
+ (i + 1)));
}
runFiles.add(PerfResultsUtil
.writeGoldFile(metrics, getGoldFileName() + '_' + runNumber++, true));
}
} finally {
perBrowserTearDown();
}
}
// use the median run for profile metrics so individual metrics and .cpuprofile match
profileMetrics = runsCollector.getMedianRun();
}
// runs to collect Aura stats metrics
if (numPerfAuraRuns > 0) {
perfRunMode = PerfRunMode.AURASTATS;
// collecting them in separate runs as they need STATS mode
PerfRunsCollector runsCollector = new PerfRunsCollector();
for (int i = 0; i < numPerfAuraRuns; i++) {
try {
// TODO: set stats mode for framework tests
perBrowserSetUp();
PerfMetricsCollector metricsCollector = new PerfMetricsCollector(this, perfRunMode);
metricsCollector.startCollecting();
superRunTest();
PerfMetrics metrics = metricsCollector.stopCollecting();
runsCollector.addRun(metrics);
} finally {
perBrowserTearDown();
}
}
auraMetrics = runsCollector.getMedianMetrics();
}
perfRunMode = null;
// combine all metrics, log/write results, perform tests