Table of Contents

Class Measurable

Namespace
LfrlAnvil.Diagnostics
Assembly
LfrlAnvil.Core.dll

Represents an operation whose elapsed time can be measured.

public abstract class Measurable
Inheritance
Measurable
Inherited Members
Extension Methods

Constructors

Measurable()

Creates a new Measurable instance in Ready state.

protected Measurable()

Properties

Measurement

Current time measurement.

public TimeMeasurement Measurement { get; }

Property Value

TimeMeasurement

State

Current state.

public MeasurableState State { get; }

Property Value

MeasurableState

Methods

Done()

This method is invoked last, after the Teardown() method. Measurable instance will be in the Done state. Does nothing by default.

protected virtual void Done()

Invoke()

Invokes this measurable instance.

public void Invoke()

Exceptions

InvalidOperationException

When State is not equal to Ready.

Prepare()

This method is invoked first, before the Run() method. Measurable instance will be in the Preparing state. Time elapsed during an invocation of this method will be stored in the Preparation property. Does nothing by default.

protected virtual void Prepare()

Run()

This method is invoked after the Prepare() method. Measurable instance will be in the Running state. Time elapsed during an invocation of this method will be stored in the Invocation property.

protected abstract void Run()

Teardown()

This method is invoked after the Run() method. Measurable instance will be in the TearingDown state. Time elapsed during an invocation of this method will be stored in the Teardown property. Does nothing by default.

protected virtual void Teardown()