/// <summary> /// Add performance counter definitions. /// </summary> /// <param name="category">Category name.</param> /// <param name="definitions">Performance counter definitions (key, name, help, type).</param> public void AddCounterDefinitions(string category, IEnumerable <Tuple <TKey, string, string, PerfCounterType> > definitions) { Dictionary <int, CounterCreationData> counterDefinitions = new Dictionary <int, CounterCreationData>(); foreach (var def in definitions) { var key = def.Item1; var name = def.Item2; var help = def.Item3; var type = this.ConcretePerfCounterType(def.Item4); counterDefinitions[(int)(object)key] = new CounterCreationData(name, help, type); } PerfCounterManager.AddCounterDefinitions(category, counterDefinitions); }
/// <summary> /// Initializes a new instance of the <see cref="PerfCounterCollection{TKey}"/> class. /// </summary> /// <param name="category">Category name.</param> /// <param name="instance">Instance name.</param> public PerfCounterCollection(string category, string instance) { this.counters = PerfCounterManager.AddInstance <TKey>(category, instance); }