コード例 #1
0
 public void BasicTest()
 {
     Utilities.Profiler.StopWatch TestObject = new Utilities.Profiler.StopWatch();
     TestObject.Start();
     Thread.Sleep(100);
     TestObject.Stop();
     Assert.InRange(TestObject.ElapsedTime, 80, 120);
 }
コード例 #2
0
 public void BasicTest()
 {
     Utilities.Profiler.StopWatch TestObject = new Utilities.Profiler.StopWatch();
     TestObject.Start();
     Thread.Sleep(100);
     TestObject.Stop();
     Assert.InRange(TestObject.ElapsedTime, 80, 120);
 }
コード例 #3
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="Profiles">Profiles to copy data from</param>
 protected Profiler(IEnumerable<Profiler> Profiles)
 {
     Children = new List<Profiler>();
     Times = new List<long>();
     StopWatch = new StopWatch();
     Running = false;
     foreach (Profiler Profile in Profiles)
     {
         this.Level = Profile.Level;
         this.Function = Profile.Function;
         this.Times.Add(Profile.Times);
         this.Children.Add(Profile.Children);
         this.CalledFrom = Profile.CalledFrom;
     }
 }
コード例 #4
0
 private void Setup(string Function = "")
 {
     StopWatch = new StopWatch();
     StopWatch.Start();
     this.Function = Function;
 }
コード例 #5
0
 /// <summary>
 /// Sets up the profiler
 /// </summary>
 /// <param name="Function">Function/Identification name</param>
 protected virtual void Setup(string Function = "")
 {
     this.Parent = Current;
     Profiler Child = null;
     if (Parent != null)
         Child = Parent.Children.FirstOrDefault(x => x == this);
     if (Child == null)
     {
         if (Parent != null)
             Parent.Children.Add(this);
         this.Function = Function;
         Children = new List<Profiler>();
         Times = new List<long>();
         StopWatch = new StopWatch();
         this.Level = Parent == null ? 0 : Parent.Level + 1;
         this.CalledFrom = new StackTrace().GetMethods(this.GetType().Assembly).ToString<MethodBase>(x => x.DeclaringType.Name + " > " + x.Name, "<br />");
         Running = false;
         Current = this;
     }
     else
     {
         Current = Child;
     }
     Start();
 }
コード例 #6
0
 private void Setup(string Function = "")
 {
     StopWatch = new StopWatch();
     StopWatch.Start();
     this.Function = Function;
 }