Class DisposableTimer
Starts the timer and invokes a callback upon disposal. Provides a simple way of timing an operation by wrapping it in a
using
(C#) statement.
Inheritance
System.Object
Namespace:System.Dynamic.ExpandoObject
Assembly:Umbraco.Core.dll
Syntax
public class DisposableTimer : DisposableObjectSlim, IDisposable
Constructors
DisposableTimer(Action<Int64>)
Declaration
protected DisposableTimer(Action<long> callback)
Parameters
Type |
Name |
Description |
System.Action<System.Int64> |
callback |
|
Properties
Stopwatch
Declaration
public Stopwatch Stopwatch { get; }
Property Value
Type |
Description |
System.Diagnostics.Stopwatch |
|
Methods
DebugDuration(Type, Func<String>, Func<String>)
Declaration
[Obsolete("Use the other methods that specify strings instead of Func")]
public static DisposableTimer DebugDuration(Type loggerType, Func<string> startMessage, Func<string> completeMessage)
Parameters
Type |
Name |
Description |
System.Type |
loggerType |
|
System.Func<System.String> |
startMessage |
|
System.Func<System.String> |
completeMessage |
|
Returns
DebugDuration(Type, String, String)
Adds a start and end log entry as Debug and tracks how long it takes until disposed.
Declaration
[Obsolete("Use the Umbraco.Core.Logging.ProfilingLogger to create instances of DisposableTimer")]
public static DisposableTimer DebugDuration(Type loggerType, string startMessage, string completeMessage)
Parameters
Type |
Name |
Description |
System.Type |
loggerType |
|
System.String |
startMessage |
|
System.String |
completeMessage |
|
Returns
DebugDuration<T>(Func<String>, Func<String>)
Declaration
[Obsolete("Use the other methods that specify strings instead of Func")]
public static DisposableTimer DebugDuration<T>(Func<string> startMessage, Func<string> completeMessage)
Parameters
Type |
Name |
Description |
System.Func<System.String> |
startMessage |
|
System.Func<System.String> |
completeMessage |
|
Returns
Type Parameters
DebugDuration<T>(String)
Adds a start and end log entry as Debug and tracks how long it takes until disposed.
Declaration
[Obsolete("Use the Umbraco.Core.Logging.ProfilingLogger to create instances of DisposableTimer")]
public static DisposableTimer DebugDuration<T>(string startMessage)
Parameters
Type |
Name |
Description |
System.String |
startMessage |
|
Returns
Type Parameters
DebugDuration<T>(String, String)
Adds a start and end log entry as Debug and tracks how long it takes until disposed.
Declaration
[Obsolete("Use the Umbraco.Core.Logging.ProfilingLogger to create instances of DisposableTimer")]
public static DisposableTimer DebugDuration<T>(string startMessage, string completeMessage)
Parameters
Type |
Name |
Description |
System.String |
startMessage |
|
System.String |
completeMessage |
|
Returns
Type Parameters
DisposeResources()
Handles the disposal of resources. Derived from abstract class DisposableObjectSlim which handles common required locking logic.
Declaration
protected override void DisposeResources()
Start(Action<Int64>)
Starts the timer and invokes the specified callback upon disposal.
Declaration
[Obsolete("Use either TraceDuration or DebugDuration instead of using Start")]
public static DisposableTimer Start(Action<long> callback)
Parameters
Type |
Name |
Description |
System.Action<System.Int64> |
callback |
The callback.
|
Returns
TraceDuration(Type, Func<String>, Func<String>)
Declaration
[Obsolete("Use the other methods that specify strings instead of Func")]
public static DisposableTimer TraceDuration(Type loggerType, Func<string> startMessage, Func<string> completeMessage)
Parameters
Type |
Name |
Description |
System.Type |
loggerType |
|
System.Func<System.String> |
startMessage |
|
System.Func<System.String> |
completeMessage |
|
Returns
TraceDuration(Type, String, String)
Adds a start and end log entry as Info and tracks how long it takes until disposed.
Declaration
[Obsolete("Use the Umbraco.Core.Logging.ProfilingLogger to create instances of DisposableTimer")]
public static DisposableTimer TraceDuration(Type loggerType, string startMessage, string completeMessage)
Parameters
Type |
Name |
Description |
System.Type |
loggerType |
|
System.String |
startMessage |
|
System.String |
completeMessage |
|
Returns
TraceDuration<T>(Func<String>, Func<String>)
Declaration
[Obsolete("Use the other methods that specify strings instead of Func")]
public static DisposableTimer TraceDuration<T>(Func<string> startMessage, Func<string> completeMessage)
Parameters
Type |
Name |
Description |
System.Func<System.String> |
startMessage |
|
System.Func<System.String> |
completeMessage |
|
Returns
Type Parameters
TraceDuration<T>(String)
Adds a start and end log entry as Info and tracks how long it takes until disposed.
Declaration
[Obsolete("Use the Umbraco.Core.Logging.ProfilingLogger to create instances of DisposableTimer")]
public static DisposableTimer TraceDuration<T>(string startMessage)
Parameters
Type |
Name |
Description |
System.String |
startMessage |
|
Returns
Type Parameters
TraceDuration<T>(String, String)
Adds a start and end log entry as Info and tracks how long it takes until disposed.
Declaration
[Obsolete("Use the Umbraco.Core.Logging.ProfilingLogger to create instances of DisposableTimer")]
public static DisposableTimer TraceDuration<T>(string startMessage, string completeMessage)
Parameters
Type |
Name |
Description |
System.String |
startMessage |
|
System.String |
completeMessage |
|
Returns
Type Parameters