C# Class Azavea.Open.Common.Chronometer

A class for timing how long things take. You can instantiate a Chronometer, or just use the static methods for timing named operations.
Afficher le fichier Open project: azavea/net-om-utils-common

Méthodes publiques

Méthode Description
BeginTiming ( StringBuilder keyBuilder ) : void

Starts timing the specified named operation. Each time the same named operation is completed the time will be added to our list, so that a number of calls to the same command will give you totals, average, and number of executions.

BeginTiming ( string key ) : void

Starts timing the specified named operation. Each time the same named operation is completed the time will be added to our list, so that a number of calls to the same command will give you totals, average, and number of executions.

Chronometer ( ) : System

Creates (and starts) the timer.

EndTiming ( StringBuilder keyBuilder ) : long

Stops timing the given item and updates the timing report.

EndTiming ( string key ) : long

Stops timing the given item and updates the timing report.

GetElapsedTime ( ) : string

For display purposes, reports the run time as a long string.

GetRunTime ( ) : System.TimeSpan

How long has the timer been running.

GetSplit ( ) : System.TimeSpan

How long has the timer been running since you last called GetSplit.

GetSplitMilliseconds ( ) : string

For display purposes, reports the split time in milliseconds.

GetSplitSeconds ( ) : string

For display purposes, reports the split time in seconds.

ReportTimes ( ) : void

Reports all the times for all the operations that both BeginTiming and EndTiming were called for. This is imperfect as any call that failed may or may not have a time reported. It should, however, give a rough idea what operations are taking how long.

ReportTimes ( bool extendedStats ) : void

Reports all the times for all the operations that both BeginTiming and EndTiming were called for. This is imperfect as any call that failed may or may not have a time reported. It should, however, give a rough idea what operations are taking how long.

ReportTimes ( bool extendedStats, ReportType reportType ) : void

Reports all the times for all the operations that both BeginTiming and EndTiming were called for. This is imperfect as any call that failed may or may not have a time reported. It should, however, give a rough idea what operations are taking how long.

ReportTimes ( bool extendedStats, ReportType outType, bool printDisclaimer ) : void

Reports all the times for all the operations that both BeginTiming and EndTiming were called for. This is imperfect as any call that failed may or may not have a time reported. It should, however, give a rough idea what operations are taking how long.

Reset ( ) : void

Restarts the timer (same as calling Start() again).

Start ( ) : void

Restarts the timer.

Private Methods

Méthode Description
ReallyBeginTiming ( string keyWithThread ) : void

Behind the scenes we tack onto the key the name of the thread, in case multiple threads are running the same named operation at the same time.

ReallyEndTiming ( string originalKey, string keyWithThread ) : long

Behind the scenes we tack onto the key the name of the thread, in case multiple threads are running the same named operation at the same time.

Method Details

BeginTiming() public static méthode

Starts timing the specified named operation. Each time the same named operation is completed the time will be added to our list, so that a number of calls to the same command will give you totals, average, and number of executions.
public static BeginTiming ( StringBuilder keyBuilder ) : void
keyBuilder StringBuilder A StringBuilder containing a string that uniquely /// identifies the operation.
Résultat void

BeginTiming() public static méthode

Starts timing the specified named operation. Each time the same named operation is completed the time will be added to our list, so that a number of calls to the same command will give you totals, average, and number of executions.
public static BeginTiming ( string key ) : void
key string A string that uniquely identifies the operation.
Résultat void

Chronometer() public méthode

Creates (and starts) the timer.
public Chronometer ( ) : System
Résultat System

EndTiming() public static méthode

Stops timing the given item and updates the timing report.
public static EndTiming ( StringBuilder keyBuilder ) : long
keyBuilder StringBuilder A StringBuilder containing a string that uniquely /// identifies the operation.
Résultat long

EndTiming() public static méthode

Stops timing the given item and updates the timing report.
public static EndTiming ( string key ) : long
key string A string that uniquely identifies the operation.
Résultat long

GetElapsedTime() public méthode

For display purposes, reports the run time as a long string.
public GetElapsedTime ( ) : string
Résultat string

GetRunTime() public méthode

How long has the timer been running.
public GetRunTime ( ) : System.TimeSpan
Résultat System.TimeSpan

GetSplit() public méthode

How long has the timer been running since you last called GetSplit.
public GetSplit ( ) : System.TimeSpan
Résultat System.TimeSpan

GetSplitMilliseconds() public méthode

For display purposes, reports the split time in milliseconds.
public GetSplitMilliseconds ( ) : string
Résultat string

GetSplitSeconds() public méthode

For display purposes, reports the split time in seconds.
public GetSplitSeconds ( ) : string
Résultat string

ReportTimes() public static méthode

Reports all the times for all the operations that both BeginTiming and EndTiming were called for. This is imperfect as any call that failed may or may not have a time reported. It should, however, give a rough idea what operations are taking how long.
public static ReportTimes ( ) : void
Résultat void

ReportTimes() public static méthode

Reports all the times for all the operations that both BeginTiming and EndTiming were called for. This is imperfect as any call that failed may or may not have a time reported. It should, however, give a rough idea what operations are taking how long.
public static ReportTimes ( bool extendedStats ) : void
extendedStats bool Show extended stats: Min, Max, StdDev, Variance.
Résultat void

ReportTimes() public static méthode

Reports all the times for all the operations that both BeginTiming and EndTiming were called for. This is imperfect as any call that failed may or may not have a time reported. It should, however, give a rough idea what operations are taking how long.
public static ReportTimes ( bool extendedStats, ReportType reportType ) : void
extendedStats bool Show extended stats: Min, Max, StdDev, Variance.
reportType ReportType Print a disclaimer notice along with the times.
Résultat void

ReportTimes() public static méthode

Reports all the times for all the operations that both BeginTiming and EndTiming were called for. This is imperfect as any call that failed may or may not have a time reported. It should, however, give a rough idea what operations are taking how long.
public static ReportTimes ( bool extendedStats, ReportType outType, bool printDisclaimer ) : void
extendedStats bool Show extended stats: Min, Max, StdDev, Variance.
outType ReportType The type of output to report.
printDisclaimer bool Print a disclaimer notice along with the times.
Résultat void

Reset() public méthode

Restarts the timer (same as calling Start() again).
public Reset ( ) : void
Résultat void

Start() public méthode

Restarts the timer.
public Start ( ) : void
Résultat void