System.Diagnostics.Tests.ProcessTests.ProcessPeformanceCounterEnabled C# (CSharp) Method

ProcessPeformanceCounterEnabled() private static method

private static ProcessPeformanceCounterEnabled ( ) : bool
return bool
        private static bool ProcessPeformanceCounterEnabled()
        {
            try
            {
                int? value = (int?)Microsoft.Win32.Registry.GetValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\PerfProc\Performance", "Disable Performance Counters", null);
                return !value.HasValue || value.Value == 0;
            }
            catch (Exception)
            {
                // Ignore exceptions, and just assume the counter is enabled.
            }

            return true;
        }
ProcessTests