rust-lang / rust

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
96.62k stars 12.48k forks source link

Add method to obtain useful system hardware information #2181

Closed boggle closed 9 years ago

boggle commented 12 years ago

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

brson commented 12 years ago

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

pnkfelix commented 11 years ago

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.)

graydon commented 11 years ago

just a bug, removing milestone/nomination.

bblum commented 11 years ago

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.

huonw commented 10 years ago

Triage: no progress.

dan-c-underwood commented 10 years ago

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?

steveklabnik commented 9 years ago

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.