wgottwalt / corsair-psu

Linux hardware monitoring driver for Corsair RMi/HXi series power supplies with sensors USB interface (mainlined 5.11)
GNU General Public License v3.0
27 stars 3 forks source link

Maximum statistics of power consumption #7

Closed retunelars closed 1 year ago

retunelars commented 2 years ago

I was wondering if it would be possible to expose maximum statistics for relevant metrics, for example power consumption? This can of course be monitored via the hwmon files, but I assume that given the high frequency needed for this monitoring, it can be done better in the driver. Such a feature would be helpful in order to see the maximum power consumption observed in relation to the PSUs rated specification.

wgottwalt commented 2 years ago

I could do that, but there are three issues doing it that way:

  1. There is nothing in the hwmon system to collect such statistics and misusing hwmon for this would annoy other kernel developers. So I would provide it via debugfs, just like the uptimes.

  2. Data is only collected if the sysfs/debugfs entries are read, there is no continuously collecting going on. I can only update the statistics if the corresponding sysfs/debugfs entry is read. That also means you have to provide the "external tick" and this also means, you could do your own value comparison to find the max value.

  3. If I add that functionality it will go into the enhanced driver. There is no way this will be accepted into mainline, because that kind of work usually goes into userspace and has no place in kernelspace.

retunelars commented 2 years ago

Sounds like a good solution to me.

wgottwalt commented 2 years ago

I have to correct myself. The hwmon subsystem indeed includes mechanisms for statistical data. Though, for that I have to redesign the driver to some degree to add a tick (background task that triggers the sensors, lets say every second). For now I will commit the debugfs approach which also seems to work.

wgottwalt commented 1 year ago

I will try to add using of hwmon statistics to the enhanced driver, just a matter of time.