feat: btc-address add current

This commit is contained in:
2022-05-02 19:09:24 +08:00
parent 6517457d0d
commit 92bfe1819a

View File

@@ -30,14 +30,20 @@ fn main() {
.unwrap_or_else(|_| 10_000_000_u64); .unwrap_or_else(|_| 10_000_000_u64);
println!("LOOP_COUNT={}", loop_count); println!("LOOP_COUNT={}", loop_count);
let num_of_vcpus = num_cpus::get(); let num_of_vcpus = num_cpus::get();
let num_of_phycpus = num_cpus::get_physical(); let num_of_phycpus = num_cpus::get_physical();
println!("You have {} vCPUs, from {} phyCPUs", num_of_vcpus, num_of_phycpus); println!("You have {} vCPUs, from {} phyCPUs", num_of_vcpus, num_of_phycpus);
let concurrent_count = std::env::var("CONCURRENT_COUNT")
.map(|c| c.parse::<u64>())
.unwrap_or_else(|_| Ok(num_of_phycpus as u64))
.unwrap_or_else(|_| 1_u64);
println!("CONCURRENT_COUNT={}", concurrent_count);
let stop_flag = Arc::new(Mutex::new(false)); let stop_flag = Arc::new(Mutex::new(false));
let mut handles = vec![]; let mut handles = vec![];
for ind in 0..num_of_phycpus { for ind in 0..concurrent_count {
println!("- Running task {} of {}", ind, num_of_phycpus); println!("- Running task {} of {}", ind, concurrent_count);
let the_stop_flag = Arc::clone(&stop_flag); let the_stop_flag = Arc::clone(&stop_flag);
let prefixes = prefixes.clone(); let prefixes = prefixes.clone();
let child = thread::spawn(move || { let child = thread::spawn(move || {
@@ -51,7 +57,7 @@ fn main() {
println!("Finished!"); println!("Finished!");
} }
fn run_one_task(prefixes: Vec<String>, continue_on_found: bool, loop_count: u64, ind: usize, the_stop_flag: Arc<Mutex<bool>>) { fn run_one_task(prefixes: Vec<String>, continue_on_found: bool, loop_count: u64, ind: u64, the_stop_flag: Arc<Mutex<bool>>) {
let secp = Secp256k1::new(); let secp = Secp256k1::new();
let mut rng = OsRng::new().expect("OsRng"); let mut rng = OsRng::new().expect("OsRng");