File: toy.rs

package info (click to toggle)
coz-profiler 0.2.2-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye
  • size: 22,528 kB
  • sloc: ansic: 188,045; javascript: 20,133; cpp: 6,852; makefile: 214; python: 118; sh: 88
file content (21 lines) | stat: -rw-r--r-- 450 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
const A: usize = 2_000_000_000;
const B: usize = (A as f64 * 1.2) as usize;

fn main() {
    coz::thread_init();

    let a = std::thread::spawn(move || {
        coz::thread_init();
        for _ in 0..A {
            coz::progress!("a");
        }
    });
    let b = std::thread::spawn(move || {
        coz::thread_init();
        for _ in 0..B {
            coz::progress!("b");
        }
    });
    a.join().unwrap();
    b.join().unwrap();
}