Checkpoint
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
[package]
|
||||
name = "cpu-cycle"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
libc = "0.2"
|
||||
@@ -0,0 +1,19 @@
|
||||
use libc::c_int;
|
||||
|
||||
#[link(name = "cpucycles")]
|
||||
extern "C" {
|
||||
fn cpucycles() -> c_int;
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use crate::cpucycles;
|
||||
|
||||
#[test]
|
||||
fn test_cpucycles() {
|
||||
unsafe {
|
||||
let cycles = cpucycles();
|
||||
println!("{cycles}")
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user