Ejemplo n.º 1
0
        private static void CreatePerfCounterCollector()
        {
            CounterCollectorInfo info = new CounterCollectorInfo("MyCounters");

            info.SampleInterval = TimeSpan.FromSeconds(1.0d);
            info.LogFileFormat  = LogFileFormat.CommaSeparated;
            info.OutputPath     = Environment.CurrentDirectory;

            info.CounterNames.Add(new CounterName()
            {
                Category = "Process", Counter = "Thread Count", Instance = "explorer"
            });
            info.CounterNames.Add(new CounterName()
            {
                Category = "System", Counter = "System Calls/sec"
            });
            info.CounterNames.Add(new CounterName()
            {
                Category = "Processor", Counter = "Interrupts/sec", Instance = "_Total"
            });

            ICollectorSet collector = info.Create();

            collector.Start();

            Thread.Sleep(5000);

            collector.Stop();

            collector.Delete();
        }
Ejemplo n.º 2
0
        private static void CreatePerfCounterCollector()
        {
            CounterCollectorInfo info = new CounterCollectorInfo("MyCounters");

            info.SampleInterval = TimeSpan.FromSeconds(1.0d);
            info.LogFileFormat = LogFileFormat.CommaSeparated;
            info.OutputPath = Environment.CurrentDirectory;

            info.CounterNames.Add(new CounterName() { Category = "Process", Counter = "Thread Count", Instance = "explorer" });
            info.CounterNames.Add(new CounterName() { Category = "System", Counter = "System Calls/sec" });
            info.CounterNames.Add(new CounterName() { Category = "Processor", Counter = "Interrupts/sec", Instance = "_Total" });

            ICollectorSet collector = info.Create();
            collector.Start();

            Thread.Sleep(5000);

            collector.Stop();

            collector.Delete();
        }