public void PerfCounterSet_Instances() { PerfCounterSet counters = new PerfCounterSet(true, true, "Test_Instances", "Test Help"); PerfCounter A_ONE, A_TWO, B_ONE, B_TWO; try { counters.Add(new PerfCounter("A", "A Help", PerformanceCounterType.NumberOfItems32)); counters.Add(new PerfCounter("B", "B Help", PerformanceCounterType.NumberOfItems32)); counters.Install(); A_ONE = counters["A", "ONE"]; A_TWO = counters["A", "TWO"]; B_ONE = counters["B", "ONE"]; B_TWO = counters["B", "TWO"]; A_ONE.IncrementBy(1); A_TWO.IncrementBy(2); B_ONE.IncrementBy(3); B_TWO.IncrementBy(4); Assert.AreEqual(1, A_ONE.RawValue); Assert.AreEqual(2, A_TWO.RawValue); Assert.AreEqual(3, B_ONE.RawValue); Assert.AreEqual(4, B_TWO.RawValue); } finally { counters.Uninstall(); } }
public void PerfCounterSet_Related2() { PerfCounterSet counters = new PerfCounterSet(false, true, "Test_Related2", "Test Help"); PerfCounter A, B, C; try { counters.Add(new PerfCounter("A", "A Help", PerformanceCounterType.NumberOfItems32)); counters.Add(new PerfCounter("B", "B Help", PerformanceCounterType.NumberOfItems32)); counters.Add(new PerfCounter("C", "C Help", PerformanceCounterType.NumberOfItems32)); counters.Relate("A", "C"); counters.Relate("B", "C"); counters.Install(); A = counters["A"]; B = counters["B"]; C = counters["C"]; Assert.AreEqual(0, C.RawValue); A.Increment(); Assert.AreEqual(1, C.RawValue); B.IncrementBy(5); Assert.AreEqual(6, C.RawValue); A.Decrement(); Assert.AreEqual(5, C.RawValue); } finally { counters.Uninstall(); } }
public void PerfCounterSet_Install_Uninstall() { PerfCounterSet counters = new PerfCounterSet(false, true, "Test_Install_Uninstall", "Test Help"); PerfCounter A, B; try { counters.Add(new PerfCounter("A", "A Help", PerformanceCounterType.NumberOfItems32)); counters.Add(new PerfCounter("B", "B Help", PerformanceCounterType.NumberOfItems32)); counters.Install(); A = counters["A"]; Assert.IsNotNull(A.Counter); Assert.AreEqual(0, A.RawValue); Assert.AreEqual(1, A.Increment()); Assert.AreEqual(1, A.RawValue); B = counters["B"]; B.IncrementBy(55); Assert.AreEqual(55, B.RawValue); } finally { counters.Uninstall(); } }
/// <summary> /// Installs the service's performance counters by adding them to the /// performance counter set passed. /// </summary> /// <param name="perfCounters">The application's performance counter set (or <c>null</c>).</param> public static void Install(PerfCounterSet perfCounters) { if (perfCounters == null) { return; } perfCounters.Add(new PerfCounter(Runtime_Name, "Service runtime in minutes", PerformanceCounterType.NumberOfItems32)); perfCounters.Add(new PerfCounter(TotalCalls_Name, "Total active calls", PerformanceCounterType.NumberOfItems32)); perfCounters.Add(new PerfCounter(TotalCallRate_Name, "Total Call Rate", PerformanceCounterType.RateOfCountsPerSecond32)); }
/// <summary> /// Installs the service's performance counters by adding them to the /// performance counter set passed. /// </summary> /// <param name="perfCounters">The application's performance counter set (or <c>null</c>).</param> /// <param name="perfPrefix">The string to prefix any performance counter names (or <c>null</c>).</param> public static void Install(PerfCounterSet perfCounters, string perfPrefix) { if (perfCounters == null) { return; } if (perfPrefix == null) { perfPrefix = string.Empty; } perfCounters.Add(new PerfCounter(perfPrefix + Queries_Name, "RADIUS authentication queries/sec", PerformanceCounterType.RateOfCountsPerSecond32)); perfCounters.Add(new PerfCounter(perfPrefix + Exceptions_Name, "RADIUS exceptions/sec", PerformanceCounterType.RateOfCountsPerSecond32)); }
/// <summary> /// Installs the service's performance counters by adding them to the /// performance counter set passed. /// </summary> /// <param name="perfCounters">The application's performance counter set (or <c>null</c>).</param> /// <param name="perfPrefix">The string to prefix any performance counter names (or <c>null</c>).</param> public static void Install(PerfCounterSet perfCounters, string perfPrefix) { if (perfCounters == null) { return; } if (perfPrefix == null) { perfPrefix = string.Empty; } perfCounters.Add(new PerfCounter(perfPrefix + Queries_Name, "Number of health check queries/sec", PerformanceCounterType.RateOfCountsPerSecond32)); perfCounters.Add(new PerfCounter(perfPrefix + Status_Name, "Health Status (1=healthy)", PerformanceCounterType.NumberOfItems32)); perfCounters.Add(new PerfCounter(perfPrefix + Runtime_Name, "Service runtime in minutes", PerformanceCounterType.NumberOfItems32)); }
/// <summary> /// Installs the service's performance counters by adding them to the /// performance counter set passed. /// </summary> /// <param name="perfCounters">The application's performance counter set (or <c>null</c>).</param> /// <param name="perfPrefix">The string to prefix any performance counter names (or <c>null</c>).</param> public static void Install(PerfCounterSet perfCounters, string perfPrefix) { if (perfCounters == null) { return; } if (perfPrefix == null) { perfPrefix = string.Empty; } perfCounters.Add(new PerfCounter(perfPrefix + Uploads_Name, "Application executable packages received/sec", PerformanceCounterType.RateOfCountsPerSecond32)); perfCounters.Add(new PerfCounter(perfPrefix + Deliveries_Name, "Application executable packages deliveries/sec", PerformanceCounterType.RateOfCountsPerSecond32)); perfCounters.Add(new PerfCounter(perfPrefix + CacheLoads_Name, "Application executable package cache loads/sec", PerformanceCounterType.RateOfCountsPerSecond32)); perfCounters.Add(new PerfCounter(perfPrefix + Runtime_Name, "Service runtime in minutes", PerformanceCounterType.NumberOfItems32)); }
public void PerfCounterSet_Related_Instance() { PerfCounterSet counters = new PerfCounterSet(true, true, "Test_Related_Instance", "Test Help"); PerfCounter A1, B1, C1; PerfCounter A2, B2, C2; try { counters.Add(new PerfCounter("A", "A Help", PerformanceCounterType.NumberOfItems32)); counters.Add(new PerfCounter("B", "B Help", PerformanceCounterType.NumberOfItems32)); counters.Add(new PerfCounter("C", "C Help", PerformanceCounterType.NumberOfItems32)); counters.Relate("A", "C"); counters.Relate("B", "C"); counters.Install(); A1 = counters["A", "1"]; B1 = counters["B", "1"]; C1 = counters["C", "1"]; A2 = counters["A", "2"]; B2 = counters["B", "2"]; C2 = counters["C", "2"]; Assert.AreEqual(0, C1.RawValue); A1.Increment(); Assert.AreEqual(1, C1.RawValue); B1.IncrementBy(5); Assert.AreEqual(6, C1.RawValue); A1.Decrement(); Assert.AreEqual(5, C1.RawValue); Assert.AreEqual(0, C2.RawValue); A2.IncrementBy(100); Assert.AreEqual(100, C2.RawValue); B2.IncrementBy(100); Assert.AreEqual(200, C2.RawValue); } finally { counters.Uninstall(); } }
/// <summary> /// Installs the service's performance counters by adding them to the /// performance counter set passed. /// </summary> /// <param name="perfCounters">The application's performance counter set (or <c>null</c>).</param> /// <param name="perfPrefix">The string to prefix any performance counter names (or <c>null</c>).</param> public static void Install(PerfCounterSet perfCounters, string perfPrefix) { if (perfCounters == null) { return; } if (perfPrefix == null) { perfPrefix = string.Empty; } perfCounters.Add(new PerfCounter(perfPrefix + IPGeocode_Name, "IP Geocode queries/sec", PerformanceCounterType.RateOfCountsPerSecond32)); perfCounters.Add(new PerfCounter(perfPrefix + FixesReceived_Name, "Location fixes received/sec", PerformanceCounterType.RateOfCountsPerSecond32)); perfCounters.Add(new PerfCounter(perfPrefix + FixesArchived_Name, "Location fixes received/sec", PerformanceCounterType.RateOfCountsPerSecond32)); perfCounters.Add(new PerfCounter(perfPrefix + Runtime_Name, "Service runtime in minutes", PerformanceCounterType.NumberOfItems32)); perfCounters.Add(new PerfCounter(perfPrefix + Entities_Name, "Number of entities tracked", PerformanceCounterType.NumberOfItems32)); perfCounters.Add(new PerfCounter(perfPrefix + Groups_Name, "Number of groups tracked", PerformanceCounterType.NumberOfItems32)); }
/// <summary> /// Installs the service's performance counters by adding them to the /// performance counter set passed. /// </summary> /// <param name="perfCounters">The application's performance counter set (or <c>null</c>).</param> /// <param name="perfPrefix">The string to prefix any performance counter names (or <c>null</c>).</param> public static void Install(PerfCounterSet perfCounters, string perfPrefix) { if (perfCounters == null) { return; } if (perfPrefix == null) { perfPrefix = string.Empty; } perfCounters.Add(new PerfCounter(perfPrefix + IsMaster_Name, "Indicates if this is the cluster master (0/1)", PerformanceCounterType.NumberOfItems32)); perfCounters.Add(new PerfCounter(perfPrefix + AdminMessageRate_Name, "Admin Messages/sec", PerformanceCounterType.RateOfCountsPerSecond32)); perfCounters.Add(new PerfCounter(perfPrefix + AdminByteRate_Name, "Admin Bytes/sec", PerformanceCounterType.RateOfCountsPerSecond32)); perfCounters.Add(new PerfCounter(perfPrefix + BroadcastReceiveMessageRate_Name, "Broadcast Messages Received/sec", PerformanceCounterType.RateOfCountsPerSecond32)); perfCounters.Add(new PerfCounter(perfPrefix + BroadcastReceiveByteRate_Name, "Broadcast Receive Bytes/sec", PerformanceCounterType.RateOfCountsPerSecond32)); perfCounters.Add(new PerfCounter(perfPrefix + BroadcastSendMessageRate_Name, "Broadcast Messages Sent/sec", PerformanceCounterType.RateOfCountsPerSecond32)); perfCounters.Add(new PerfCounter(perfPrefix + BroadcastSendByteRate_Name, "Broadcast Send Bytes/sec", PerformanceCounterType.RateOfCountsPerSecond32)); perfCounters.Add(new PerfCounter(perfPrefix + TotalMessageRate_Name, "Total Messages (sent or received)/sec", PerformanceCounterType.RateOfCountsPerSecond32)); perfCounters.Add(new PerfCounter(perfPrefix + TotalByteRate_Name, "Total Bytes (sent or received)/sec", PerformanceCounterType.RateOfCountsPerSecond32)); perfCounters.Add(new PerfCounter(perfPrefix + ServerCount_Name, "Number of UDP broadcast servers in the cluster", PerformanceCounterType.NumberOfItems32)); perfCounters.Add(new PerfCounter(perfPrefix + ClientCount_Name, "Number of UDP broadcast clients in the cluster", PerformanceCounterType.NumberOfItems32)); perfCounters.Add(new PerfCounter(perfPrefix + Runtime_Name, "Service runtime in minutes", PerformanceCounterType.NumberOfItems32)); }