Exemplo n.º 1
0
 /// <summary>
 /// 性能计数开始
 /// <remarks>性能计数本身会消耗性能,在想统计性能的方法段的开始调用该方法,在末尾调用PerformanceStop()方法可输出日志,两者必须匹配</remarks>
 /// </summary>
 public static void PerformanceStart(object key)
 {
     if (key != null && !string.IsNullOrEmpty(key.ToString()))
     {
         PerformanceHelper.StartPerformance(key.ToString());
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// 性能计数开始
        /// <remarks>性能计数本身会消耗性能,在想统计性能的方法段的开始调用该方法,在末尾调用PerformanceStop()方法可输出日志,两者必须匹配</remarks>
        /// </summary>
        public static void PerformanceStart()
        {
            var stopWatch = new Stopwatch();

            stopWatch.Start();

            var stackFrame = new StackFrame(1, true);
            var fileName   = stackFrame.GetFileName();
            var methodName = stackFrame.GetMethod().Name;

            stopWatch.Stop();

            PerformanceHelper.StartPerformance(fileName, methodName, stopWatch.ElapsedTicks);
        }
Exemplo n.º 3
0
 /// <summary>
 /// 性能计数开始
 /// <remarks>性能计数本身会消耗性能,在想统计性能的方法段的开始调用该方法,在末尾调用PerformanceStop()方法可输出日志,两者必须匹配</remarks>
 /// </summary>
 public static void PerformanceStart([CallerFilePath] string filePath = "", [CallerMemberName] string methodName = "")
 {
     PerformanceHelper.StartPerformance(filePath, methodName);
 }