Chronometer class

A Chronometer useful for benchmarks.

Implemented types
Implementers

Constructors

Chronometer([String name = 'Chronometer'])

Properties

elapsedTime Duration
Elapsed time (stopTime - startTime).
no setter
elapsedTimeMs int
Elapsed time in milliseconds (stopTime - startTime).
no setter
elapsedTimeSec double
Elapsed time in seconds (stopTime - startTime).
no setter
failedOperations int
Failed operations performed while this chronometer was running.
getter/setter pair
failedOperationsAsString String
no setter
hashCode int
The hash code for this object.
no setterinherited
hertz double
Returns the operations hertz: The average operations per second of the period (elapsedTimeSec) of this chronometer.
no setter
hertzAsString String
no setter
isFinished bool
no setter
isStarted bool
no setter
name String
The name/title of this chronometer.
getter/setter pair
operations int
Operations performed while this chronometer was running. Used to compute hertz.
getter/setter pair
operationsAsString String
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
startTime DateTime?
The start DateTime of this chronometer.
no setter
stopTime DateTime?
The stop DateTime of this chronometer.
no setter
totalOperation int?
The total number of operations to complete this chronometer.
getter/setter pair

Methods

clearMarks() → void
Clears all previous set time marks.
compareTo(Chronometer other) int
Compares this object to another object.
override
computeHertz(int operations) double
Computes hertz for n operations.
executeOnMarkPeriod(String markKey, Duration period, void operation()) bool
Executes operations when markKey elapsed time passes period at the moment that this method is called.
getMarkElapsedTime(String markKey) Duration
Returns the elapsed time of the time mark markKey. If the mark is not set returns a zero Duration.
getMarkTime(String markKey) DateTime?
Gets a previous set time mark.
markTime(String markKey, {bool overwrite = true}) DateTime
Sets a time mark in this chronometer with the current DateTime.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
removeMarkTime(String markKey) DateTime?
Removes a previous set time mark.
reset() → void
Resets this chronometer for a future start and stop.
start() Chronometer
Starts the chronometer.
stop({int? operations, int? failedOperations}) Chronometer
Stops the chronometer.
timeToComplete({int? totalOperation}) Duration
Returns the time to complete totalOperation with the current hertz.
toString({bool withStartTime = true}) String
Returns a String with information of this chronometer:
override

Operators

operator +(Chronometer other) Chronometer
operator ==(Object other) bool
The equality operator.
inherited