Beispiel #1
0
        // 开始计时器
        public static HiPerfTimer StartNew()
        {
            HiPerfTimer timer = new HiPerfTimer();

            timer.Start();
            return(timer);
        }
Beispiel #2
0
        /// <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);
        }