Changeset 6008

Show
Ignore:
Timestamp:
01/09/12 19:24:03 (18 months ago)
Author:
groeck
Message:

sensors: Display both instantaneous and average power

Some sensor chips report both instantaneous and average power.
Add support to display both.

Location:
lm-sensors/trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • lm-sensors/trunk/CHANGES

    r6007 r6008  
    55  libsensors: Added support for new sysfs attributes 
    66  sensors: Added support for new sysfs attributes 
     7           Display both instantaneous and average power if available. 
    78  fancontrol: Support setup where one PWM output controls several fans 
    89              Output error messages to stderr 
  • lm-sensors/trunk/prog/sensors/chips.c

    r6007 r6008  
    506506        { SENSORS_SUBFEATURE_POWER_INPUT_LOWEST, NULL, 0, "lowest" }, 
    507507        { SENSORS_SUBFEATURE_POWER_INPUT_HIGHEST, NULL, 0, "highest" }, 
     508        { SENSORS_SUBFEATURE_POWER_AVERAGE, NULL, 0, "avg" }, 
     509        { SENSORS_SUBFEATURE_POWER_AVERAGE_LOWEST, NULL, 0, "avg lowest" }, 
     510        { SENSORS_SUBFEATURE_POWER_AVERAGE_HIGHEST, NULL, 0, "avg highest" }, 
     511        { SENSORS_SUBFEATURE_POWER_AVERAGE_INTERVAL, NULL, 0, 
     512                "interval" }, 
    508513        { -1, NULL, 0, NULL } 
    509514}; 
     
    517522}; 
    518523 
    519 #define MAX(a, b) ((a) > (b) ? (a) : (b)) 
    520524#define NUM_POWER_ALARMS        4 
    521525#define NUM_POWER_SENSORS       (ARRAY_SIZE(power_common_sensors) \ 
    522                                  + MAX(ARRAY_SIZE(power_inst_sensors), \ 
    523                                        ARRAY_SIZE(power_avg_sensors)) \ 
     526                                 + ARRAY_SIZE(power_inst_sensors) \ 
    524527                                 - NUM_POWER_ALARMS - 2) 
    525528 
     
    547550        sensor_count = alarm_count = 0; 
    548551 
    549         /* Power sensors come in 2 flavors: instantaneous and averaged. 
    550            To keep things simple, we assume that each sensor only implements 
    551            one flavor. */ 
     552        /* 
     553         * Power sensors come in 2 flavors: instantaneous and averaged. 
     554         * Most devices only support one flavor, so we try to display the 
     555         * average power if the instantaneous power attribute does not exist. 
     556         * If both instantaneous power and average power are supported, 
     557         * average power is displayed as limit. 
     558         */ 
    552559        sf = sensors_get_subfeature(name, feature, 
    553560                                    SENSORS_SUBFEATURE_POWER_INPUT);