November Happy Hour will be moved to Thursday December 5th.

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
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: EPiServer.Framework.Initialization
Assembly: EPiServer.Framework.dll
Version: 9.12.2
Syntax
public class TimeMeters

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()

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.

Overrides
System.Object.ToString()

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