コード例 #1
0
 internal static TimeSpan GetTimerTimeSpan(string name)
 {
     if (TimerDictionary.ContainsKey(name))
     {
         DiagTimer t = TimerDictionary[name];
         return(t.Duration);
     }
     else
     {
         return(new TimeSpan(0));
     }
 }
コード例 #2
0
 public static string GetTimer(string name)
 {
     if (TimerDictionary.ContainsKey(name))
     {
         DiagTimer t   = TimerDictionary[name];
         string    msg = "Timer: " + name + " " + t.GetDiagString();
         return(msg);
     }
     else
     {
         return("Error: " + name + " Not Found");
     }
 }
コード例 #3
0
        public static bool StopTimer(string name)
        {
            DiagTimer t = TimerDictionary[name];

            if (t != null)
            {
                t.Stop();
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #4
0
        public static void StartTimer(string name)
        {
            DiagTimer t = new DiagTimer();

            if (!TimerDictionary.ContainsKey(name))
            {
                TimerDictionary.Add(name, t);
            }
            else // reset the named timer
            {
                TimerDictionary.Remove(name);
                TimerDictionary.Add(name, t);
            }
        }
コード例 #5
0
        public static string StopAndGetTimer(string name)
        {
            DiagTimer t = TimerDictionary[name];

            if (t != null)
            {
                t.Stop();
                return(GetTimer(name));
            }
            else
            {
                return("Error: " + name + " Not Found");
            }
        }