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
50
51
52
53
54
55
56
57
58
59
60
61
62
#![deny(missing_docs)]
extern crate rayon;
extern crate time;
extern crate serde;
#[macro_use]
extern crate serde_derive;
#[macro_use]
extern crate itertools;
extern crate serde_json;
mod iterator;
mod storage;
pub use iterator::Logged;
mod pool;
pub use pool::{join, join_context, sequential_task, ThreadPool};
mod builder;
pub mod prelude;
pub use builder::ThreadPoolBuilder;
mod fork_join_graph;
pub use fork_join_graph::visualisation;
pub(crate) mod svg;
pub use {svg::fill_svg_file, svg::write_svg_file, svg::Rectangle};
mod log;
pub use log::{RunLog, TaskLog};
type TaskId = usize;
type IteratorId = usize;
type TimeStamp = u64;
#[derive(Debug, Serialize, Deserialize)]
enum RayonEvent {
TaskStart(TaskId, TimeStamp),
TaskEnd(TimeStamp),
Join(TaskId, TaskId, TaskId),
IteratorTask(TaskId, IteratorId, Option<(usize, usize)>, TaskId),
IteratorStart(IteratorId),
SequentialTask(TaskId, TaskId, usize, usize),
}
impl RayonEvent {
fn time(&self) -> u64 {
match *self {
RayonEvent::TaskStart(_, t) => t,
RayonEvent::TaskEnd(t) => t,
_ => 0,
}
}
}