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