measuring method execution time using Unity interception
Do you know a pattern for method execution time measurement using EntLib's Unity and 开发者_如何学运维its interception mechanism?
You can create an ICallHandler
(or very similar IInterceptionBehavior
in Unity 2.0) implementation like below and add it to your object's execution timeline
public class MeasurementHandler : ICallHandler
{
public IMethodReturn Invoke(IMethodInvocation input,
GetNextHandlerDelegate getNext)
{
StartTimer(); // implement it :)
IMethodReturn msg = getNext()(input, getNext);
StopTimer(); // implement it :)
return msg;
}
}
精彩评论