Class SoTimer
Disposable class used for timing operations being carried out by NetServer
Implements
Namespace: SuperOffice.Diagnostics
Assembly: SoCore.dll
Syntax
public sealed class SoTimer : Object, IDisposable
Constructors
SoTimer(SoTimerType, String, DeferredToString)
Create a new instance of SoTimer and start timing. Dispose will stop timing.
Declaration
public SoTimer(SoTimerType type, string category, DeferredToString description)
Parameters
Type | Name | Description |
---|---|---|
SoTimerType | type | Type of item to time |
String | category | Category |
DeferredToString | description | Description. This can be coslty to calculate (like a select statement), hence it is only calculated when needed. |
SoTimer(SoTimerType, String, Func<String>)
Create a new instance of SoTimer and start timing. Dispose will stop timing.
Declaration
public SoTimer(SoTimerType type, string category, Func<string> description)
Parameters
Type | Name | Description |
---|---|---|
SoTimerType | type | Type of item to time |
String | category | Category |
Func<String> | description | Description. This can be coslty to calculate (like a select statement), hence it is only calculated when needed. |
SoTimer(SoTimerType, String, String)
Create a new instance of SoTimer and start timing. Dispose will stop timing.
Declaration
public SoTimer(SoTimerType type, string category, string description)
Parameters
Type | Name | Description |
---|---|---|
SoTimerType | type | Type of item to time |
String | category | Category |
String | description | Description, use one of the other constructors if the description is costly to calculate. |
Properties
Count
Disposable class used for timing operations being carried out by NetServer
Declaration
public int Count { get; }
Property Value
Type | Description |
---|---|
Int32 |
Elapsed
Get the elapsed time without further ado.
Declaration
public TimeSpan Elapsed { get; }
Property Value
Type | Description |
---|---|
TimeSpan |
Methods
Dispose()
Stop the timing.
Declaration
public void Dispose()
End()
Disposable class used for timing operations being carried out by NetServer
Declaration
public TimeSpan End()
Returns
Type | Description |
---|---|
TimeSpan |
Increment()
Disposable class used for timing operations being carried out by NetServer
Declaration
public void Increment()
Lap(Func<String>)
Get lap time: time since last time Lap time is obtained, or start if no lap time is previously obtained
Declaration
public TimeSpan Lap(Func<string> description)
Parameters
Type | Name | Description |
---|---|---|
Func<String> | description | Description of what the lap time is for. |
Returns
Type | Description |
---|---|
TimeSpan | Duration since last lap (or start on the first lap) |
Lap(String)
Get lap time: time since last time Lap time is obtained, or start if no lap time is previously obtained
Declaration
public TimeSpan Lap(string description)
Parameters
Type | Name | Description |
---|---|---|
String | description | Description of what the lap time is for. |
Returns
Type | Description |
---|---|
TimeSpan | Duration since last lap (or start on the first lap) |
Split(Func<String>)
Get a split timer: time since start time.
Declaration
public TimeSpan Split(Func<string> description)
Parameters
Type | Name | Description |
---|---|---|
Func<String> | description | Description of what the split time is for. |
Returns
Type | Description |
---|---|
TimeSpan | Duration since start time |
Split(String)
Get a split timer: time since start time.
Declaration
public TimeSpan Split(string description)
Parameters
Type | Name | Description |
---|---|---|
String | description | Description of what the split time is for. |
Returns
Type | Description |
---|---|
TimeSpan | Duration since start time |
Start(SoTimerType, String, DeferredToString)
Start a timing operation.
Declaration
public static SoTimer Start(SoTimerType type, string category, DeferredToString description)
Parameters
Type | Name | Description |
---|---|---|
SoTimerType | type | Type of item to time |
String | category | Category like: Database, Services, WebRequest, etc. |
DeferredToString | description | Brief information about what is being timed. |
Returns
Type | Description |
---|---|
SoTimer | Timer object |
Start(SoTimerType, String, Func<String>)
Start a timing operation.
Declaration
public static SoTimer Start(SoTimerType type, string category, Func<string> description)
Parameters
Type | Name | Description |
---|---|---|
SoTimerType | type | Type of item to time |
String | category | Category like: Database, Services, WebRequest, etc. |
Func<String> | description | Brief information about what is being timed. |
Returns
Type | Description |
---|---|
SoTimer | Timer object |
Start(SoTimerType, String, String)
Start a timing operation.
Declaration
public static SoTimer Start(SoTimerType type, string category, string description)
Parameters
Type | Name | Description |
---|---|---|
SoTimerType | type | Type of item to time |
String | category | Category like: Database, Services, WebRequest, etc. |
String | description | Brief information about what is being timed. |
Returns
Type | Description |
---|---|
SoTimer | Timer object |