forked from solana-labs/solana
-
Notifications
You must be signed in to change notification settings - Fork 1k
bench-tps: Resolve Rust 1.88 clippy lints and format strings #7435
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -229,7 +229,8 @@ where | |
| let bsps = (tx_count) as f64 / ns as f64; | ||
| let nsps = ns as f64 / (tx_count) as f64; | ||
| info!( | ||
| "Done. {:.2} thousand signatures per second, {:.2} us per signature, {} ms total time, {:?}", | ||
| "Done. {:.2} thousand signatures per second, {:.2} us per signature, {} ms total \ | ||
| time, {:?}", | ||
| bsps * 1_000_000_f64, | ||
| nsps / 1_000_f64, | ||
| duration.as_millis(), | ||
|
|
@@ -266,14 +267,11 @@ where | |
| T: 'static + TpsClient + Send + Sync + ?Sized, | ||
| { | ||
| if target_slots_per_epoch != 0 { | ||
| info!( | ||
| "Waiting until epochs are {} slots long..", | ||
| target_slots_per_epoch | ||
| ); | ||
| info!("Waiting until epochs are {target_slots_per_epoch} slots long.."); | ||
| loop { | ||
| if let Ok(epoch_info) = client.get_epoch_info() { | ||
| if epoch_info.slots_in_epoch >= target_slots_per_epoch { | ||
| info!("Done epoch_info: {:?}", epoch_info); | ||
| info!("Done epoch_info: {epoch_info:?}"); | ||
| break; | ||
| } | ||
| info!( | ||
|
|
@@ -295,7 +293,7 @@ fn create_sampler_thread<T>( | |
| where | ||
| T: 'static + TpsClient + Send + Sync + ?Sized, | ||
| { | ||
| info!("Sampling TPS every {} second...", sample_period); | ||
| info!("Sampling TPS every {sample_period} second..."); | ||
| let maxes = maxes.clone(); | ||
| let client = client.clone(); | ||
| Builder::new() | ||
|
|
@@ -440,12 +438,12 @@ where | |
| match client.get_transaction_count() { | ||
| Ok(count) => break count, | ||
| Err(err) => { | ||
| info!("Couldn't get transaction count: {:?}", err); | ||
| info!("Couldn't get transaction count: {err:?}"); | ||
| sleep(Duration::from_secs(1)); | ||
| } | ||
| } | ||
| }; | ||
| info!("Initial transaction count {}", first_tx_count); | ||
| info!("Initial transaction count {first_tx_count}"); | ||
|
|
||
| let exit_signal = Arc::new(AtomicBool::new(false)); | ||
|
|
||
|
|
@@ -516,28 +514,28 @@ where | |
|
|
||
| info!("Waiting for sampler threads..."); | ||
| if let Err(err) = sample_thread.join() { | ||
| info!(" join() failed with: {:?}", err); | ||
| info!(" join() failed with: {err:?}"); | ||
| } | ||
|
|
||
| // join the tx send threads | ||
| info!("Waiting for transmit threads..."); | ||
| for t in sender_threads { | ||
| if let Err(err) = t.join() { | ||
| info!(" join() failed with: {:?}", err); | ||
| info!(" join() failed with: {err:?}"); | ||
| } | ||
| } | ||
|
|
||
| if let Some(blockhash_thread) = blockhash_thread { | ||
| info!("Waiting for blockhash thread..."); | ||
| if let Err(err) = blockhash_thread.join() { | ||
| info!(" join() failed with: {:?}", err); | ||
| info!(" join() failed with: {err:?}"); | ||
| } | ||
| } | ||
|
|
||
| if let Some(log_transaction_service) = log_transaction_service { | ||
| info!("Waiting for log_transaction_service thread..."); | ||
| if let Err(err) = log_transaction_service.join() { | ||
| info!(" join() failed with: {:?}", err); | ||
| info!(" join() failed with: {err:?}"); | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -560,7 +558,7 @@ where | |
| } | ||
|
|
||
| fn metrics_submit_lamport_balance(lamport_balance: u64) { | ||
| info!("Token balance: {}", lamport_balance); | ||
| info!("Token balance: {lamport_balance}"); | ||
| datapoint_info!( | ||
| "bench-tps-lamport_balance", | ||
| ("balance", lamport_balance, i64) | ||
|
|
@@ -700,7 +698,7 @@ fn get_nonce_accounts<T: 'static + TpsClient + Send + Sync + ?Sized>( | |
| return nonce_accounts; | ||
| } | ||
| Err(err) => { | ||
| info!("Couldn't get durable nonce account: {:?}", err); | ||
| info!("Couldn't get durable nonce account: {err:?}"); | ||
| sleep(Duration::from_secs(1)); | ||
| } | ||
| } | ||
|
|
@@ -883,7 +881,7 @@ fn get_new_latest_blockhash<T: TpsClient + ?Sized>( | |
| return Some(new_blockhash); | ||
| } | ||
| } | ||
| debug!("Got same blockhash ({:?}), will retry...", blockhash); | ||
| debug!("Got same blockhash ({blockhash:?}), will retry..."); | ||
|
|
||
| // Retry ~twice during a slot | ||
| sleep(Duration::from_millis(DEFAULT_MS_PER_SLOT / 2)); | ||
|
|
@@ -962,7 +960,7 @@ fn do_tx_transfers<T: TpsClient + ?Sized>( | |
| if let Some(txs) = txs { | ||
| shared_tx_thread_count.fetch_add(1, Ordering::Relaxed); | ||
| let num_txs = txs.len(); | ||
| info!("Transferring 1 unit {} times...", num_txs); | ||
| info!("Transferring 1 unit {num_txs} times..."); | ||
| let transfer_start = Instant::now(); | ||
| let mut old_transactions = false; | ||
| let mut min_timestamp = u64::MAX; | ||
|
|
@@ -1000,13 +998,16 @@ fn do_tx_transfers<T: TpsClient + ?Sized>( | |
| sent_at: Utc::now(), | ||
| compute_unit_prices, | ||
| }) { | ||
| error!("Receiver has been dropped with error `{error}`, stop sending transactions."); | ||
| error!( | ||
| "Receiver has been dropped with error `{error}`, stop sending \ | ||
| transactions." | ||
| ); | ||
| break 'thread_loop; | ||
| } | ||
| } | ||
|
|
||
| if let Err(error) = client.send_batch(transactions) { | ||
| warn!("send_batch_sync in do_tx_transfers failed: {}", error); | ||
| warn!("send_batch_sync in do_tx_transfers failed: {error}"); | ||
| } | ||
|
|
||
| datapoint_info!( | ||
|
|
@@ -1084,10 +1085,7 @@ fn compute_and_report_stats( | |
| if total_maxes > 0.0 { | ||
| let num_nodes_with_tps = maxes.read().unwrap().len() - nodes_with_zero_tps; | ||
| let average_max = total_maxes / num_nodes_with_tps as f32; | ||
| info!( | ||
| "\nAverage max TPS: {:.2}, {} nodes had 0 TPS", | ||
| average_max, nodes_with_zero_tps | ||
| ); | ||
| info!("\nAverage max TPS: {average_max:.2}, {nodes_with_zero_tps} nodes had 0 TPS"); | ||
| } | ||
|
|
||
| let total_tx_send_count = total_tx_send_count as u64; | ||
|
|
@@ -1097,7 +1095,8 @@ fn compute_and_report_stats( | |
| 0.0 | ||
| }; | ||
| info!( | ||
| "\nHighest TPS: {:.2} sampling period {}s max transactions: {} clients: {} drop rate: {:.2}", | ||
| "\nHighest TPS: {:.2} sampling period {}s max transactions: {} clients: {} drop rate: \ | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same with this leading newline |
||
| {:.2}", | ||
| max_of_maxes, | ||
| sample_period, | ||
| max_tx_count, | ||
|
|
@@ -1121,7 +1120,7 @@ pub fn generate_and_fund_keypairs<T: 'static + TpsClient + Send + Sync + ?Sized> | |
| let rent = client.get_minimum_balance_for_rent_exemption(0)?; | ||
| let lamports_per_account = lamports_per_account + rent; | ||
|
|
||
| info!("Creating {} keypairs...", keypair_count); | ||
| info!("Creating {keypair_count} keypairs..."); | ||
| let (mut keypairs, extra) = generate_keypairs(funding_key, keypair_count as u64); | ||
| fund_keypairs( | ||
| client, | ||
|
|
@@ -1181,8 +1180,8 @@ pub fn fund_keypairs<T: 'static + TpsClient + Send + Sync + ?Sized>( | |
|
|
||
| let funding_key_balance = client.get_balance(&funding_key.pubkey()).unwrap_or(0); | ||
| info!( | ||
| "Funding keypair balance: {} max_fee: {} lamports_per_account: {} extra: {} total: {}", | ||
| funding_key_balance, max_fee, lamports_per_account, extra, total | ||
| "Funding keypair balance: {funding_key_balance} max_fee: {max_fee} \ | ||
| lamports_per_account: {lamports_per_account} extra: {extra} total: {total}" | ||
| ); | ||
|
|
||
| if funding_key_balance < total + rent { | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm wondering if the leading newline should be here but gonna leave for this PR I think