Skip to content

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.

1 participant