udp load test: enable log crate logging

This commit is contained in:
Joakim Frostegård 2021-11-07 11:29:15 +01:00
parent 57896f4648
commit 6eaac536ba
2 changed files with 8 additions and 1 deletions

View file

@ -1,6 +1,7 @@
use std::net::SocketAddr; use std::net::SocketAddr;
use std::sync::{atomic::AtomicUsize, Arc}; use std::sync::{atomic::AtomicUsize, Arc};
use aquatic_cli_helpers::LogLevel;
use aquatic_common::cpu_pinning::CpuPinningConfig; use aquatic_common::cpu_pinning::CpuPinningConfig;
use hashbrown::HashMap; use hashbrown::HashMap;
use parking_lot::Mutex; use parking_lot::Mutex;
@ -16,6 +17,7 @@ pub struct ThreadId(pub u8);
pub struct Config { pub struct Config {
/// Server address /// Server address
pub server_address: SocketAddr, pub server_address: SocketAddr,
pub log_level: LogLevel,
/// Number of sockets and socket worker threads /// Number of sockets and socket worker threads
/// ///
/// Sockets will bind to one port each, and with /// Sockets will bind to one port each, and with
@ -102,6 +104,7 @@ impl Default for Config {
fn default() -> Self { fn default() -> Self {
Self { Self {
server_address: "127.0.0.1:3000".parse().unwrap(), server_address: "127.0.0.1:3000".parse().unwrap(),
log_level: LogLevel::Error,
num_socket_workers: 1, num_socket_workers: 1,
num_request_workers: 1, num_request_workers: 1,
duration: 0, duration: 0,

View file

@ -31,7 +31,11 @@ pub fn main() {
) )
} }
impl aquatic_cli_helpers::Config for Config {} impl aquatic_cli_helpers::Config for Config {
fn get_log_level(&self) -> Option<aquatic_cli_helpers::LogLevel> {
Some(self.log_level)
}
}
fn run(config: Config) -> ::anyhow::Result<()> { fn run(config: Config) -> ::anyhow::Result<()> {
if config.handler.weight_announce + config.handler.weight_connect + config.handler.weight_scrape if config.handler.weight_announce + config.handler.weight_connect + config.handler.weight_scrape