public virtual void Dispose() { for (int i = 0; i < counters.Length; i++) { CounterStatistic.Delete("test" + i); } }
public void Clean() { for (int i = 0; i < counters.Length; i++) { CounterStatistic.Delete("test" + i); } counters = null; }
public void Logger_Stats_MessageSizeLimit() { const string testName = "Logger_Stats_MessageSizeLimit"; TestLogConsumer logConsumer = new TestLogConsumer(output); TraceLogger.LogConsumers.Add(logConsumer); TraceLogger logger1 = TraceLogger.GetLogger(testName); const string StatsCounterBaseName = "LoggerTest.Stats.Size"; var createdCounters = new List <string>(); try { for (int i = 1; i <= 1000; i++) { string name = StatsCounterBaseName + "." + i; StatisticName counterName = new StatisticName(name); CounterStatistic ctr = CounterStatistic.FindOrCreate(counterName); ctr.IncrementBy(i); createdCounters.Add(name); } LogStatistics statsLogger = new LogStatistics(TimeSpan.Zero, true); statsLogger.DumpCounters().Wait(); int count = logConsumer.GetEntryCount((int)ErrorCode.PerfCounterDumpAll); output.WriteLine(count + " stats log message entries written"); Assert.IsTrue(count > 1, "Should be some stats log message entries - saw " + count); Assert.AreEqual(0, logConsumer.GetEntryCount((int)ErrorCode.Logger_LogMessageTruncated), "Should not see any 'Message truncated' message"); } finally { createdCounters.ForEach(name => CounterStatistic.Delete(name)); } }
public void Cleanup() { CounterStatistic.Delete(CounterName); }
public void Dispose() { CounterStatistic.Delete(CounterName); }