Skip to main content

dope_core/
profile.rs

1use std::time::Duration;
2
3pub trait Profile: 'static {
4    const RING_ENTRIES: u32;
5    const HYBRID_PARK: bool;
6    const DEFER_TASKRUN: bool;
7
8    const TASK_BUDGET: Option<usize>;
9    const IDLE_PARK: Option<Duration>;
10
11    const ACTIVE_WINDOW: Duration;
12    const ACTIVE_PARK_TIMEOUT: Duration;
13    const IDLE_PARK_TIMEOUT: Duration;
14}
15
16#[derive(Debug)]
17pub struct Throughput;
18
19impl Profile for Throughput {
20    const RING_ENTRIES: u32 = 4096;
21    const HYBRID_PARK: bool = true;
22    const DEFER_TASKRUN: bool = true;
23
24    const TASK_BUDGET: Option<usize> = None;
25    const IDLE_PARK: Option<Duration> = None;
26
27    const ACTIVE_WINDOW: Duration = Duration::from_millis(2);
28    const ACTIVE_PARK_TIMEOUT: Duration = Duration::from_millis(10);
29    const IDLE_PARK_TIMEOUT: Duration = Duration::from_millis(50);
30}
31
32#[derive(Debug)]
33pub struct Tail;
34
35impl Profile for Tail {
36    const RING_ENTRIES: u32 = 2048;
37    const HYBRID_PARK: bool = false;
38    const DEFER_TASKRUN: bool = false;
39
40    const TASK_BUDGET: Option<usize> = Some(64);
41    const IDLE_PARK: Option<Duration> = Some(Duration::from_micros(200));
42
43    const ACTIVE_WINDOW: Duration = Duration::from_millis(8);
44    const ACTIVE_PARK_TIMEOUT: Duration = Duration::from_micros(250);
45    const IDLE_PARK_TIMEOUT: Duration = Duration::from_millis(2);
46}