public void AddMediumMulti() { var Profile = new Profiler(Intervals); Profile.Add("Test"); Profile.Reset(); //**************************************** using (Profile.Profile("Test")) { Thread.Yield(); } WaitFor(ShortInterval); using (Profile.Profile("Test")) { Thread.Yield(); } //**************************************** var Results = Profile.Get("Test"); Assert.AreEqual(1, Results[0].Samples); Assert.AreEqual(2, Results[1].Samples); Assert.AreEqual(0, Results[2].Samples); }
public void AllTime2() { var Profile = new Profiler(new[] { TimeSpan.Zero }); Profile.Add("Test"); Profile.Reset(); //**************************************** using (Profile.Profile("Test")) { Thread.Yield(); } using (Profile.Profile("Test")) { Thread.Yield(); } //**************************************** var Result = Profile.Get("Test")[0]; Assert.AreEqual(2, Result.Samples); }
public void AddLong() { var Profile = new Profiler(Intervals); Profile.Add("Test"); Profile.Reset(); //**************************************** using (Profile.Profile("Test")) { Thread.Yield(); } // Need to wait 40ms for the medium interval to tick over WaitFor(LongInterval + ShortInterval); //**************************************** var Results = Profile.Get("Test"); Assert.AreEqual(0, Results[0].Samples); Assert.AreEqual(0, Results[1].Samples); Assert.AreEqual(1, Results[2].Samples); }
public void Index(string id, List <string> lines) { for (int i = 1; i <= lines.Count; i++) { var line = lines[i - 1]; if (!String.IsNullOrWhiteSpace(line)) { string s = Substitute(line); if (!String.IsNullOrWhiteSpace(s)) { var tokens = Tokenize(s); int j = 0; foreach (var token in tokens) { j++; Index(id, token, i, j); if (!Profiler.ContainsKey(token)) { Profiler.Add(token.ToLower(), 0); } Profiler[token]++; } } } } }
public void IndexText(string id, string text) { if (!String.IsNullOrWhiteSpace(text)) { string s = Substitute(text); if (!String.IsNullOrWhiteSpace(s)) { var tokens = Tokenize(s); int j = 0; foreach (var token in tokens) { j++; Index(id, token, 0, j); if (!Profiler.ContainsKey(token)) { Profiler.Add(token.ToLower(), 0); } Profiler[token]++; } } } }
public void Accept(TimingMessage msg) => Profiler.Add(new TimingRecord(msg.DebugSignal, msg.AverageTime, msg.Min, msg.Max));
public void Accept(TimingViolationMessage msg) => Profiler.Add(new TimingViolation(msg.DebugSignal, msg.Time, msg.TimeLimit, 0));