Skip to content

Commit

Permalink
Send metric to matching address
Browse files Browse the repository at this point in the history
Use [rntimatcher.gen] thread to send [model]-computed metrics to
the same address as the traffic pattern is sent to.

* Add Matching parameter: matching_log_traffic<bool>
* Add MetricTypes::A and MetricA struct
* Add metric header definition
* Pass reader for metric updates to [rntimatcher.gen]
  • Loading branch information
bastian-src committed Jun 24, 2024
1 parent 80988c2 commit c68c46e
Show file tree
Hide file tree
Showing 5 changed files with 179 additions and 31 deletions.
14 changes: 13 additions & 1 deletion src/logic/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -256,9 +256,21 @@ pub struct MessageRnti {
cell_rnti: HashMap<u64, u16>,
}

/* Wrapping messages */
#[allow(dead_code)]
#[derive(Clone, Debug, PartialEq, Default)]
#[derive(Clone, Debug, PartialEq)]
pub struct MessageMetric {
metric: MetricTypes,
}

#[derive(Clone, Copy, Debug, PartialEq)]
pub enum MetricTypes {
A(MetricA),
}

#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct MetricA {
/// Timestamp when the metric was calculated (not sent!)
timestamp_us: u64,
/// Fair share send rate [bits/subframe] = [bits/ms]
Expand Down
18 changes: 15 additions & 3 deletions src/logic/model_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ use crate::logic::{
};
use crate::util::determine_process_id;

use super::{MetricA, MetricTypes};

pub struct ModelHandlerArgs {
pub rx_app_state: BusReader<MainState>,
pub tx_model_state: SyncSender<ModelState>,
Expand Down Expand Up @@ -58,7 +60,7 @@ fn run(
rx_cell_info: &mut BusReader<MessageCellInfo>,
rx_dci: &mut BusReader<MessageDci>,
rx_rnti: &mut BusReader<MessageRnti>,
_tx_metric: &mut Bus<MessageMetric>,
tx_metric: &mut Bus<MessageMetric>,
) -> Result<()> {
tx_model_state.send(ModelState::Running)?;
wait_for_running(&mut rx_app_state, &tx_model_state)?;
Expand Down Expand Up @@ -99,8 +101,18 @@ fn run(
}
}

// TODO: -> Send combined message to some remote
// tx_metrc.send(metrics)
/* Test sending data */
tx_metric.broadcast(MessageMetric {
metric: MetricTypes::A(MetricA {
timestamp_us: 121,
fair_share_send_rate: 121231,
})
});
// TODO: Implement sending metric
// * Send combined message to remote properly
// * Add input parameter to choose metric type and sending interval (or more like a "how
// many subframes shall I use)

}

send_final_state(&tx_model_state)?;
Expand Down
Loading

0 comments on commit c68c46e

Please sign in to comment.