source: benchmark/creation/rust_thrd.rs @ 7a15b7e

ADTast-experimentalenumforall-pointer-decaypthread-emulationqualifiedEnum
Last change on this file since 7a15b7e was b4107c8, checked in by Peter A. Buhr <pabuhr@…>, 5 years ago

update existing benchmarks for changes to bench.h, add new benchmarks in new programming languages

  • Property mode set to 100644
File size: 594 bytes
Line 
1use std::env;
2use std::process;
3use std::thread;
4use std::time::Instant;
5
6fn main() {
7        let mut times : u32 = 250000;
8        let args: Vec<String> = env::args().collect();
9        if args.len() > 2 { process::exit( 1 ); }
10        if args.len() == 2 { times = args[1].parse().unwrap(); }
11
12        let start = Instant::now();
13        for _ in 1..times {
14                let th = thread::spawn( move || {});
15                th.join().unwrap();
16        }
17        let duration = start.elapsed() / times;
18        println!( "{:?}", duration.as_nanos() )
19}
20
21// Local Variables: //
22// mode: c++ //
23// tab-width: 4 //
24// compile-command: "rustc -C opt-level=3 rust_thrd.rs" //
25// End: //
Note: See TracBrowser for help on using the repository browser.