Created
April 23, 2014 02:55
-
-
Save anonymous/11201423 to your computer and use it in GitHub Desktop.
cpus
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extern crate libc; | |
macro_rules! trace( | |
($($arg:tt)*) => ( | |
{ let x = ::std::io::stdout().write_line(format_args!(::std::fmt::format, $($arg)*)); println!("{}", x); } | |
); | |
) | |
pub fn num_cpus() -> uint { | |
unsafe { | |
return rust_get_num_cpus(); | |
} | |
extern { | |
fn rust_get_num_cpus() -> libc::uintptr_t; | |
} | |
} | |
#[test] | |
fn test_this_thing() { | |
trace!("Cpus: {}", num_cpus()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment