/// <summary> /// Agrega una nueva instancia de contador /// </summary> /// <param name="categoryName">Nombre de la categoría</param> /// <param name="counterName">Nombre del contador</param> /// <param name="instanceName">Nombre de la instancia</param> public static void AddCounterInstance(string categoryName, string counterName, string instanceName) { if (!isInitialized) { PerformanceCounterContainer.AddCounterInstance(categoryName, counterName, instanceName, true); } }
/// <summary> /// Carga la configuración a partir de <paramref name="section"/> /// </summary> /// <param name="section">Sección de configuración del archivo de configuración</param> private static void LoadConfigurationFromConfigurationSection( InstrumentationSection section) { foreach (PerformanceCounterCategoryElement categoryElement in section.CategoryCollection) { PerformanceCounterContainer.AddPerformanceCounterCategory(categoryElement.Name, categoryElement.Description, categoryElement.IsActive, categoryElement.Type); foreach (PerformanceCounterElement counterElement in categoryElement.PerformanceCounterCollection) { PerformanceCounterContainer.AddCounter(categoryElement.Name, counterElement.Name, counterElement.Description, counterElement.Type); foreach (PerformanceCounterInstanceElement instanceElement in counterElement.InstanceCollection) { PerformanceCounterContainer.AddCounterInstance(categoryElement.Name, counterElement.Name, instanceElement.Name, instanceElement.IsActive); } } } }