Skip to content

Commit

Permalink
Rename sample rate to sample interval
Browse files Browse the repository at this point in the history
  • Loading branch information
Zoxc committed Aug 20, 2024
1 parent e8add4d commit d37e85d
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 44 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ This file lists the changes that have occurred since January 2024 in the project
* Allow building of a server-only binary
* Generated files will use a YYYY-MM-DD HH.MM.SS format
* Rename bandwidth to throughput
* Rename sample rate to sample interval

## 0.0.12 - 2024-07-31

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,9 @@ crusader remote
* **`--grace-duration <SECONDS>`**
The idle time between each test
[default: 1.0]
* **`--latency-sample-rate <MILLISECONDS>`**
* **`--latency-sample-interval <MILLISECONDS>`**
[default: 5.0]
* **`--throughput-sample-rate <MILLISECONDS>`**
* **`--throughput-sample-interval <MILLISECONDS>`**
[default: 20.0]
* **`--plot-transferred`**
Plot transferred bytes
Expand Down
60 changes: 34 additions & 26 deletions src/crusader-gui-lib/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,15 @@ enum Tab {
pub struct LatencyMonitorSettings {
pub server: String,
pub history: f64,
pub latency_sample_rate: u64,
pub latency_sample_interval: u64,
}

impl Default for LatencyMonitorSettings {
fn default() -> Self {
Self {
server: "localhost".to_owned(),
history: 60.0,
latency_sample_rate: 5,
latency_sample_interval: 5,
}
}
}
Expand All @@ -109,8 +109,8 @@ pub struct ClientSettings {
pub load_duration: f64,
pub grace_duration: f64,
pub stream_stagger: f64,
pub latency_sample_rate: u64,
pub throughput_sample_rate: u64,
pub latency_sample_interval: u64,
pub throughput_sample_interval: u64,
pub latency_peer: bool,
pub latency_peer_server: String,
}
Expand All @@ -126,8 +126,8 @@ impl Default for ClientSettings {
load_duration: 5.0,
grace_duration: 1.0,
stream_stagger: 0.0,
latency_sample_rate: 5,
throughput_sample_rate: 20,
latency_sample_interval: 5,
throughput_sample_interval: 20,
latency_peer: false,
latency_peer_server: String::new(),
}
Expand Down Expand Up @@ -405,8 +405,10 @@ impl Tester {
download: self.settings.client.download,
upload: self.settings.client.upload,
both: self.settings.client.both,
ping_interval: Duration::from_millis(self.settings.client.latency_sample_rate),
throughput_interval: Duration::from_millis(self.settings.client.throughput_sample_rate),
ping_interval: Duration::from_millis(self.settings.client.latency_sample_interval),
throughput_interval: Duration::from_millis(
self.settings.client.throughput_sample_interval,
),
}
}

