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 { new() -> Self15 pub(crate) fn new() -> Self { 16 Self {} 17 } 18 19 /// Increment the number of tasks scheduled externally inc_remote_schedule_count(&self)20 pub(crate) fn inc_remote_schedule_count(&self) {} 21 } 22 23 impl WorkerMetrics { new() -> Self24 pub(crate) fn new() -> Self { 25 Self {} 26 } 27 from_config(config: &crate::runtime::Config) -> Self28 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 set_queue_depth(&self, _len: usize)34 pub(crate) fn set_queue_depth(&self, _len: usize) {} set_thread_id(&self, _thread_id: ThreadId)35 pub(crate) fn set_thread_id(&self, _thread_id: ThreadId) {} 36 } 37 38 impl MetricsBatch { new(_: &WorkerMetrics) -> Self39 pub(crate) fn new(_: &WorkerMetrics) -> Self { 40 Self {} 41 } 42 submit(&mut self, _to: &WorkerMetrics, _mean_poll_time: u64)43 pub(crate) fn submit(&mut self, _to: &WorkerMetrics, _mean_poll_time: u64) {} about_to_park(&mut self)44 pub(crate) fn about_to_park(&mut self) {} unparked(&mut self)45 pub(crate) fn unparked(&mut self) {} inc_local_schedule_count(&mut self)46 pub(crate) fn inc_local_schedule_count(&mut self) {} start_processing_scheduled_tasks(&mut self)47 pub(crate) fn start_processing_scheduled_tasks(&mut self) {} end_processing_scheduled_tasks(&mut self)48 pub(crate) fn end_processing_scheduled_tasks(&mut self) {} start_poll(&mut self)49 pub(crate) fn start_poll(&mut self) {} end_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