mirror of
https://github.com/lm-sensors/lm-sensors
synced 2025-09-02 07:15:39 +00:00
sensors: Display both instantaneous and average power
Some sensor chips report both instantaneous and average power. Add support to display both. git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@6008 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
1
CHANGES
1
CHANGES
@@ -4,6 +4,7 @@ lm-sensors CHANGES file
|
|||||||
SVN HEAD
|
SVN HEAD
|
||||||
libsensors: Added support for new sysfs attributes
|
libsensors: Added support for new sysfs attributes
|
||||||
sensors: Added support for new sysfs attributes
|
sensors: Added support for new sysfs attributes
|
||||||
|
Display both instantaneous and average power if available.
|
||||||
fancontrol: Support setup where one PWM output controls several fans
|
fancontrol: Support setup where one PWM output controls several fans
|
||||||
Output error messages to stderr
|
Output error messages to stderr
|
||||||
sensors-detect: Stop calling for PIIX5 SMBus testers
|
sensors-detect: Stop calling for PIIX5 SMBus testers
|
||||||
|
@@ -505,6 +505,11 @@ static const struct sensor_subfeature_list power_common_sensors[] = {
|
|||||||
static const struct sensor_subfeature_list power_inst_sensors[] = {
|
static const struct sensor_subfeature_list power_inst_sensors[] = {
|
||||||
{ SENSORS_SUBFEATURE_POWER_INPUT_LOWEST, NULL, 0, "lowest" },
|
{ SENSORS_SUBFEATURE_POWER_INPUT_LOWEST, NULL, 0, "lowest" },
|
||||||
{ SENSORS_SUBFEATURE_POWER_INPUT_HIGHEST, NULL, 0, "highest" },
|
{ SENSORS_SUBFEATURE_POWER_INPUT_HIGHEST, NULL, 0, "highest" },
|
||||||
|
{ SENSORS_SUBFEATURE_POWER_AVERAGE, NULL, 0, "avg" },
|
||||||
|
{ SENSORS_SUBFEATURE_POWER_AVERAGE_LOWEST, NULL, 0, "avg lowest" },
|
||||||
|
{ SENSORS_SUBFEATURE_POWER_AVERAGE_HIGHEST, NULL, 0, "avg highest" },
|
||||||
|
{ SENSORS_SUBFEATURE_POWER_AVERAGE_INTERVAL, NULL, 0,
|
||||||
|
"interval" },
|
||||||
{ -1, NULL, 0, NULL }
|
{ -1, NULL, 0, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -516,11 +521,9 @@ static const struct sensor_subfeature_list power_avg_sensors[] = {
|
|||||||
{ -1, NULL, 0, NULL }
|
{ -1, NULL, 0, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
#define MAX(a, b) ((a) > (b) ? (a) : (b))
|
|
||||||
#define NUM_POWER_ALARMS 4
|
#define NUM_POWER_ALARMS 4
|
||||||
#define NUM_POWER_SENSORS (ARRAY_SIZE(power_common_sensors) \
|
#define NUM_POWER_SENSORS (ARRAY_SIZE(power_common_sensors) \
|
||||||
+ MAX(ARRAY_SIZE(power_inst_sensors), \
|
+ ARRAY_SIZE(power_inst_sensors) \
|
||||||
ARRAY_SIZE(power_avg_sensors)) \
|
|
||||||
- NUM_POWER_ALARMS - 2)
|
- NUM_POWER_ALARMS - 2)
|
||||||
|
|
||||||
static void print_chip_power(const sensors_chip_name *name,
|
static void print_chip_power(const sensors_chip_name *name,
|
||||||
@@ -546,9 +549,13 @@ static void print_chip_power(const sensors_chip_name *name,
|
|||||||
|
|
||||||
sensor_count = alarm_count = 0;
|
sensor_count = alarm_count = 0;
|
||||||
|
|
||||||
/* Power sensors come in 2 flavors: instantaneous and averaged.
|
/*
|
||||||
To keep things simple, we assume that each sensor only implements
|
* Power sensors come in 2 flavors: instantaneous and averaged.
|
||||||
one flavor. */
|
* Most devices only support one flavor, so we try to display the
|
||||||
|
* average power if the instantaneous power attribute does not exist.
|
||||||
|
* If both instantaneous power and average power are supported,
|
||||||
|
* average power is displayed as limit.
|
||||||
|
*/
|
||||||
sf = sensors_get_subfeature(name, feature,
|
sf = sensors_get_subfeature(name, feature,
|
||||||
SENSORS_SUBFEATURE_POWER_INPUT);
|
SENSORS_SUBFEATURE_POWER_INPUT);
|
||||||
get_sensor_limit_data(name, feature,
|
get_sensor_limit_data(name, feature,
|
||||||
|
Reference in New Issue
Block a user