public IBarSensor <double> CreateDoubleBarSensor(string path, int timeout, int smallPeriod, int precision, string description = "")
        {
            var existingSensor  = GetExistingSensor(path);
            var doubleBarSensor = existingSensor as IBarSensor <double>;

            if (doubleBarSensor != null)
            {
                (doubleBarSensor as BarSensorBase)?.Restart(timeout, smallPeriod);
                return(doubleBarSensor);
            }

            BarSensor <double> sensor = new BarSensor <double>(path, _productKey, _dataQueue as IValuesQueue,
                                                               SensorType.DoubleBarSensor, timeout, smallPeriod, precision, description);

            AddNewSensor(sensor, path);
            return(sensor);
        }
        //public IBoolSensor CreateBoolSensor(string path)
        //{
        //    var existingSensor = GetExistingSensor(path);
        //    var boolSensor = existingSensor as IBoolSensor;
        //    if (boolSensor != null)
        //    {
        //        return boolSensor;
        //    }

        //    InstantValueSensorBool sensor = new InstantValueSensorBool(path, _productKey, _dataQueue as IValuesQueue);
        //    AddNewSensor(sensor, path);
        //    return sensor;
        //}

        //public IDoubleSensor CreateDoubleSensor(string path)
        //{
        //    var existingSensor = GetExistingSensor(path);
        //    var doubleSensor = existingSensor as IDoubleSensor;
        //    if (doubleSensor != null)
        //    {
        //        return doubleSensor;
        //    }

        //    InstantValueSensorDouble sensor = new InstantValueSensorDouble(path, _productKey, _dataQueue as IValuesQueue);
        //    AddNewSensor(sensor, path);
        //    return sensor;
        //}

        //public IIntSensor CreateIntSensor(string path)
        //{
        //    var existingSensor = GetExistingSensor(path);
        //    var intSensor = existingSensor as IIntSensor;
        //    if (intSensor != null)
        //    {
        //        return intSensor;
        //    }

        //    InstantValueSensorInt sensor = new InstantValueSensorInt(path, _productKey, _dataQueue as IValuesQueue);
        //    AddNewSensor(sensor, path);
        //    return sensor;
        //}

        //public IStringSensor CreateStringSensor(string path)
        //{
        //    var existingSensor = GetExistingSensor(path);
        //    var stringSensor = existingSensor as IStringSensor;
        //    if (stringSensor != null)
        //    {
        //        return stringSensor;
        //    }

        //    InstantValueSensorString sensor = new InstantValueSensorString(path, _productKey, _dataQueue as IValuesQueue);
        //    AddNewSensor(sensor, path);
        //    return sensor;
        //}

        //public IDefaultValueSensorInt CreateDefaultValueSensorInt(string path, int defaultValue)
        //{
        //    var existingSensor = GetExistingSensor(path);
        //    var defaultValueSensorInt = existingSensor as IDefaultValueSensorInt;
        //    if (defaultValueSensorInt != null)
        //    {
        //        return defaultValueSensorInt;
        //    }

        //    DefaultValueSensorInt sensor = new DefaultValueSensorInt(path, _productKey, _dataQueue as IValuesQueue, defaultValue);
        //    AddNewSensor(sensor, path);
        //    return sensor;
        //}

        //public IDefaultValueSensorDouble CreateDefaultValueSensorDouble(string path, double defaultValue)
        //{
        //    var existingSensor = GetExistingSensor(path);
        //    var defaultValueSensorDouble = existingSensor as IDefaultValueSensorDouble;
        //    if (defaultValueSensorDouble != null)
        //    {
        //        return defaultValueSensorDouble;
        //    }

        //    DefaultValueSensorDouble sensor = new DefaultValueSensorDouble(path, _productKey, _dataQueue as IValuesQueue, defaultValue);
        //    AddNewSensor(sensor, path);
        //    return sensor;
        //}
        #endregion

        #region Old Bar sensors

        //public IDoubleBarSensor Create1HrDoubleBarSensor(string path, int precision = 2)
        //{
        //    return CreateDoubleBarSensor(path, 3600000, 15000, precision);
        //}

        //public IDoubleBarSensor Create30MinDoubleBarSensor(string path, int precision = 2)
        //{
        //    return CreateDoubleBarSensor(path, 1800000, 15000, precision);
        //}

        //public IDoubleBarSensor Create10MinDoubleBarSensor(string path, int precision = 2)
        //{
        //    return CreateDoubleBarSensor(path, 600000, 15000, precision);
        //}

        //public IDoubleBarSensor Create5MinDoubleBarSensor(string path, int precision = 2)
        //{
        //    return CreateDoubleBarSensor(path, 300000, 15000, precision);
        //}

        //public IDoubleBarSensor Create1MinDoubleBarSensor(string path, int precision = 2)
        //{
        //    return CreateDoubleBarSensor(path, 60000, 15000, precision);
        //}
        //public IDoubleBarSensor CreateDoubleBarSensor(string path, int timeout = 30000, int smallPeriod = 15000, int precision = 2)
        //{
        //    var existingSensor = GetExistingSensor(path);
        //    var doubleBarSensor = existingSensor as IDoubleBarSensor;
        //    if (doubleBarSensor != null)
        //    {
        //        (doubleBarSensor as BarSensorBase)?.Restart(timeout, smallPeriod);
        //        return doubleBarSensor;
        //    }

        //    BarSensorDouble sensor = new BarSensorDouble(path, _productKey, _dataQueue as IValuesQueue, timeout, smallPeriod, precision);
        //    AddNewSensor(sensor, path);
        //    return sensor;
        //}

        //public IIntBarSensor Create1HrIntBarSensor(string path)
        //{
        //    return CreateIntBarSensor(path, 3600000);
        //}

        //public IIntBarSensor Create30MinIntBarSensor(string path)
        //{
        //    return CreateIntBarSensor(path, 1800000);
        //}

        //public IIntBarSensor Create10MinIntBarSensor(string path)
        //{
        //    return CreateIntBarSensor(path, 600000);
        //}

        //public IIntBarSensor Create5MinIntBarSensor(string path)
        //{
        //    return CreateIntBarSensor(path, 300000);
        //}

        //public IIntBarSensor Create1MinIntBarSensor(string path)
        //{
        //    return CreateIntBarSensor(path, 60000);
        //}

        //public IIntBarSensor CreateIntBarSensor(string path, int timeout = 30000, int smallPeriod = 15000)
        //{
        //    var existingSensor = GetExistingSensor(path);
        //    var intBarSensor = existingSensor as IIntBarSensor;
        //    if (intBarSensor != null)
        //    {
        //        (intBarSensor as BarSensorBase)?.Restart(timeout, smallPeriod);
        //        return intBarSensor;
        //    }

        //    BarSensorInt sensor = new BarSensorInt(path, _productKey, _dataQueue as IValuesQueue, timeout, smallPeriod);
        //    AddNewSensor(sensor, path);
        //    return sensor;
        //}

        #endregion

        #region Generic bar sensors

        public IBarSensor <int> CreateIntBarSensor(string path, int timeout, int smallPeriod = 15000, string description = "")
        {
            var existingSensor = GetExistingSensor(path);
            var intBarSensor   = existingSensor as IBarSensor <int>;

            if (intBarSensor != null)
            {
                (intBarSensor as BarSensorBase)?.Restart(timeout, smallPeriod);
                return(intBarSensor);
            }

            BarSensor <int> sensor = new BarSensor <int>(path, _productKey, _dataQueue as IValuesQueue, SensorType.IntegerBarSensor,
                                                         timeout, smallPeriod, description);

            AddNewSensor(sensor, path);
            return(sensor);
        }
