cargo fmt
This commit is contained in:
parent
efc175b45b
commit
4eca032745
|
@ -4,7 +4,7 @@ BridgeLine::random() or private fields */
|
|||
use super::bridge_table::BridgeLine;
|
||||
use super::proto::*;
|
||||
use super::*;
|
||||
use chrono::{Utc, DateTime, NaiveTime, Timelike};
|
||||
use chrono::{DateTime, NaiveTime, Timelike, Utc};
|
||||
use rand::Rng;
|
||||
use statistical::{mean, standard_deviation};
|
||||
use std::collections::HashSet;
|
||||
|
@ -757,10 +757,10 @@ fn stats_test_trust_levels() {
|
|||
let mut open_resp_time: Vec<f64> = Vec::new();
|
||||
let mut open_resp_handle_time: Vec<f64> = Vec::new();
|
||||
for _ in 0..USERS {
|
||||
let h: NaiveTime = DateTime::time(&Utc::now());
|
||||
let h: NaiveTime = DateTime::time(&Utc::now());
|
||||
if h.hour() == 23 && h.minute() == 59 {
|
||||
println!("Wait for UTC 00:00");
|
||||
thread::sleep(Duration::new(60,0));
|
||||
thread::sleep(Duration::new(60, 0));
|
||||
println!("Ready to work again");
|
||||
}
|
||||
let (open_perf_stat, cred) = th.open_invite();
|
||||
|
@ -880,11 +880,11 @@ fn stats_test_invitations() {
|
|||
let mut red_resp_time: Vec<f64> = Vec::new();
|
||||
let mut red_resp_handle_time: Vec<f64> = Vec::new();
|
||||
for _ in 0..USERS {
|
||||
let h: NaiveTime = DateTime::time(&Utc::now());
|
||||
let h: NaiveTime = DateTime::time(&Utc::now());
|
||||
|
||||
if h.hour() == 23 && h.minute() == 59 {
|
||||
println!("Wait for UTC 00:00");
|
||||
thread::sleep(Duration::new(60,0));
|
||||
thread::sleep(Duration::new(60, 0));
|
||||
println!("Ready to work again");
|
||||
}
|
||||
let cred = th.open_invite().1 .0;
|
||||
|
@ -931,10 +931,10 @@ fn stats_test_percent_blockage_migration_05() {
|
|||
let mut th = TestHarness::new_buckets(x, x);
|
||||
let mut credentials: Vec<cred::Lox> = Vec::new();
|
||||
for _ in 0..USERS {
|
||||
let h: NaiveTime = DateTime::time(&Utc::now());
|
||||
let h: NaiveTime = DateTime::time(&Utc::now());
|
||||
if h.hour() == 23 && h.minute() == 59 {
|
||||
println!("Wait for UTC 00:00");
|
||||
thread::sleep(Duration::new(60,0));
|
||||
thread::sleep(Duration::new(60, 0));
|
||||
println!("Ready to work again");
|
||||
}
|
||||
let cred = th.open_invite().1 .0;
|
||||
|
@ -964,10 +964,10 @@ fn stats_test_percent_blockage_migration_010() {
|
|||
let mut th = TestHarness::new_buckets(x, x);
|
||||
let mut credentials: Vec<cred::Lox> = Vec::new();
|
||||
for _ in 0..USERS {
|
||||
let h: NaiveTime = DateTime::time(&Utc::now());
|
||||
let h: NaiveTime = DateTime::time(&Utc::now());
|
||||
if h.hour() == 23 && h.minute() == 59 {
|
||||
println!("Wait for UTC 00:00");
|
||||
thread::sleep(Duration::new(60,0));
|
||||
thread::sleep(Duration::new(60, 0));
|
||||
println!("Ready to work again");
|
||||
}
|
||||
let cred = th.open_invite().1 .0;
|
||||
|
@ -997,10 +997,10 @@ fn stats_test_percent_blockage_migration_15() {
|
|||
let mut th = TestHarness::new_buckets(x, x);
|
||||
let mut credentials: Vec<cred::Lox> = Vec::new();
|
||||
for _ in 0..USERS {
|
||||
let h: NaiveTime = DateTime::time(&Utc::now());
|
||||
let h: NaiveTime = DateTime::time(&Utc::now());
|
||||
if h.hour() == 23 && h.minute() == 59 {
|
||||
println!("Wait for UTC 00:00");
|
||||
thread::sleep(Duration::new(60,0));
|
||||
thread::sleep(Duration::new(60, 0));
|
||||
println!("Ready to work again");
|
||||
}
|
||||
let cred = th.open_invite().1 .0;
|
||||
|
@ -1030,10 +1030,10 @@ fn stats_test_percent_blockage_migration_20() {
|
|||
let mut th = TestHarness::new_buckets(x, x);
|
||||
let mut credentials: Vec<cred::Lox> = Vec::new();
|
||||
for _ in 0..USERS {
|
||||
let h: NaiveTime = DateTime::time(&Utc::now());
|
||||
let h: NaiveTime = DateTime::time(&Utc::now());
|
||||
if h.hour() == 23 && h.minute() == 59 {
|
||||
println!("Wait for UTC 00:00");
|
||||
thread::sleep(Duration::new(60,0));
|
||||
thread::sleep(Duration::new(60, 0));
|
||||
println!("Ready to work again");
|
||||
}
|
||||
let cred = th.open_invite().1 .0;
|
||||
|
@ -1063,10 +1063,10 @@ fn stats_test_percent_blockage_migration_25() {
|
|||
let mut th = TestHarness::new_buckets(x, x);
|
||||
let mut credentials: Vec<cred::Lox> = Vec::new();
|
||||
for _ in 0..USERS {
|
||||
let h: NaiveTime = DateTime::time(&Utc::now());
|
||||
let h: NaiveTime = DateTime::time(&Utc::now());
|
||||
if h.hour() == 23 && h.minute() == 59 {
|
||||
println!("Wait for UTC 00:00");
|
||||
thread::sleep(Duration::new(60,0));
|
||||
thread::sleep(Duration::new(60, 0));
|
||||
println!("Ready to work again");
|
||||
}
|
||||
let cred = th.open_invite().1 .0;
|
||||
|
@ -1096,10 +1096,10 @@ fn stats_test_percent_blockage_migration_30() {
|
|||
let mut th = TestHarness::new_buckets(x, x);
|
||||
let mut credentials: Vec<cred::Lox> = Vec::new();
|
||||
for _ in 0..USERS {
|
||||
let h: NaiveTime = DateTime::time(&Utc::now());
|
||||
let h: NaiveTime = DateTime::time(&Utc::now());
|
||||
if h.hour() == 23 && h.minute() == 59 {
|
||||
println!("Wait for UTC 00:00");
|
||||
thread::sleep(Duration::new(60,0));
|
||||
thread::sleep(Duration::new(60, 0));
|
||||
println!("Ready to work again");
|
||||
}
|
||||
let cred = th.open_invite().1 .0;
|
||||
|
@ -1129,10 +1129,10 @@ fn stats_test_percent_blockage_migration_35() {
|
|||
let mut th = TestHarness::new_buckets(x, x);
|
||||
let mut credentials: Vec<cred::Lox> = Vec::new();
|
||||
for _ in 0..USERS {
|
||||
let h: NaiveTime = DateTime::time(&Utc::now());
|
||||
let h: NaiveTime = DateTime::time(&Utc::now());
|
||||
if h.hour() == 23 && h.minute() == 59 {
|
||||
println!("Wait for UTC 00:00");
|
||||
thread::sleep(Duration::new(60,0));
|
||||
thread::sleep(Duration::new(60, 0));
|
||||
println!("Ready to work again");
|
||||
}
|
||||
let cred = th.open_invite().1 .0;
|
||||
|
@ -1162,10 +1162,10 @@ fn stats_test_percent_blockage_migration_40() {
|
|||
let mut th = TestHarness::new_buckets(x, x);
|
||||
let mut credentials: Vec<cred::Lox> = Vec::new();
|
||||
for _ in 0..USERS {
|
||||
let h: NaiveTime = DateTime::time(&Utc::now());
|
||||
let h: NaiveTime = DateTime::time(&Utc::now());
|
||||
if h.hour() == 23 && h.minute() == 59 {
|
||||
println!("Wait for UTC 00:00");
|
||||
thread::sleep(Duration::new(60,0));
|
||||
thread::sleep(Duration::new(60, 0));
|
||||
println!("Ready to work again");
|
||||
}
|
||||
let cred = th.open_invite().1 .0;
|
||||
|
@ -1195,10 +1195,10 @@ fn stats_test_percent_blockage_migration_45() {
|
|||
let mut th = TestHarness::new_buckets(x, x);
|
||||
let mut credentials: Vec<cred::Lox> = Vec::new();
|
||||
for _ in 0..USERS {
|
||||
let h: NaiveTime = DateTime::time(&Utc::now());
|
||||
let h: NaiveTime = DateTime::time(&Utc::now());
|
||||
if h.hour() == 23 && h.minute() == 59 {
|
||||
println!("Wait for UTC 00:00");
|
||||
thread::sleep(Duration::new(60,0));
|
||||
thread::sleep(Duration::new(60, 0));
|
||||
println!("Ready to work again");
|
||||
}
|
||||
let cred = th.open_invite().1 .0;
|
||||
|
@ -1228,10 +1228,10 @@ fn stats_test_percent_blockage_migration_50() {
|
|||
let mut th = TestHarness::new_buckets(x, x);
|
||||
let mut credentials: Vec<cred::Lox> = Vec::new();
|
||||
for _ in 0..USERS {
|
||||
let h: NaiveTime = DateTime::time(&Utc::now());
|
||||
let h: NaiveTime = DateTime::time(&Utc::now());
|
||||
if h.hour() == 23 && h.minute() == 59 {
|
||||
println!("Wait for UTC 00:00");
|
||||
thread::sleep(Duration::new(60,0));
|
||||
thread::sleep(Duration::new(60, 0));
|
||||
println!("Ready to work again");
|
||||
}
|
||||
let cred = th.open_invite().1 .0;
|
||||
|
@ -1261,10 +1261,10 @@ fn stats_test_percent_blockage_migration_55() {
|
|||
let mut th = TestHarness::new_buckets(x, x);
|
||||
let mut credentials: Vec<cred::Lox> = Vec::new();
|
||||
for _ in 0..USERS {
|
||||
let h: NaiveTime = DateTime::time(&Utc::now());
|
||||
let h: NaiveTime = DateTime::time(&Utc::now());
|
||||
if h.hour() == 23 && h.minute() == 59 {
|
||||
println!("Wait for UTC 00:00");
|
||||
thread::sleep(Duration::new(60,0));
|
||||
thread::sleep(Duration::new(60, 0));
|
||||
println!("Ready to work again");
|
||||
}
|
||||
let cred = th.open_invite().1 .0;
|
||||
|
@ -1294,10 +1294,10 @@ fn stats_test_percent_blockage_migration_60() {
|
|||
let mut th = TestHarness::new_buckets(x, x);
|
||||
let mut credentials: Vec<cred::Lox> = Vec::new();
|
||||
for _ in 0..USERS {
|
||||
let h: NaiveTime = DateTime::time(&Utc::now());
|
||||
let h: NaiveTime = DateTime::time(&Utc::now());
|
||||
if h.hour() == 23 && h.minute() == 59 {
|
||||
println!("Wait for UTC 00:00");
|
||||
thread::sleep(Duration::new(60,0));
|
||||
thread::sleep(Duration::new(60, 0));
|
||||
println!("Ready to work again");
|
||||
}
|
||||
let cred = th.open_invite().1 .0;
|
||||
|
@ -1327,10 +1327,10 @@ fn stats_test_percent_blockage_migration_65() {
|
|||
let mut th = TestHarness::new_buckets(x, x);
|
||||
let mut credentials: Vec<cred::Lox> = Vec::new();
|
||||
for _ in 0..USERS {
|
||||
let h: NaiveTime = DateTime::time(&Utc::now());
|
||||
let h: NaiveTime = DateTime::time(&Utc::now());
|
||||
if h.hour() == 23 && h.minute() == 59 {
|
||||
println!("Wait for UTC 00:00");
|
||||
thread::sleep(Duration::new(60,0));
|
||||
thread::sleep(Duration::new(60, 0));
|
||||
println!("Ready to work again");
|
||||
}
|
||||
let cred = th.open_invite().1 .0;
|
||||
|
@ -1360,10 +1360,10 @@ fn stats_test_percent_blockage_migration_70() {
|
|||
let mut th = TestHarness::new_buckets(x, x);
|
||||
let mut credentials: Vec<cred::Lox> = Vec::new();
|
||||
for _ in 0..USERS {
|
||||
let h: NaiveTime = DateTime::time(&Utc::now());
|
||||
let h: NaiveTime = DateTime::time(&Utc::now());
|
||||
if h.hour() == 23 && h.minute() == 59 {
|
||||
println!("Wait for UTC 00:00");
|
||||
thread::sleep(Duration::new(60,0));
|
||||
thread::sleep(Duration::new(60, 0));
|
||||
println!("Ready to work again");
|
||||
}
|
||||
let cred = th.open_invite().1 .0;
|
||||
|
@ -1393,10 +1393,10 @@ fn stats_test_percent_blockage_migration_75() {
|
|||
let mut th = TestHarness::new_buckets(x, x);
|
||||
let mut credentials: Vec<cred::Lox> = Vec::new();
|
||||
for _ in 0..USERS {
|
||||
let h: NaiveTime = DateTime::time(&Utc::now());
|
||||
let h: NaiveTime = DateTime::time(&Utc::now());
|
||||
if h.hour() == 23 && h.minute() == 59 {
|
||||
println!("Wait for UTC 00:00");
|
||||
thread::sleep(Duration::new(60,0));
|
||||
thread::sleep(Duration::new(60, 0));
|
||||
println!("Ready to work again");
|
||||
}
|
||||
let cred = th.open_invite().1 .0;
|
||||
|
@ -1426,10 +1426,10 @@ fn stats_test_percent_blockage_migration_80() {
|
|||
let mut th = TestHarness::new_buckets(x, x);
|
||||
let mut credentials: Vec<cred::Lox> = Vec::new();
|
||||
for _ in 0..USERS {
|
||||
let h: NaiveTime = DateTime::time(&Utc::now());
|
||||
let h: NaiveTime = DateTime::time(&Utc::now());
|
||||
if h.hour() == 23 && h.minute() == 59 {
|
||||
println!("Wait for UTC 00:00");
|
||||
thread::sleep(Duration::new(60,0));
|
||||
thread::sleep(Duration::new(60, 0));
|
||||
println!("Ready to work again");
|
||||
}
|
||||
let cred = th.open_invite().1 .0;
|
||||
|
@ -1459,10 +1459,10 @@ fn stats_test_percent_blockage_migration_85() {
|
|||
let mut th = TestHarness::new_buckets(x, x);
|
||||
let mut credentials: Vec<cred::Lox> = Vec::new();
|
||||
for _ in 0..USERS {
|
||||
let h: NaiveTime = DateTime::time(&Utc::now());
|
||||
let h: NaiveTime = DateTime::time(&Utc::now());
|
||||
if h.hour() == 23 && h.minute() == 59 {
|
||||
println!("Wait for UTC 00:00");
|
||||
thread::sleep(Duration::new(60,0));
|
||||
thread::sleep(Duration::new(60, 0));
|
||||
println!("Ready to work again");
|
||||
}
|
||||
let cred = th.open_invite().1 .0;
|
||||
|
@ -1492,10 +1492,10 @@ fn stats_test_percent_blockage_migration_90() {
|
|||
let mut th = TestHarness::new_buckets(x, x);
|
||||
let mut credentials: Vec<cred::Lox> = Vec::new();
|
||||
for _ in 0..USERS {
|
||||
let h: NaiveTime = DateTime::time(&Utc::now());
|
||||
let h: NaiveTime = DateTime::time(&Utc::now());
|
||||
if h.hour() == 23 && h.minute() == 59 {
|
||||
println!("Wait for UTC 00:00");
|
||||
thread::sleep(Duration::new(60,0));
|
||||
thread::sleep(Duration::new(60, 0));
|
||||
println!("Ready to work again");
|
||||
}
|
||||
let cred = th.open_invite().1 .0;
|
||||
|
@ -1525,10 +1525,10 @@ fn stats_test_percent_blockage_migration_95() {
|
|||
let mut th = TestHarness::new_buckets(x, x);
|
||||
let mut credentials: Vec<cred::Lox> = Vec::new();
|
||||
for _ in 0..USERS {
|
||||
let h: NaiveTime = DateTime::time(&Utc::now());
|
||||
let h: NaiveTime = DateTime::time(&Utc::now());
|
||||
if h.hour() == 23 && h.minute() == 59 {
|
||||
println!("Wait for UTC 00:00");
|
||||
thread::sleep(Duration::new(60,0));
|
||||
thread::sleep(Duration::new(60, 0));
|
||||
println!("Ready to work again");
|
||||
}
|
||||
let cred = th.open_invite().1 .0;
|
||||
|
@ -1558,10 +1558,10 @@ fn stats_test_percent_blockage_migration_100() {
|
|||
let mut th = TestHarness::new_buckets(x, x);
|
||||
let mut credentials: Vec<cred::Lox> = Vec::new();
|
||||
for _ in 0..USERS {
|
||||
let h: NaiveTime = DateTime::time(&Utc::now());
|
||||
let h: NaiveTime = DateTime::time(&Utc::now());
|
||||
if h.hour() == 23 && h.minute() == 59 {
|
||||
println!("Wait for UTC 00:00");
|
||||
thread::sleep(Duration::new(60,0));
|
||||
thread::sleep(Duration::new(60, 0));
|
||||
println!("Ready to work again");
|
||||
}
|
||||
let cred = th.open_invite().1 .0;
|
||||
|
@ -1685,16 +1685,56 @@ fn print_stats_test_results(
|
|||
resp_time: Vec<f64>,
|
||||
resp_handle_time: Vec<f64>,
|
||||
) {
|
||||
let mean_req_size = if req_size.len() > 0 {mean(&req_size)} else {0.0};
|
||||
let req_std_dev = if req_size.len() > 1 {standard_deviation(&req_size, Some(mean_req_size))} else {0.0};
|
||||
let mean_req_time = if req_time.len() > 0 {mean(&req_time)} else {0.0};
|
||||
let req_time_std_dev = if req_time.len() > 1 {standard_deviation(&req_time, Some(mean_req_time))} else {0.0};
|
||||
let mean_resp_size = if resp_size.len() > 0 {mean(&resp_size)} else {0.0};
|
||||
let resp_std_dev = if resp_size.len() > 1 {standard_deviation(&resp_size, Some(mean_resp_size))} else {0.0};
|
||||
let mean_resp_time = if resp_time.len() > 0 {mean(&resp_time)} else {0.0};
|
||||
let resp_time_std_dev = if resp_time.len() > 1 {standard_deviation(&resp_time, Some(mean_resp_time))} else {0.0};
|
||||
let mean_resp_handle_time = if resp_handle_time.len() > 0 {mean(&resp_handle_time)} else {0.0};
|
||||
let resp_handle_time_std_dev = if resp_handle_time.len() > 1 {standard_deviation(&resp_handle_time, Some(mean_resp_handle_time))} else {0.0};
|
||||
let mean_req_size = if req_size.len() > 0 {
|
||||
mean(&req_size)
|
||||
} else {
|
||||
0.0
|
||||
};
|
||||
let req_std_dev = if req_size.len() > 1 {
|
||||
standard_deviation(&req_size, Some(mean_req_size))
|
||||
} else {
|
||||
0.0
|
||||
};
|
||||
let mean_req_time = if req_time.len() > 0 {
|
||||
mean(&req_time)
|
||||
} else {
|
||||
0.0
|
||||
};
|
||||
let req_time_std_dev = if req_time.len() > 1 {
|
||||
standard_deviation(&req_time, Some(mean_req_time))
|
||||
} else {
|
||||
0.0
|
||||
};
|
||||
let mean_resp_size = if resp_size.len() > 0 {
|
||||
mean(&resp_size)
|
||||
} else {
|
||||
0.0
|
||||
};
|
||||
let resp_std_dev = if resp_size.len() > 1 {
|
||||
standard_deviation(&resp_size, Some(mean_resp_size))
|
||||
} else {
|
||||
0.0
|
||||
};
|
||||
let mean_resp_time = if resp_time.len() > 0 {
|
||||
mean(&resp_time)
|
||||
} else {
|
||||
0.0
|
||||
};
|
||||
let resp_time_std_dev = if resp_time.len() > 1 {
|
||||
standard_deviation(&resp_time, Some(mean_resp_time))
|
||||
} else {
|
||||
0.0
|
||||
};
|
||||
let mean_resp_handle_time = if resp_handle_time.len() > 0 {
|
||||
mean(&resp_handle_time)
|
||||
} else {
|
||||
0.0
|
||||
};
|
||||
let resp_handle_time_std_dev = if resp_handle_time.len() > 1 {
|
||||
standard_deviation(&resp_handle_time, Some(mean_resp_handle_time))
|
||||
} else {
|
||||
0.0
|
||||
};
|
||||
|
||||
println!("Average request size = {} bytes", mean_req_size);
|
||||
println!("Request size standard deviation = {} bytes", req_std_dev);
|
||||
|
|
Loading…
Reference in New Issue