Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,15 +158,15 @@ For a detailed output of the results, please enable the corresponding flag like:
## Group config file

Databroker-perf creates two new gRPC channels for each group: one for the provider and one for the subscriber.
Each provider will update its group signal values to the Databroker at the cycle time specified (in milliseconds) in the JSON configuration file provided.
Each provider will update its group signal values to the Databroker at the cycle time specified (in microseconds) in the JSON configuration file provided.

i. e.
```
{
"groups": [
{
"group_name": "Frame 1",
"cycle_time_ms": 10,
"cycle_time_microseconds": 1000,
"signals": [
{
"path": "Vehicle.Speed"
Expand All @@ -175,7 +175,7 @@ i. e.
},
{
"group_name": "Frame 2",
"cycle_time_ms": 20,
"cycle_time_microseconds": 2000,
"signals": [
{
"path": "Vehicle.IsBrokenDown"
Expand Down
2 changes: 1 addition & 1 deletion data/data_group_1.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"groups": [
{
"group_name": "Frame 1",
"cycle_time_ms": 10,
"cycle_time_microseconds": 500,
"signals": [
{
"path": "Vehicle.Speed"
Expand Down
20 changes: 10 additions & 10 deletions data/data_group_10.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"groups": [
{
"group_name": "Frame 1",
"cycle_time_ms": 10,
"cycle_time_microseconds": 200,
"signals": [
{
"path": "Vehicle.Speed"
Expand All @@ -11,7 +11,7 @@
},
{
"group_name": "Frame 2",
"cycle_time_ms": 20,
"cycle_time_microseconds": 300,
"signals": [
{
"path": "Vehicle.IsBrokenDown"
Expand All @@ -26,7 +26,7 @@
},
{
"group_name": "Frame 3",
"cycle_time_ms": 30,
"cycle_time_microseconds": 400,
"signals": [
{
"path": "Vehicle.Powertrain.CombustionEngine.MAP"
Expand All @@ -44,7 +44,7 @@
},
{
"group_name": "Frame 4",
"cycle_time_ms": 40,
"cycle_time_microseconds": 500,
"signals": [
{
"path": "Vehicle.Body.Windshield.Front.Wiping.System.IsWiping"
Expand All @@ -62,7 +62,7 @@
},
{
"group_name": "Frame 5",
"cycle_time_ms": 50,
"cycle_time_microseconds": 600,
"signals": [
{
"path": "Vehicle.Body.Windshield.Front.Wiping.System.IsBlocked"
Expand All @@ -80,7 +80,7 @@
},
{
"group_name": "Frame 6",
"cycle_time_ms": 60,
"cycle_time_microseconds": 700,
"signals": [
{
"path": "Vehicle.Body.Windshield.Front.WasherFluid.Level"
Expand All @@ -101,7 +101,7 @@
},
{
"group_name": "Frame 7",
"cycle_time_ms": 70,
"cycle_time_microseconds": 800,
"signals": [
{
"path": "Vehicle.Body.Windshield.Rear.Wiping.System.IsPositionReached"
Expand All @@ -122,7 +122,7 @@
},
{
"group_name": "Frame 8",
"cycle_time_ms": 80,
"cycle_time_microseconds": 900,
"signals": [
{
"path": "Vehicle.Body.Windshield.Front.Wiping.System.TargetPosition"
Expand All @@ -143,7 +143,7 @@
},
{
"group_name": "Frame 9",
"cycle_time_ms": 90,
"cycle_time_microseconds": 1000,
"signals": [
{
"path": "Vehicle.Body.Windshield.Rear.Wiping.System.TargetPosition"
Expand All @@ -170,7 +170,7 @@
},
{
"group_name": "Frame 10",
"cycle_time_ms": 100,
"cycle_time_microseconds": 1100,
"signals": [
{
"path": "Vehicle.Body.Lights.Backup.IsOn"
Expand Down
10 changes: 2 additions & 8 deletions data/data_group_2.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"groups": [
{
"group_name": "Frame 1",
"cycle_time_ms": 10,
"cycle_time_microseconds": 500,
"signals": [
{
"path": "Vehicle.Speed"
Expand All @@ -11,16 +11,10 @@
},
{
"group_name": "Frame 2",
"cycle_time_ms": 20,
"cycle_time_microseconds": 1000,
"signals": [
{
"path": "Vehicle.IsBrokenDown"
},
{
"path": "Vehicle.IsMoving"
},
{
"path": "Vehicle.AverageSpeed"
}
]
}
Expand Down
6 changes: 3 additions & 3 deletions data/data_group_3.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"groups": [
{
"group_name": "Frame 1",
"cycle_time_ms": 10,
"cycle_time_microseconds": 500,
"signals": [
{
"path": "Vehicle.Speed"
Expand All @@ -11,7 +11,7 @@
},
{
"group_name": "Frame 2",
"cycle_time_ms": 20,
"cycle_time_microseconds": 1000,
"signals": [
{
"path": "Vehicle.IsBrokenDown"
Expand All @@ -26,7 +26,7 @@
},
{
"group_name": "Frame 3",
"cycle_time_ms": 30,
"cycle_time_microseconds": 1500,
"signals": [
{
"path": "Vehicle.Powertrain.CombustionEngine.MAP"
Expand Down
2 changes: 1 addition & 1 deletion src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pub struct Config {
#[derive(Deserialize, Clone)]
pub struct Group {
pub group_name: String,
pub cycle_time_ms: u16,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of hardcoding it to either ms or microseconds (and choosing between a u16 and u32), it would be better to store it as a Duration. That's what we want in the end anyway, and would make it equally easy to set with either milliseconds, microseconds or anything else as input.

pub cycle_time_microseconds: u32,
pub signals: Vec<Signal>,
}
#[derive(Deserialize, Clone)]
Expand Down
6 changes: 3 additions & 3 deletions src/measure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ pub struct MeasurementConfig {
pub host: String,
pub port: u64,
pub duration: Option<u64>,
pub interval: u16,
pub interval: u32,
pub skip_seconds: Option<u64>,
pub api: Api,
pub detailed_output: bool,
Expand Down Expand Up @@ -212,7 +212,7 @@ pub async fn perform_measurement(
// Create MeasurmentContext for each group
let mut measurement_config = measurement_config.clone();

measurement_config.interval = group.cycle_time_ms;
measurement_config.interval = group.cycle_time_microseconds;

let hist = Histogram::<u64>::new_with_bounds(1, 60 * 60 * 1000 * 1000, 3)?;
let running_hist = Histogram::<u64>::new_with_bounds(1, 60 * 60 * 1000 * 1000, 3)?;
Expand Down Expand Up @@ -351,7 +351,7 @@ async fn measurement_loop(ctx: &mut MeasurementContext) -> Result<(u64, u64)> {
let mut interval_to_run = if ctx.measurement_config.interval == 0 {
None
} else {
Some(tokio::time::interval(Duration::from_millis(
Some(tokio::time::interval(Duration::from_micros(
ctx.measurement_config.interval.into(),
)))
};
Expand Down
6 changes: 3 additions & 3 deletions src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,21 +45,21 @@ pub fn read_config(config_file: Option<&String>) -> Result<Vec<Group>> {
Ok(vec![
Group {
group_name: String::from("Group A"),
cycle_time_ms: 0,
cycle_time_microseconds: 0,
signals: vec![Signal {
path: String::from("Vehicle.Speed"),
}],
},
Group {
group_name: String::from("Group B"),
cycle_time_ms: 0,
cycle_time_microseconds: 0,
signals: vec![Signal {
path: String::from("Vehicle.IsBrokenDown"),
}],
},
Group {
group_name: String::from("Group C"),
cycle_time_ms: 0,
cycle_time_microseconds: 0,
signals: vec![
Signal {
path: String::from("Vehicle.Body.Windshield.Front.Wiping.Intensity"),
Expand Down