4bc64b8c2b
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@7 260f80e4-7a28-3924-810f-c04153c831b5
31 lines
663 B
Dart
31 lines
663 B
Dart
// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
|
|
// 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.
|
|
|
|
// A utility object for measuring time intervals.
|
|
|
|
class Interval {
|
|
int _start, _stop;
|
|
|
|
Interval() {
|
|
}
|
|
|
|
void start() {
|
|
_start = BenchUtil.now;
|
|
}
|
|
|
|
void stop() {
|
|
_stop = BenchUtil.now;
|
|
}
|
|
|
|
// Microseconds from between start() and stop().
|
|
int get elapsedMicrosec() {
|
|
return (_stop - _start) * 1000;
|
|
}
|
|
|
|
// Milliseconds from between start() and stop().
|
|
int get elapsedMillisec() {
|
|
return (_stop - _start);
|
|
}
|
|
}
|