Class TimeMeters

hold stopowatch for each registered key in memory, The class is not thread safe. It is used only internally to see result from time meters you can navigate to ~/siteurl/shell/Debug/ShowTimeMeters with administrator permission has access to the result

Inheritance
System.Object
TimeMeters
Namespace: EPiServer.Framework.Initialization
Assembly: EPiServer.Framework.dll
Version: 12.0.3
Syntax
public class TimeMeters : Object

Constructors

TimeMeters(Type)

Initializes a new instance of the TimeMeters class.

Declaration
public TimeMeters(Type owner)
Parameters
Type Name Description
System.Type owner

The t.

Properties

Counters

Gets the counters.

Declaration
public IDictionary<string, Stopwatch> Counters { get; }
Property Value
Type Description
System.Collections.Generic.IDictionary<System.String, System.Diagnostics.Stopwatch>

Enabled

Gets or sets a value indicating whether this TimeMeters is enabled and the TimeMeters can be registered as global in the system

Declaration
public static bool Enabled { get; set; }
Property Value
Type Description
System.Boolean

true if enabled; otherwise, false.

Owner

Gets the owner.

Declaration
public Type Owner { get; }
Property Value
Type Description
System.Type

Methods

Clear()

Clears all captured time measures

Declaration
public static void Clear()

GetAllRegistered()

Gets all registered TimeMeters.

Declaration
public static IEnumerable<TimeMeters> GetAllRegistered()
Returns
Type Description
System.Collections.Generic.IEnumerable<TimeMeters>

Log()

Logs elapsed time in friendly format for all registered keys.

Declaration
public virtual void Log()

Register(Type)

Registers a timeMeter for the specified type.

Declaration
public static TimeMeters Register(Type owner)
Parameters
Type Name Description
System.Type owner

The requested type.

Returns
Type Description
TimeMeters

Restart(String)

Stops time interval measurement, resets the elapsed time to zero, and starts measuring elapsed time for the specified key.

Declaration
public virtual void Restart(string key)
Parameters
Type Name Description
System.String key

The key.

Start(String)

Stops measuring elapsed time for an interval for the specified key.

Declaration
public virtual void Start(string key)
Parameters
Type Name Description
System.String key

The key.

Stop(String)

Stops measuring elapsed time for an interval for the specified key.

Declaration
public virtual void Stop(string key)
Parameters
Type Name Description
System.String key

The key.

ToString()

Returns elapsed time in friendly format for all registered keys.

Declaration
public override string ToString()
Returns
Type Description
System.String

Returns elapsed time in friendly format for all registered keys.

ToString(String)

Returns elapsed time in friendly format for the key.

Declaration
public virtual string ToString(string key)
Parameters
Type Name Description
System.String key

The key.

Returns
Type Description
System.String

Elapsed time in friendly format for the key.

Extension Methods