No harm in adding it.
Mark Kettenis <[email protected]> wrote: > The firmware on the POWER9 machines provides an energy sensor. This > sensor measures the energy on/in/at the chip. I'm not sure what that > actually means. But it is different from the energy content of a > battery which is measured in Watthours. > > Should I add this? Or should I just skip these sensors? > > Index: sbin/sysctl/sysctl.c > =================================================================== > RCS file: /cvs/src/sbin/sysctl/sysctl.c,v > retrieving revision 1.251 > diff -u -p -r1.251 sysctl.c > --- sbin/sysctl/sysctl.c 29 May 2020 04:42:23 -0000 1.251 > +++ sbin/sysctl/sysctl.c 14 Jul 2020 17:30:43 -0000 > @@ -2759,6 +2759,9 @@ print_sensor(struct sensor *s) > case SENSOR_VELOCITY: > printf("%4.3f m/s", s->value / 1000000.0); > break; > + case SENSOR_ENERGY: > + printf("%.2f J", s->value / 1000000.0); > + break; > default: > printf("unknown"); > } > Index: usr.bin/systat/sensors.c > =================================================================== > RCS file: /cvs/src/usr.bin/systat/sensors.c,v > retrieving revision 1.31 > diff -u -p -r1.31 sensors.c > --- usr.bin/systat/sensors.c 10 Dec 2018 13:35:54 -0000 1.31 > +++ usr.bin/systat/sensors.c 14 Jul 2020 17:30:43 -0000 > @@ -291,6 +291,9 @@ showsensor(struct sensinfo *s) > case SENSOR_VELOCITY: > tbprintf("%4.3f m/s", s->sn_value / 1000000.0); > break; > + case SENSOR_ENERGY: > + tbprintf("%.2f J", s->sn_value / 1000000.0); > + break; > default: > tbprintf("%10lld", s->sn_value); > break; > Index: sys/sys/sensors.h > =================================================================== > RCS file: /cvs/src/sys/sys/sensors.h,v > retrieving revision 1.36 > diff -u -p -r1.36 sensors.h > --- sys/sys/sensors.h 10 Dec 2018 13:35:54 -0000 1.36 > +++ sys/sys/sensors.h 14 Jul 2020 17:30:43 -0000 > @@ -53,6 +53,7 @@ enum sensor_type { > SENSOR_PRESSURE, /* pressure (mPa) */ > SENSOR_ACCEL, /* acceleration (u m/s^2) */ > SENSOR_VELOCITY, /* velocity (u m/s) */ > + SENSOR_ENERGY, /* energy (uJ) */ > SENSOR_MAX_TYPES > }; > > @@ -80,6 +81,7 @@ static const char * const sensor_type_s[ > "pressure", > "acceleration", > "velocity", > + "energy", > "undefined" > }; > #endif /* !_KERNEL */ >
