This commit is contained in:
carllin 2019-10-30 19:51:44 -07:00 committed by GitHub
parent f131255066
commit 0559212df7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 55 additions and 11 deletions

View File

@ -18,7 +18,7 @@ use solana_sdk::{
pubkey::Pubkey, pubkey::Pubkey,
signature::{Keypair, KeypairUtil}, signature::{Keypair, KeypairUtil},
system_instruction, system_transaction, system_instruction, system_transaction,
timing::{duration_as_ms, duration_as_s, timestamp}, timing::{duration_as_ms, duration_as_s, duration_as_us, timestamp},
transaction::Transaction, transaction::Transaction,
}; };
use std::{ use std::{
@ -158,12 +158,13 @@ where
let mut reclaim_lamports_back_to_source_account = false; let mut reclaim_lamports_back_to_source_account = false;
let mut i = keypair0_balance; let mut i = keypair0_balance;
let mut blockhash = Hash::default(); let mut blockhash = Hash::default();
let mut blockhash_time = Instant::now(); let mut blockhash_time;
while start.elapsed() < duration { while start.elapsed() < duration {
// ping-pong between source and destination accounts for each loop iteration // ping-pong between source and destination accounts for each loop iteration
// this seems to be faster than trying to determine the balance of individual // this seems to be faster than trying to determine the balance of individual
// accounts // accounts
let len = tx_count as usize; let len = tx_count as usize;
blockhash_time = Instant::now();
if let Ok((new_blockhash, _fee_calculator)) = client.get_new_blockhash(&blockhash) { if let Ok((new_blockhash, _fee_calculator)) = client.get_new_blockhash(&blockhash) {
blockhash = new_blockhash; blockhash = new_blockhash;
} else { } else {
@ -173,13 +174,19 @@ where
sleep(Duration::from_millis(100)); sleep(Duration::from_millis(100));
continue; continue;
} }
info!( datapoint_debug!(
"Took {} ms for new blockhash", "bench-tps-get_blockhash",
duration_as_ms(&blockhash_time.elapsed()) ("duration", duration_as_us(&blockhash_time.elapsed()), i64)
); );
blockhash_time = Instant::now(); blockhash_time = Instant::now();
let balance = client.get_balance(&id.pubkey()).unwrap_or(0); let balance = client.get_balance(&id.pubkey()).unwrap_or(0);
metrics_submit_lamport_balance(balance); metrics_submit_lamport_balance(balance);
datapoint_debug!(
"bench-tps-get_balance",
("duration", duration_as_us(&blockhash_time.elapsed()), i64)
);
generate_txs( generate_txs(
&shared_txs, &shared_txs,
&blockhash, &blockhash,
@ -367,7 +374,7 @@ fn generate_txs(
); );
datapoint_debug!( datapoint_debug!(
"bench-tps-generate_txs", "bench-tps-generate_txs",
("duration", duration_as_ms(&duration), i64) ("duration", duration_as_us(&duration), i64)
); );
let sz = transactions.len() / threads; let sz = transactions.len() / threads;
@ -432,7 +439,7 @@ fn do_tx_transfers<T: Client>(
); );
datapoint_debug!( datapoint_debug!(
"bench-tps-do_tx_transfers", "bench-tps-do_tx_transfers",
("duration", duration_as_ms(&transfer_start.elapsed()), i64), ("duration", duration_as_us(&transfer_start.elapsed()), i64),
("count", tx_len, i64) ("count", tx_len, i64)
); );
} }

View File

@ -4317,7 +4317,7 @@
"measurement": "cluster_info-vote-count", "measurement": "cluster_info-vote-count",
"orderByTime": "ASC", "orderByTime": "ASC",
"policy": "autogen", "policy": "autogen",
"query": "SELECT \"duration\" / 1000 as \"Generation Time\" FROM \"$testnet\".\"autogen\".\"bench-tps-generate_txs\" WHERE $timeFilter fill(null)\n\n\n\n\n", "query": "SELECT mean(\"duration\") as \"Generation Time\" FROM \"$testnet\".\"autogen\".\"bench-tps-generate_txs\" WHERE $timeFilter GROUP BY time(1s)\n\n\n\n\n",
"rawQuery": true, "rawQuery": true,
"refId": "A", "refId": "A",
"resultFormat": "time_series", "resultFormat": "time_series",
@ -4354,7 +4354,7 @@
], ],
"orderByTime": "ASC", "orderByTime": "ASC",
"policy": "default", "policy": "default",
"query": "SELECT \"duration\" / 1000 as \"Transmit Time\" FROM \"$testnet\".\"autogen\".\"bench-tps-do_tx_transfers\" WHERE $timeFilter fill(null)", "query": "SELECT mean(\"duration\") as \"Transmit Time\" FROM \"$testnet\".\"autogen\".\"bench-tps-do_tx_transfers\" WHERE $timeFilter GROUP BY time(1s)",
"rawQuery": true, "rawQuery": true,
"refId": "B", "refId": "B",
"resultFormat": "time_series", "resultFormat": "time_series",
@ -4391,7 +4391,7 @@
], ],
"orderByTime": "ASC", "orderByTime": "ASC",
"policy": "default", "policy": "default",
"query": "SELECT \"duration\" / 1000 as \"Barrier Transaction Confirmation Time\" FROM \"$testnet\".\"autogen\".\"bench-tps-send_barrier_transaction\" WHERE $timeFilter fill(null)", "query": "SELECT mean(\"duration\") as \"Get Blockhash\" FROM \"$testnet\".\"autogen\".\"bench-tps-get_blockhash\" WHERE $timeFilter GROUP BY time(1s)",
"rawQuery": true, "rawQuery": true,
"refId": "C", "refId": "C",
"resultFormat": "time_series", "resultFormat": "time_series",
@ -4410,6 +4410,43 @@
] ]
], ],
"tags": [] "tags": []
},
{
"groupBy": [
{
"params": [
"$__interval"
],
"type": "time"
},
{
"params": [
"null"
],
"type": "fill"
}
],
"orderByTime": "ASC",
"policy": "default",
"query": "SELECT mean(\"duration\") as \"Get Balance\" FROM \"$testnet\".\"autogen\".\"bench-tps-get_balance\" WHERE $timeFilter GROUP BY time(1s)",
"rawQuery": true,
"refId": "D",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"value"
],
"type": "field"
},
{
"params": [],
"type": "mean"
}
]
],
"tags": []
} }
], ],
"thresholds": [], "thresholds": [],
@ -4432,7 +4469,7 @@
}, },
"yaxes": [ "yaxes": [
{ {
"format": "short", "format": "µs",
"label": null, "label": null,
"logBase": 1, "logBase": 1,
"max": null, "max": null,