/// <summary> /// Prepare for stats collection /// </summary> private void Prepare() { if (Environment.OSVersion.ToString().StartsWith("unix", StringComparison.InvariantCultureIgnoreCase)) { logger.Warn(ErrorCode.PerfCounterNotFound, "Windows perf counters are only available on Windows :) -- defaulting to in-memory counters."); shouldWritePerfCounters = false; return; } if (!OrleansPerfCounterManager.AreWindowsPerfCountersAvailable()) { logger.Warn(ErrorCode.PerfCounterNotFound, "Windows perf counters not found -- defaulting to in-memory counters. Run CounterControl.exe as Administrator to create perf counters for Orleans."); shouldWritePerfCounters = false; return; } try { OrleansPerfCounterManager.PrecreateCounters(); } catch (Exception exc) { logger.Warn(ErrorCode.PerfCounterFailedToInitialize, "Failed to initialize perf counters -- defaulting to in-memory counters. Run CounterControl.exe as Administrator to create perf counters for Orleans.", exc); shouldWritePerfCounters = false; } }
/// <summary> /// Prepare for stats collection /// </summary> private void Prepare() { if (!OrleansPerfCounterManager.AreWindowsPerfCountersAvailable()) { logger.Warn(ErrorCode.PerfCounterNotFound, "Windows perf counters not found -- defaulting to in-memory counters. Run CounterControl.exe as Administrator to create perf counters for Orleans."); shouldWritePerfCounters = false; return; } try { OrleansPerfCounterManager.PrecreateCounters(); } catch (Exception exc) { logger.Warn(ErrorCode.PerfCounterFailedToInitialize, "Failed to initialize perf counters -- defaulting to in-memory counters. Run CounterControl.exe as Administrator to create perf counters for Orleans.", exc); shouldWritePerfCounters = false; } }