Пример #1
0
        public void GenerateCounterListTestSingleProvider()
        {
            CounterMonitor monitor  = new CounterMonitor();
            CounterSet     counters = monitor.ParseProviderList("MySource");

            Assert.Single(counters.Providers);
            Assert.Equal("MySource", counters.Providers.First());
            Assert.True(counters.IncludesAllCounters("MySource"));
        }
Пример #2
0
        public void GenerateCounterListTestManyProvidersWithFilter()
        {
            CounterMonitor monitor  = new CounterMonitor();
            CounterSet     counters = monitor.ParseProviderList("MySource1[mycounter1,mycounter2], MySource2[mycounter1], System.Runtime[cpu-usage,working-set]");

            Assert.Equal(3, counters.Providers.Count());

            Assert.Equal("MySource1", counters.Providers.ElementAt(0));
            Assert.False(counters.IncludesAllCounters("MySource1"));
            Assert.True(Enumerable.SequenceEqual(counters.GetCounters("MySource1"), new string[] { "mycounter1", "mycounter2" }));

            Assert.Equal("MySource2", counters.Providers.ElementAt(1));
            Assert.False(counters.IncludesAllCounters("MySource2"));
            Assert.True(Enumerable.SequenceEqual(counters.GetCounters("MySource2"), new string[] { "mycounter1" }));

            Assert.Equal("System.Runtime", counters.Providers.ElementAt(2));
            Assert.False(counters.IncludesAllCounters("System.Runtime"));
            Assert.True(Enumerable.SequenceEqual(counters.GetCounters("System.Runtime"), new string[] { "cpu-usage", "working-set" }));
        }
Пример #3
0
        public void GenerateCounterListTestSingleProviderWithFilter()
        {
            CounterMonitor monitor  = new CounterMonitor();
            CounterSet     counters = monitor.ParseProviderList("MySource[counter1,counter2,counter3]");

            Assert.Single(counters.Providers);
            Assert.Equal("MySource", counters.Providers.First());
            Assert.False(counters.IncludesAllCounters("MySource"));
            Assert.True(Enumerable.SequenceEqual(counters.GetCounters("MySource"), new string[] { "counter1", "counter2", "counter3" }));
        }