in src/app.rs [205:268]
fn create_datasets(&self, state: AppState) -> HashMap<String, Vec<(f64, f64)>> {
let token_throughput_rate = state
.results
.iter()
.filter_map(|r| match r.executor_type() {
ExecutorType::ConstantArrivalRate => {
let throughput = r.token_throughput_secs().unwrap_or(0.0);
Some((r.executor_config().rate.unwrap(), throughput))
}
ExecutorType::ConstantVUs => None,
})
.collect::<Vec<_>>();
let token_throughput_vus = state
.results
.iter()
.filter_map(|r| match r.executor_type() {
ExecutorType::ConstantVUs => {
let throughput = r.token_throughput_secs().unwrap_or(0.0);
Some((r.executor_config().max_vus as f64, throughput))
}
ExecutorType::ConstantArrivalRate => None,
})
.collect::<Vec<_>>();
let inter_token_latency_rate = state
.results
.iter()
.filter_map(|r| match r.executor_type() {
ExecutorType::ConstantArrivalRate => {
let latency = r
.inter_token_latency_avg()
.unwrap_or_default()
.as_secs_f64();
Some((r.executor_config().rate.unwrap(), latency))
}
ExecutorType::ConstantVUs => None,
})
.collect::<Vec<_>>();
let inter_token_latency_vus = state
.results
.iter()
.filter_map(|r| match r.executor_type() {
ExecutorType::ConstantVUs => {
let latency = r
.inter_token_latency_avg()
.unwrap_or_default()
.as_secs_f64();
Some((r.executor_config().max_vus as f64, latency))
}
ExecutorType::ConstantArrivalRate => None,
})
.collect::<Vec<_>>();
HashMap::from([
("token_throughput_rate".to_string(), token_throughput_rate),
("token_throughput_vus".to_string(), token_throughput_vus),
(
"inter_token_latency_rate".to_string(),
inter_token_latency_rate,
),
(
"inter_token_latency_vus".to_string(),
inter_token_latency_vus,
),
])
}