[PATCH] sensord: Define min value for loadavg in rrd file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Aurelien,

On Sun, 2 Mar 2008 22:35:59 +0100, Aurelien Jarno wrote:
> The patch below changes sensord so that it sets the minimum value of
> the loadavg field to 0 in the rrd file, as this value can't be 
> negative.
> 
> Index: prog/sensord/sensord.h
> ===================================================================
> --- prog/sensord/sensord.h	(r?vision 5132)
> +++ prog/sensord/sensord.h	(copie de travail)
> @@ -79,6 +79,7 @@
>    DataType_voltage = 0,
>    DataType_rpm,
>    DataType_temperature,
> +  DataType_loadavg,
>    DataType_other = -1
>  } DataType;
>  
> Index: prog/sensord/rrd.c
> ===================================================================
> --- prog/sensord/rrd.c	(r?vision 5132)
> +++ prog/sensord/rrd.c	(copie de travail)
> @@ -202,6 +202,10 @@
>          min = "0";
>          max = "250";
>          break;
> +      case DataType_loadavg:
> +        min = "0";
> +        max = "U";
> +        break;
>        default:
>          min = max = "U";
>          break;
> @@ -217,8 +221,11 @@
>    int ret = 0;
>    struct ds data = { 0, argv};
>    ret = applyToFeatures (rrdGetSensors_DS, &data);
> -  if (!ret && doLoad)
> -    ret = rrdGetSensors_DS (&data, LOADAVG, LOAD_AVERAGE, NULL);
> +  if (!ret && doLoad) {
> +    FeatureDescriptor feature;
> +    feature.type = DataType_loadavg;
> +    ret = rrdGetSensors_DS (&data, LOADAVG, LOAD_AVERAGE, &feature);
> +  }
>    return ret ? -1 : data.num;
>  }
>  

What does this change in practice? What's the benefit?

-- 
Jean Delvare




[Index of Archives]     [Linux Kernel]     [Linux Hardware Monitoring]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux