From 6f45c2fc0502fa5752680465fb741c66a598e2fc Mon Sep 17 00:00:00 2001 From: Phil Quitslund Date: Fri, 28 Jul 2017 12:53:46 -0700 Subject: [PATCH] Fix benchmarking. (#760) --- bin/linter.dart | 2 +- lib/src/formatter.dart | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/bin/linter.dart b/bin/linter.dart index da111447c..b4ff6ce06 100644 --- a/bin/linter.dart +++ b/bin/linter.dart @@ -160,7 +160,7 @@ Future runLinter(List args, LinterOptions initialLintOptions) async { } if (benchmark) { - writeBenchmarks(outSink, filesToLint, lintOptions); + await writeBenchmarks(outSink, filesToLint, lintOptions); return; } diff --git a/lib/src/formatter.dart b/lib/src/formatter.dart index eaeeb64a4..8a2b7ffcc 100644 --- a/lib/src/formatter.dart +++ b/lib/src/formatter.dart @@ -2,6 +2,7 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. +import 'dart:async'; import 'dart:io'; import 'dart:math'; @@ -266,10 +267,11 @@ class SimpleFormatter implements ReportFormatter { } } -writeBenchmarks(IOSink out, List filesToLint, LinterOptions lintOptions) { +Future writeBenchmarks( + IOSink out, List filesToLint, LinterOptions lintOptions) async { Map timings = {}; for (int i = 0; i < benchmarkRuns; ++i) { - new DartLinter(lintOptions).lintFiles(filesToLint); + await new DartLinter(lintOptions).lintFiles(filesToLint); lintRegistry.timers.forEach((n, t) { int timing = t.elapsedMilliseconds; int previous = timings[n];