Beispiel #3
0
 public ProcessThreadCountSensor(string productKey, IValuesQueue queue, string processName)
     : base($"{TextConstants.PerformanceNodeName}/{_sensorName}", "Process", "Thread Count", processName)
 {
     InternalBar = new BarSensor <int>($"{TextConstants.PerformanceNodeName}/{_sensorName}", productKey, queue, SensorType.IntegerBarSensor);
 }
Beispiel #4
0
 public FreeMemorySensor(string productKey, IValuesQueue queue, string nodeName) :
     base($"{nodeName ?? TextConstants.PerformanceNodeName}/{_sensorName}", "Memory", "Available MBytes", string.Empty, GetFreeMemoryFunc())
 {
     InternalBar = new BarSensor <int>(Path, productKey, queue, SensorType.IntegerBarSensor);
 }
Beispiel #5
0
 public ProcessCPUSensor(string productKey, IValuesQueue queue, string processName)
     : base($"{TextConstants.PerformanceNodeName}/{_sensorName}", "Process", "% Processor Time", processName)
 {
     InternalBar = new BarSensor <double>($"{TextConstants.PerformanceNodeName}/{_sensorName}", productKey, queue, SensorType.DoubleBarSensor);
 }
Beispiel #6
0
 public ProcessMemorySensor(string productKey, IValuesQueue queue, string processName, string nodeName)
     : base($"{nodeName ?? TextConstants.CurrentProcessNodeName}/{_sensorName}", "Process", "Working set", processName, GetProcessMemoryFunc())
 {
     InternalBar = new BarSensor <int>(Path, productKey, queue, SensorType.IntegerBarSensor);
 }
 public ProcessCPUSensor(string productKey, IValuesQueue queue, string processName, string nodeName)
     : base($"{nodeName ?? TextConstants.CurrentProcessNodeName}/{_sensorName}", "Process", "% Processor Time", processName, GetProcessCPUFunc())
 {
     InternalBar = new BarSensor <double>(Path, productKey, queue, SensorType.DoubleBarSensor);
 }
Beispiel #8
0
 public TotalCPUSensor(string productKey, IValuesQueue queue, string nodeName)
     : base($"{nodeName ?? TextConstants.PerformanceNodeName}/{_sensorName}", "Processor", "% Processor Time", "_Total", GetTotalCPUFunc())
 {
     InternalBar = new BarSensor <int>(Path, productKey, queue, SensorType.IntegerBarSensor);
 }