use std::ops::Deref;
use super::counter_cell::CounterCell;
use super::hardware_counter::HardwareCounterCell;
#[derive(Copy, Clone)]
pub struct HwMetricRefCounter<'a> {
counter: &'a CounterCell,
}
impl<'a> HwMetricRefCounter<'a> {
fn new(counter: &'a CounterCell) -> Self {
Self { counter }
}
}
impl Deref for HwMetricRefCounter<'_> {
type Target = CounterCell;
fn deref(&self) -> &Self::Target {
self.counter
}
}
impl HardwareCounterCell {
#[inline]
pub fn ref_payload_io_write_counter(&self) -> HwMetricRefCounter<'_> {
HwMetricRefCounter::new(&self.payload_io_write_counter)
}
#[inline]
pub fn ref_payload_io_read_counter(&self) -> HwMetricRefCounter<'_> {
HwMetricRefCounter::new(&self.payload_io_read_counter)
}
#[inline]
pub fn ref_vector_io_write_counter(&self) -> HwMetricRefCounter<'_> {
HwMetricRefCounter::new(&self.vector_io_write_counter)
}
#[inline]
pub fn ref_payload_index_io_write_counter(&self) -> HwMetricRefCounter<'_> {
HwMetricRefCounter::new(&self.payload_index_io_write_counter)
}
}