mirror of
https://github.com/pezkuwichain/pezkuwi-telemetry.git
synced 2026-06-13 06:51:06 +00:00
num-cpus to worker-threads; more accurate name
This commit is contained in:
@@ -62,7 +62,7 @@ struct Opts {
|
||||
/// Number of worker threads to spawn. Defaults to the number of CPUs on the machine.
|
||||
/// If "0" is given, use the number of CPUs available on the machine.
|
||||
#[structopt(long)]
|
||||
num_cpus: Option<usize>,
|
||||
worker_threads: Option<usize>,
|
||||
}
|
||||
|
||||
fn main() {
|
||||
@@ -75,13 +75,13 @@ fn main() {
|
||||
|
||||
log::info!("Starting Telemetry Core version: {}", VERSION);
|
||||
|
||||
let num_cpus_to_use = opts.num_cpus
|
||||
let worker_threads = opts.worker_threads
|
||||
.and_then(|n| if n == 0 { None } else { Some(n) })
|
||||
.unwrap_or_else(|| num_cpus::get());
|
||||
|
||||
tokio::runtime::Builder::new_multi_thread()
|
||||
.enable_all()
|
||||
.worker_threads(num_cpus_to_use)
|
||||
.worker_threads(worker_threads)
|
||||
.build()
|
||||
.unwrap()
|
||||
.block_on(async {
|
||||
|
||||
@@ -76,11 +76,11 @@ async fn run_soak_test(opts: SoakTestOpts) {
|
||||
let mut server = start_server(
|
||||
true,
|
||||
CoreOpts {
|
||||
num_cpus: opts.num_core_cpus,
|
||||
worker_threads: opts.core_worker_threads,
|
||||
..Default::default()
|
||||
},
|
||||
ShardOpts {
|
||||
num_cpus: opts.num_shard_cpus,
|
||||
worker_threads: opts.shard_worker_threads,
|
||||
..Default::default()
|
||||
},
|
||||
).await;
|
||||
@@ -259,11 +259,11 @@ async fn run_realistic_soak_test(opts: SoakTestOpts) {
|
||||
let mut server = start_server(
|
||||
true,
|
||||
CoreOpts {
|
||||
num_cpus: opts.num_core_cpus,
|
||||
worker_threads: opts.core_worker_threads,
|
||||
..Default::default()
|
||||
},
|
||||
ShardOpts {
|
||||
num_cpus: opts.num_shard_cpus,
|
||||
worker_threads: opts.shard_worker_threads,
|
||||
..Default::default()
|
||||
},
|
||||
).await;
|
||||
@@ -394,10 +394,10 @@ struct SoakTestOpts {
|
||||
nodes: usize,
|
||||
/// Number of worker threads the core will use
|
||||
#[structopt(long)]
|
||||
num_core_cpus: Option<usize>,
|
||||
core_worker_threads: Option<usize>,
|
||||
/// Number of worker threads each shard will use
|
||||
#[structopt(long)]
|
||||
num_shard_cpus: Option<usize>,
|
||||
shard_worker_threads: Option<usize>,
|
||||
}
|
||||
|
||||
/// Get soak test args from an envvar and parse them via structopt.
|
||||
|
||||
Reference in New Issue
Block a user