C# Класс Aspectacular.StopwatchAspect

An aspect recording start time and elapsed execution time. Place this aspect in the aspect collection AFTER log output classes, like TraceOutputAspect, to ensure final data point is shown in the log.
Наследование: Aspect
Показать файл Открыть проект

Открытые свойства

Свойство Тип Описание
Detailed bool

Защищенные свойства (Protected)

Свойство Тип Описание
stopwatch Stopwatch

Открытые методы

Метод Описание
Step_1_BeforeResolvingInstance ( ) : void

Called for non-static methods only. Please note that method metadata is not available at this point.

Step_2_BeforeTryingMethodExec ( ) : void

Called right before intercepted method execution.

Step_3_BeforeMassagingReturnedResult ( ) : void

Called after intercepted method returned result and before interceptor augmented it, usually by LINQ modifiers like List(). May be called multiple times if retries are enabled.

LINQ's List(), Single(), etc. methods may be used to execute query returned by the intercepted method. This interceptor is called after query was returned and before it was executed. During this period, Context.ReturnedValue has exact value returned by the intercepted method. After this interceptor is called, Context.ReturnedValue may be changed, primarily by LINQ modifiers, like List().

Step_4_Optional_AfterCatchingMethodExecException ( ) : void

Called after method execution failed (thrown an exception).

Step_4_Optional_AfterSuccessfulCallCompletion ( ) : void

Called after method itself and optional result massager were called successfully. May be called multiple times when retries are enabled.

Since this method may be called multiple times on retries, put all finalization/cleanup logic into steps 5-7.

Step_5_FinallyAfterMethodExecution ( bool interceptedCallSucceeded ) : void

Called after method execution success or failure.

Step_6_Optional_AfterInstanceCleanup ( ) : void

Called only for instance method that have instance cleanup

Step_7_AfterEverythingSaidAndDone ( ) : void

The very final cutpoint in the life cycle of the call.

StopwatchAspect ( ) : System

Initializes stopwatch that will record on start and end time and elapsed time. No interim measurements will be recorded.

StopwatchAspect ( bool detailed ) : System

Защищенные методы

Метод Описание
RecordStepTime ( string stepName, bool forceDetail = false ) : void

Records elapsed time for a given step.

Приватные методы

Метод Описание
RecordStartTime ( ) : void

Описание методов

RecordStepTime() защищенный Метод

Records elapsed time for a given step.
protected RecordStepTime ( string stepName, bool forceDetail = false ) : void
stepName string
forceDetail bool Pass true to record data for the step even if this.Detail=false.
Результат void

Step_1_BeforeResolvingInstance() публичный Метод

Called for non-static methods only. Please note that method metadata is not available at this point.
public Step_1_BeforeResolvingInstance ( ) : void
Результат void

Step_2_BeforeTryingMethodExec() публичный Метод

Called right before intercepted method execution.
public Step_2_BeforeTryingMethodExec ( ) : void
Результат void

Step_3_BeforeMassagingReturnedResult() публичный Метод

Called after intercepted method returned result and before interceptor augmented it, usually by LINQ modifiers like List(). May be called multiple times if retries are enabled.
LINQ's List(), Single(), etc. methods may be used to execute query returned by the intercepted method. This interceptor is called after query was returned and before it was executed. During this period, Context.ReturnedValue has exact value returned by the intercepted method. After this interceptor is called, Context.ReturnedValue may be changed, primarily by LINQ modifiers, like List().
public Step_3_BeforeMassagingReturnedResult ( ) : void
Результат void

Step_4_Optional_AfterCatchingMethodExecException() публичный Метод

Called after method execution failed (thrown an exception).
public Step_4_Optional_AfterCatchingMethodExecException ( ) : void
Результат void

Step_4_Optional_AfterSuccessfulCallCompletion() публичный Метод

Called after method itself and optional result massager were called successfully. May be called multiple times when retries are enabled.
Since this method may be called multiple times on retries, put all finalization/cleanup logic into steps 5-7.
public Step_4_Optional_AfterSuccessfulCallCompletion ( ) : void
Результат void

Step_5_FinallyAfterMethodExecution() публичный Метод

Called after method execution success or failure.
public Step_5_FinallyAfterMethodExecution ( bool interceptedCallSucceeded ) : void
interceptedCallSucceeded bool
Результат void

Step_6_Optional_AfterInstanceCleanup() публичный Метод

Called only for instance method that have instance cleanup
public Step_6_Optional_AfterInstanceCleanup ( ) : void
Результат void

Step_7_AfterEverythingSaidAndDone() публичный Метод

The very final cutpoint in the life cycle of the call.
public Step_7_AfterEverythingSaidAndDone ( ) : void
Результат void

StopwatchAspect() публичный Метод

Initializes stopwatch that will record on start and end time and elapsed time. No interim measurements will be recorded.
public StopwatchAspect ( ) : System
Результат System

StopwatchAspect() публичный Метод

public StopwatchAspect ( bool detailed ) : System
detailed bool If true, outputs time and elapsed time after every cut-point. Otherwise data recorded at the beginning and at the end.
Результат System

Описание свойств

Detailed публичное свойство

When true, outputs time and elapsed time after every cut-point. Otherwise, output only start and end time and total elapsed time.
public bool Detailed
Результат bool

stopwatch защищенное свойство

protected Stopwatch stopwatch
Результат Stopwatch