记时,耗时,Stopwatch

public static string InvokeStopwatch(Action function)
        {
            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
            sw.Start();

            //开始执行业务代码
            Retry.Execute(function, new TimeSpan(0, 0, 2));

            sw.Stop();
            return (sw.ElapsedMilliseconds / 1000.0f).ToString();
        }

  

原文地址:https://www.cnblogs.com/XuPengLB/p/7866736.html