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

heim-cpu: fix glob pattern to support more than 10 cpus #366

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kaspar030
Copy link

@kaspar030 kaspar030 commented Mar 2, 2023

The previous glob pattern matched only single-digit CPU numbers. I stumbled across this because vector was not showing more than 10 (the ones that match 0-9) physical cpus using its "host_metrics" source.

As fix, the glob pattern is changed to this: devices/system/cpu/cpu*/topology/core_id.

Unfortunately glob::glob() doesn't support "one or more of this character" like a regex would.
So this fix only works until linux adds files that match cpu*/topology/core_id but not cpu[0-9]+/topology/core_id.
I consider that highly unlikely. But I there are ways to ensure this never bites us:

  • add a regex to filter the glob results
  • concatenate three globs: .../cpu[0]/..., .../cpu[0]/... and .../cpu[0][0][0]/...
  • added later switch to the globset crate, and add those three globs to a globset
  • other suggestions?

The previous glob pattern matched only single-digit CPU numbers.
Change to support any number.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant