internal static PerformanceCounterLib GetPerformanceCounterLib(string machineName, CultureInfo culture) { string lcidString = culture.Name.ToLowerInvariant(); if (machineName.CompareTo(".") == 0) { machineName = ComputerName.ToLowerInvariant(); } else { machineName = machineName.ToLowerInvariant(); } if (PerformanceCounterLib.s_libraryTable == null) { lock (InternalSyncObject) { if (PerformanceCounterLib.s_libraryTable == null) { PerformanceCounterLib.s_libraryTable = new Dictionary <string, PerformanceCounterLib>(); } } } string libraryKey = machineName + ":" + lcidString; PerformanceCounterLib library; if (!PerformanceCounterLib.s_libraryTable.TryGetValue(libraryKey, out library)) { library = new PerformanceCounterLib(machineName, lcidString); PerformanceCounterLib.s_libraryTable[libraryKey] = library; } return(library); }
internal static PerformanceCounterLib GetPerformanceCounterLib(string machineName, CultureInfo culture) { string lcidString = culture.Name.ToLowerInvariant(); if (machineName.CompareTo(".") == 0) { machineName = ComputerName.ToLowerInvariant(); } else { machineName = machineName.ToLowerInvariant(); } LazyInitializer.EnsureInitialized(ref s_libraryTable, ref s_internalSyncObject, () => new Dictionary <string, PerformanceCounterLib>()); string libraryKey = machineName + ":" + lcidString; PerformanceCounterLib library; if (!PerformanceCounterLib.s_libraryTable.TryGetValue(libraryKey, out library)) { library = new PerformanceCounterLib(machineName, lcidString); PerformanceCounterLib.s_libraryTable[libraryKey] = library; } return(library); }