Merge pull request #16 from dart-lang/devoncarew_use_micros
change from the elapsedMilliseconds to elapsedMicroseconds
diff --git a/lib/src/benchmark_base.dart b/lib/src/benchmark_base.dart
index f741da6..fc21496 100644
--- a/lib/src/benchmark_base.dart
+++ b/lib/src/benchmark_base.dart
@@ -36,18 +36,19 @@
// Measures the score for this benchmark by executing it repeately until
// time minimum has been reached.
- static double measureFor(Function f, int timeMinimum) {
+ static double measureFor(Function f, int minimumMillis) {
+ int minimumMicros = minimumMillis * 1000;
int time = 0;
int iter = 0;
Stopwatch watch = new Stopwatch();
watch.start();
int elapsed = 0;
- while (elapsed < timeMinimum) {
+ while (elapsed < minimumMicros) {
f();
- elapsed = watch.elapsedMilliseconds;
+ elapsed = watch.elapsedMicroseconds;
iter++;
}
- return 1000.0 * elapsed / iter;
+ return elapsed / iter;
}
// Measures the score for the benchmark and returns it.
diff --git a/lib/src/score_emitter.dart b/lib/src/score_emitter.dart
index 0e8af2d..47f26bd 100644
--- a/lib/src/score_emitter.dart
+++ b/lib/src/score_emitter.dart
@@ -10,4 +10,4 @@
void emit(String testName, double value) {
print("$testName(RunTime): $value us.");
}
-}
\ No newline at end of file
+}