Expand Down Expand Up @@ -557,18 +559,20 @@ impl Tester {
);
ui.label("seconds");
ui.end_row();
ui.label("Latency sample rate:");
ui.label("Latency sample interval:");
ui.add(
egui::DragValue::new(&mut self.settings.client.latency_sample_rate)
.range(1..=1000)
.speed(0.05),
egui::DragValue::new(
&mut self.settings.client.latency_sample_interval,
)
.range(1..=1000)
.speed(0.05),
);
ui.label("milliseconds");
ui.end_row();
ui.label("Throughput sample rate:");
ui.label("Throughput sample interval:");
ui.add(
egui::DragValue::new(
&mut self.settings.client.throughput_sample_rate,
&mut self.settings.client.throughput_sample_interval,
)
.range(1..=1000)
.speed(0.05),
Expand Down Expand Up @@ -609,11 +613,13 @@ impl Tester {
ui.label("seconds");
ui.label("");

ui.label("Latency sample rate:");
ui.label("Latency sample interval:");
ui.add(
egui::DragValue::new(&mut self.settings.client.latency_sample_rate)
.range(1..=1000)
.speed(0.05),
egui::DragValue::new(
&mut self.settings.client.latency_sample_interval,
)
.range(1..=1000)
.speed(0.05),
);
ui.label("milliseconds");
ui.end_row();
Expand All @@ -628,10 +634,10 @@ impl Tester {
);
ui.label("seconds");
ui.label("");
ui.label("Throughput sample rate:");
ui.label("Throughput sample interval:");
ui.add(
egui::DragValue::new(
&mut self.settings.client.throughput_sample_rate,
&mut self.settings.client.throughput_sample_interval,
)
.range(1..=1000)
.speed(0.05),
Expand Down Expand Up @@ -1264,7 +1270,7 @@ impl Tester {
let ctx_ = ctx.clone();
let data = Arc::new(latency::Data::new(
((self.settings.latency_monitor.history * 1000.0)
/ self.settings.latency_monitor.latency_sample_rate as f64)
/ self.settings.latency_monitor.latency_sample_interval as f64)
.round() as usize,
Arc::new(move || {
ctx_.request_repaint();
Expand All @@ -1276,7 +1282,7 @@ impl Tester {
latency::Config {
port: protocol::PORT,
ping_interval: Duration::from_millis(
self.settings.latency_monitor.latency_sample_rate,
self.settings.latency_monitor.latency_sample_interval,
),
},
&self.settings.latency_monitor.server,
Expand Down Expand Up @@ -1328,11 +1334,13 @@ impl Tester {
);
ui.label("seconds");
ui.end_row();
ui.label("Latency sample rate:");
ui.label("Latency sample interval:");
ui.add(
egui::DragValue::new(&mut self.settings.latency_monitor.latency_sample_rate)
.range(1..=1000)
.speed(0.05),
egui::DragValue::new(
&mut self.settings.latency_monitor.latency_sample_interval,
)
.range(1..=1000)
.speed(0.05),
);
ui.label("milliseconds");
});
Expand Down
12 changes: 6 additions & 6 deletions src/crusader-lib/src/remote.html
Original file line number Diff line number Diff line change
Expand Up @@ -102,17 +102,17 @@ <h1>Crusader Remote Client</h1>
for="upload">Upload</label></td>
<td>Load duration:</td>
<td class="tspacer"><input type="number" v-model="config.load_duration"> seconds</td>
<td>Latency sample rate:</td>
<td><input type="number" v-model="config.latency_sample_rate"> milliseconds
<td>Latency sample interval:</td>
<td><input type="number" v-model="config.latency_sample_interval"> milliseconds
</td>
</tr>
<tr>
<td class="tspacer"><input type="checkbox" v-model="config.both" id="both"><label
for="both">Both</label></td>
<td>Grace duration:</td>
<td class="tspacer"><input type="number" v-model="config.grace_duration"> seconds</td>
<td>Throughput sample rate:</td>
<td><input type="number" v-model="config.throughput_sample_rate">
<td>Throughput sample interval:</td>
<td><input type="number" v-model="config.throughput_sample_interval">
milliseconds</td>
</tr>
</table>
Expand Down Expand Up @@ -157,8 +157,8 @@ <h1 style="margin-top: auto; margin-bottom: auto;">Result {{ time.replaceAll("-"
stream_stagger: 0,
load_duration: 5,
grace_duration: 1,
latency_sample_rate: 5,
throughput_sample_rate: 20,
latency_sample_interval: 5,
throughput_sample_interval: 20,
latency_peer: {
enabled: false,
value: "",
Expand Down
8 changes: 4 additions & 4 deletions src/crusader-lib/src/remote.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ struct TestArgs {
load_duration: f64,

grace_duration: f64,
latency_sample_rate: u64,
throughput_sample_rate: u64,
latency_sample_interval: u64,
throughput_sample_interval: u64,
latency_peer: Option<String>,
}

Expand All @@ -84,8 +84,8 @@ async fn handle_client(
download: args.download,
upload: args.upload,
both: args.both,
ping_interval: Duration::from_millis(args.latency_sample_rate),
throughput_interval: Duration::from_millis(args.throughput_sample_rate),
ping_interval: Duration::from_millis(args.latency_sample_interval),
throughput_interval: Duration::from_millis(args.throughput_sample_interval),
};

(state.msg)(&format!("Remote client ({}) test started", who.ip()));
Expand Down
12 changes: 6 additions & 6 deletions src/crusader/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,9 @@ enum Commands {
)]
grace_duration: f64,
#[arg(long, default_value_t = 5, value_name = "MILLISECONDS")]
latency_sample_rate: u64,
latency_sample_interval: u64,
#[arg(long, default_value_t = 20, value_name = "MILLISECONDS")]
throughput_sample_rate: u64,
throughput_sample_interval: u64,
#[command(flatten)]
plot: PlotArgs,
#[arg(
Expand Down Expand Up @@ -155,8 +155,8 @@ fn run() -> Result<(), anyhow::Error> {
upload,
both,
idle,
throughput_sample_rate,
latency_sample_rate,
throughput_sample_interval,
latency_sample_interval,
ref plot,
port,
streams,
Expand All @@ -174,8 +174,8 @@ fn run() -> Result<(), anyhow::Error> {
download: !idle,
upload: !idle,
both: !idle,
ping_interval: Duration::from_millis(latency_sample_rate),
throughput_interval: Duration::from_millis(throughput_sample_rate),
ping_interval: Duration::from_millis(latency_sample_interval),
throughput_interval: Duration::from_millis(throughput_sample_interval),
};

if download || upload || both {
Expand Down

0 comments on commit d37e85d

Please sign in to comment.