using System;
using System.Diagnostics;
class FunctionCallTimeCounter
{
private TimeSpan m_oElapsedTime = new TimeSpan();
private Stopwatch m_oStopwatch = new Stopwatch();
public void LogIfTimeout(bool bFirst = false, bool bLast = false)
{
if (bFirst)
{
m_oStopwatch.Reset();
m_oStopwatch.Start();
return;
}
m_oStopwatch.Stop();
m_oElapsedTime = m_oStopwatch.Elapsed;
if (m_oElapsedTime.TotalMilliseconds > 100)
{
StackFrame sf = new StackFrame(1, true);
//Console.WriteLine(" Stack trace for current level: {0}", st.ToString());
//Console.WriteLine(" File: {0}", sf.GetFileName());
//Console.WriteLine(" Method: {0}", sf.GetMethod().Name);
//Console.WriteLine(" Line Number: {0}", sf.GetFileLineNumber());
//Console.WriteLine(" Column Number: {0}", sf.GetFileColumnNumber());
string str = String.Format("LogIfTimeout file[{0}] method[{1