/// <summary> /// 启动一个新的计时器 /// </summary> /// <returns></returns> public static HiPerfTimer StartNew() { HiPerfTimer timer = new HiPerfTimer(); timer.Start(); return(timer); }
/// <summary> /// 执行一个方法并测试执行时间 /// </summary> /// <param name="action"></param> /// <returns></returns> public static double Execute(Action action) { var timer = new HiPerfTimer(); timer.Start(); action(); timer.Stop(); return(timer.Duration); }