我想在我的项目中进行性能监控,我不想在每个函数中添加跟踪代码。
我想做喜欢(自动跟踪):
public class ManagerBase
{
public void Trace()
{
//trace begin
DoSth();
//trace end
//i want get stacktrace in Manager.DoSth and every method's execution time
}
protected virtual void DoSth(){}
}
public class Manager : ManagerBase
{
protected override void DoSth()
{
Function1();
Function2();
Function3();
}
private void Function1() { }
private void Function2() { }
private void Function3() { }
}
所以,我该怎么办,谢谢!