public void BasicTest()
 {
     Utilities.Profiler.StopWatch TestObject = new Utilities.Profiler.StopWatch();
     TestObject.Start();
     Thread.Sleep(100);
     TestObject.Stop();
     Assert.InRange(TestObject.ElapsedTime, 80, 120);
 }
 public void BasicTest()
 {
     Utilities.Profiler.StopWatch TestObject = new Utilities.Profiler.StopWatch();
     TestObject.Start();
     Thread.Sleep(100);
     TestObject.Stop();
     Assert.InRange(TestObject.ElapsedTime, 80, 120);
 }
 /// <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;
     }
 }
 private void Setup(string Function = "")
 {
     StopWatch = new StopWatch();
     StopWatch.Start();
     this.Function = Function;
 }
 /// <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();
 }
 private void Setup(string Function = "")
 {
     StopWatch = new StopWatch();
     StopWatch.Start();
     this.Function = Function;
 }