Class SoTimer
Disposable class used for timing operations being carried out by NetServer
Implements
Inherited Members
Namespace: SuperOffice.Diagnostics
Assembly: SoCore.dll
Syntax
public sealed class SoTimer : 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 |
---|---|
int |
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 |