Current Linux implementation is probing multiple files in order to fetch one specific value; for example, in order to get the design voltage parameter, four files will be opened consequently: "voltage_max_design", "voltage_min_design", "voltage_present" and the "voltage_now".
Even while all files are located at the sysfs filesystem and read operations from it are very quick, for a worse case scenario there will be three unnecessary open syscalls (assuming the Manager::refresh method calls, as battop does).
Battery instance should remember which file was opened successfully during the previous information update and should open it directly on a next "refresh" call.
Yet, it is important to remember that some Linux drivers can remove or add these files on a fly, so, in case of failure, consequent probing should be started again.
In a result, it should reduce syscalls amount vastly.
Current Linux implementation is probing multiple files in order to fetch one specific value; for example, in order to get the
design voltage
parameter, four files will be opened consequently: "voltage_max_design", "voltage_min_design", "voltage_present" and the "voltage_now".Even while all files are located at the
sysfs
filesystem and read operations from it are very quick, for a worse case scenario there will be three unnecessaryopen
syscalls (assuming theManager::refresh
method calls, asbattop
does).Battery
instance should remember which file was opened successfully during the previous information update and should open it directly on a next "refresh" call. Yet, it is important to remember that some Linux drivers can remove or add these files on a fly, so, in case of failure, consequent probing should be started again.In a result, it should reduce syscalls amount vastly.