1 | //! This file contains mocks of the types in src/runtime/metrics |
2 | |
3 | use std::thread::ThreadId; |
4 | |
5 | pub(crate) struct SchedulerMetrics {} |
6 | |
7 | pub(crate) struct WorkerMetrics {} |
8 | |
9 | pub(crate) struct MetricsBatch {} |
10 | |
11 | #[derive (Clone, Default)] |
12 | pub(crate) struct HistogramBuilder {} |
13 | |
14 | impl SchedulerMetrics { |
15 | pub(crate) fn new() -> Self { |
16 | Self {} |
17 | } |
18 | |
19 | /// Increment the number of tasks scheduled externally |
20 | pub(crate) fn inc_remote_schedule_count(&self) {} |
21 | } |
22 | |
23 | impl WorkerMetrics { |
24 | pub(crate) fn new() -> Self { |
25 | Self {} |
26 | } |
27 | |
28 | pub(crate) fn from_config(config: &crate::runtime::Config) -> Self { |
29 | // Prevent the dead-code warning from being triggered |
30 | let _ = &config.metrics_poll_count_histogram; |
31 | Self::new() |
32 | } |
33 | |
34 | pub(crate) fn set_queue_depth(&self, _len: usize) {} |
35 | pub(crate) fn set_thread_id(&self, _thread_id: ThreadId) {} |
36 | } |
37 | |
38 | impl MetricsBatch { |
39 | pub(crate) fn new(_: &WorkerMetrics) -> Self { |
40 | Self {} |
41 | } |
42 | |
43 | pub(crate) fn submit(&mut self, _to: &WorkerMetrics, _mean_poll_time: u64) {} |
44 | pub(crate) fn about_to_park(&mut self) {} |
45 | pub(crate) fn unparked(&mut self) {} |
46 | pub(crate) fn inc_local_schedule_count(&mut self) {} |
47 | pub(crate) fn start_processing_scheduled_tasks(&mut self) {} |
48 | pub(crate) fn end_processing_scheduled_tasks(&mut self) {} |
49 | pub(crate) fn start_poll(&mut self) {} |
50 | pub(crate) fn end_poll(&mut self) {} |
51 | } |
52 | |
53 | cfg_rt_multi_thread! { |
54 | impl MetricsBatch { |
55 | pub(crate) fn incr_steal_count(&mut self, _by: u16) {} |
56 | pub(crate) fn incr_steal_operations(&mut self) {} |
57 | pub(crate) fn incr_overflow_count(&mut self) {} |
58 | } |
59 | } |
60 | |