1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
use std::env;
#[derive(Debug)]
pub enum Event {
Tickle { worker: usize, old_state: usize },
GetSleepy { worker: usize, state: usize },
GotSleepy { worker: usize, old_state: usize, new_state: usize },
GotAwoken { worker: usize },
FellAsleep { worker: usize },
GotInterrupted { worker: usize },
FoundWork { worker: usize, yields: usize },
DidNotFindWork { worker: usize, yields: usize },
StoleWork { worker: usize, victim: usize },
UninjectedWork { worker: usize },
WaitUntil { worker: usize },
LatchSet { worker: usize },
InjectJobs { count: usize },
Join { worker: usize },
PoppedJob { worker: usize },
PoppedRhs { worker: usize },
LostJob { worker: usize },
JobCompletedOk { owner_thread: usize },
JobPanickedErrorStored { owner_thread: usize },
JobPanickedErrorNotStored { owner_thread: usize },
ScopeCompletePanicked { owner_thread: usize },
ScopeCompleteNoPanic { owner_thread: usize },
}
pub const DUMP_LOGS: bool = cfg!(debug_assertions);
lazy_static! {
pub static ref LOG_ENV: bool = env::var("RAYON_LOG").is_ok() || env::var("RAYON_RS_LOG").is_ok();
}
macro_rules! log {
($event:expr) => {
if ::log::DUMP_LOGS { if *::log::LOG_ENV { println!("{:?}", $event); } }
}
}