Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adaptive behavior for Linux #32

Open
svartalf opened this issue Jun 4, 2019 · 0 comments
Open

Adaptive behavior for Linux #32

svartalf opened this issue Jun 4, 2019 · 0 comments
Labels
A-battery Area: battery crate C-enhancement New feature or request O-linux Operating system: Linux
Milestone

Comments

@svartalf
Copy link
Owner

svartalf commented Jun 4, 2019

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.

@svartalf svartalf added C-enhancement New feature or request O-linux Operating system: Linux A-battery Area: battery crate labels Jun 4, 2019
@svartalf svartalf added this to the v0.8 milestone Jun 4, 2019
davidkna pushed a commit to davidkna/rust-battery that referenced this issue Jul 31, 2023
Bumps [Swatinem/rust-cache](https://github.com/Swatinem/rust-cache) from 2.3.0 to 2.4.0.
- [Release notes](https://github.com/Swatinem/rust-cache/releases)
- [Changelog](https://github.com/Swatinem/rust-cache/blob/master/CHANGELOG.md)
- [Commits](Swatinem/rust-cache@v2.3.0...v2.4.0)

---
updated-dependencies:
- dependency-name: Swatinem/rust-cache
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-battery Area: battery crate C-enhancement New feature or request O-linux Operating system: Linux
Projects
None yet
Development

No branches or pull requests

1 participant