public void RemoveFromMonitoring() { var parent = _parent as MonitoringStateBase; if (parent != null) { // Delete the current component in parent child collections. using (new WriteLock(parent.Lock)) { parent._child.Remove(this); var component = this as MonitoringStateComponent; if (component != null) { parent._childComponents.Remove(component); } var counter = this as PerformanceCounterBase; if (counter != null) { parent._childCounters.Remove(counter); } } } // Reset the parent reference. _parent = null; }
protected MonitoringStateBase(string name, Severity severity, IMonitoringState parent) : this(name, severity) { if (parent == null) { throw new ArgumentNullException("parent"); } // Setup parent component. _parent = parent; Monitoring = parent.Monitoring.CreateMonitoring(name); }
protected MonitoringStateBase(string name, Severity severity, IMonitoring monitoring) : this(name, severity) { if (monitoring == null) { throw new ArgumentNullException("monitoring"); } // Setup parent component. _parent = null; Monitoring = monitoring; }
internal PerformanceCounterBase(bool isReadonly, PerformanceCounterType type, string name, Severity severity, IMonitoringState parent) : base(name, severity, parent) { IsReadonly = isReadonly; CounterType = type; }
internal PerformanceCounterSystem(PerformanceCounter system, Severity severity, IMonitoringState parent) : base(true, GetCounterType(system.CounterType), GetCounterName(system.MachineName, system.CategoryName, system.CounterName, system.InstanceName), severity, parent) { _system = system; UpdateInternal(); }
internal PerformanceCounterNumericFunc(string counterName, Func <float> counterValueFunc, PerformanceCounterType counterType, Severity severity, IMonitoringState parent) : base(true, counterType, counterName, severity, parent) { _counterValueFunc = counterValueFunc ?? (() => 0.0f); UpdateInternal(); }
internal PerformanceCounterString(string counterName, Severity severity, IMonitoringState parent) : base(false, PerformanceCounterType.StringValue, counterName, severity, parent) { CounterValue = string.Empty; }
internal MonitoringStateComponent(string name, Severity severity, IMonitoringState parent) : base(name, severity, parent) { }
internal PerformanceCounterNumeric(string counterName, PerformanceCounterType counterType, Severity severity, IMonitoringState parent) : base(false, counterType, counterName, severity, parent) { // Setup support base value flag. switch (counterType) { case PerformanceCounterType.AverageValue: case PerformanceCounterType.PercentValue: _supportBase = true; break; } UpdateInternal(); }
internal PerformanceCounterStringFunc(string counterName, Func<string> counterValueFunc, Severity severity, IMonitoringState parent) : base(true, PerformanceCounterType.StringValue, counterName, severity, parent) { _counterValueFunc = counterValueFunc ?? (() => string.Empty); UpdateInternal(); }