/// <summary> /// Create the set of Orleans counters, if they do not already exist /// </summary> /// <param name="useBruteForce">Use brute force, if necessary</param> /// <remarks>Note: Program needs to be running as Administrator to be able to register Windows perf counters.</remarks> private static void RegisterWindowsPerfCounters(bool useBruteForce) { try { if (OrleansPerfCounterTelemetryConsumer.AreWindowsPerfCountersAvailable()) { if (!useBruteForce) { ConsoleText.WriteStatus("Orleans counters are already registered -- Use brute-force mode to re-initialize"); return; } // Delete any old perf counters UnregisterWindowsPerfCounters(true); } // Register perf counters perfCounterConsumer.InstallCounters(); if (OrleansPerfCounterTelemetryConsumer.AreWindowsPerfCountersAvailable()) { ConsoleText.WriteStatus("Orleans counters registered successfully"); } else { ConsoleText.WriteError("Orleans counters are NOT registered"); } } catch (Exception exc) { ConsoleText.WriteError("Error registering Orleans counters - {0}" + exc); throw; } }
/// <summary> /// Create the set of Orleans counters, if they do not already exist /// </summary> /// <param name="useBruteForce">Use brute force, if necessary</param> /// <remarks>Note: Program needs to be running as Administrator to be able to register Windows perf counters.</remarks> private static void RegisterWindowsPerfCounters(bool useBruteForce) { try { if (OrleansPerfCounterTelemetryConsumer.AreWindowsPerfCountersAvailable()) { if (!useBruteForce) { ConsoleText.WriteStatus("Orleans counters are already registered -- Use brute-force mode to re-initialize"); return; } // Delete any old perf counters UnregisterWindowsPerfCounters(true); } if (GrainTypeManager.Instance == null) { var loader = new SiloAssemblyLoader(new Dictionary <string, SearchOption>()); var typeManager = new GrainTypeManager(false, null, loader); // We shouldn't need GrainFactory in this case GrainTypeManager.Instance.Start(false); } // Register perf counters perfCounterConsumer.InstallCounters(); if (OrleansPerfCounterTelemetryConsumer.AreWindowsPerfCountersAvailable()) { ConsoleText.WriteStatus("Orleans counters registered successfully"); } else { ConsoleText.WriteError("Orleans counters are NOT registered"); } } catch (Exception exc) { ConsoleText.WriteError("Error registering Orleans counters - {0}" + exc); throw; } }