mirror of
https://github.com/plasma-umass/coz.git
synced 2024-09-11 04:55:25 +03:00
Added toy in Rust
This commit is contained in:
parent
a7a29361fb
commit
ecf5b50b0d
32
benchmarks/toy-rs/Cargo.lock
generated
Normal file
32
benchmarks/toy-rs/Cargo.lock
generated
Normal file
@ -0,0 +1,32 @@
|
||||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
version = 3
|
||||
|
||||
[[package]]
|
||||
name = "coz"
|
||||
version = "0.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cef55b3fe2f5477d59e12bc792e8b3c95a25bd099eadcfae006ecea136de76e2"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"once_cell",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.131"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "04c3b4822ccebfa39c02fc03d1534441b22ead323fa0f48bb7ddd8e6ba076a40"
|
||||
|
||||
[[package]]
|
||||
name = "once_cell"
|
||||
version = "1.13.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "18a6dbe30758c9f83eb00cbea4ac95966305f5a7772f3f42ebfc7fc7eddbd8e1"
|
||||
|
||||
[[package]]
|
||||
name = "toy-rs"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"coz",
|
||||
]
|
9
benchmarks/toy-rs/Cargo.toml
Normal file
9
benchmarks/toy-rs/Cargo.toml
Normal file
@ -0,0 +1,9 @@
|
||||
[package]
|
||||
name = "toy-rs"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
coz = "0.1"
|
21
benchmarks/toy-rs/src/main.rs
Normal file
21
benchmarks/toy-rs/src/main.rs
Normal file
@ -0,0 +1,21 @@
|
||||
#[allow(unused)]
|
||||
use coz;
|
||||
use std::thread;
|
||||
#[no_mangle]
|
||||
pub fn a_first_fn() {
|
||||
for _x in 0..2000000000 {}
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub fn b_second_fn() {
|
||||
for _y in 0..1900000000 {}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let handle1 = thread::spawn(|| a_first_fn());
|
||||
let handle2 = thread::spawn(|| b_second_fn());
|
||||
|
||||
handle1.join().unwrap();
|
||||
handle2.join().unwrap();
|
||||
coz::progress!();
|
||||
}
|
Loading…
Reference in New Issue
Block a user