Skip to content

Add method to obtain useful system hardware information #2181

Description

@boggle

For implementing a new hash table, I'd like to know the size of cache lines. In general, we probably want a way to provide technical information like that in std (or perhaps even in core). For now, I'm just intending to add a sys info module that will have CACHE_LINE_SIZE and CACHE_LINE_BITS constants. I found some code for this on the internet and would like to know if it is ok LICENSE-wise to put "do-what-you-want-with-it-licensed C bits" like that into rust:

http://stackoverflow.com/questions/794632/programmatically-get-the-cache-line-size

Activity

  1. brson commented on Apr 11, 2012

    @brson
    Contributor

    I have copy-pasted snippets from stackoverflow before and put a link to the source in the comments.

  2. ghost assigned on Apr 12, 2012
  3. pnkfelix commented on Apr 25, 2013

    @pnkfelix
    Contributor

    Nominating for milestone.

    From reading the milestone descriptions, I suspect it is a match for Maturity Milestone 5: production ready. (One might be more aggressive and try to stuff it in e.g. "feature complete", but since a client should be able to express this themselves in native code as needed, I think it can wait for 5.)

  4. graydon commented on May 30, 2013

    @graydon
    Contributor

    just a bug, removing milestone/nomination.

  5. bblum commented on Aug 9, 2013

    @bblum
    Contributor

    I also think it would be useful to have a cacheline-aligned attribute for variables and for struct fields. Possibly even production-ready-worthy. Not sure if there's a separate issue for that; couldn't find one with a cursory search.

  6. huonw commented on Nov 15, 2013

    @huonw
    Contributor

    Triage: no progress.

  7. dan-c-underwood commented on Apr 2, 2014

    @dan-c-underwood

    I'm willing to take a look at implementing a libsys module to provide hardware information incl. cache (and ideally other information) if this enhancement would still be appreciated?

  8. steveklabnik commented on Jan 20, 2015

    @steveklabnik
    Contributor

    We're making the standard library smaller and smaller these days. Unless there's a particular reason why this would have to be in the language itself, this should be a Cargo package now.

  9. added a commit that references this issue on Jul 18, 2026
  10. added a commit that references this issue on Aug 21, 2026
    efa72c8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-enhancementCategory: An issue proposing an enhancement or a PR with one.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions