Alternate between token reclaim and distribution
This commit is contained in:
committed by
Michael Vines
parent
ea21c7a43e
commit
b3f823d544
@ -350,9 +350,13 @@ fn main() {
|
|||||||
let clients: Vec<_> = (0..threads).map(|_| mk_client(&leader)).collect();
|
let clients: Vec<_> = (0..threads).map(|_| mk_client(&leader)).collect();
|
||||||
|
|
||||||
// generate and send transactions for the specified duration
|
// generate and send transactions for the specified duration
|
||||||
let time = Duration::new(time_sec / 2, 0);
|
let time = Duration::new(time_sec, 0);
|
||||||
let mut now = Instant::now();
|
let now = Instant::now();
|
||||||
|
let mut reclaim_tokens_back_to_source_account = false;
|
||||||
while now.elapsed() < time {
|
while now.elapsed() < time {
|
||||||
|
// ping-pong between source and destination accounts for each loop iteration
|
||||||
|
// this seems to be faster than trying to determine the balance of individaul
|
||||||
|
// accounts
|
||||||
generate_and_send_txs(
|
generate_and_send_txs(
|
||||||
&mut client,
|
&mut client,
|
||||||
&clients,
|
&clients,
|
||||||
@ -362,27 +366,9 @@ fn main() {
|
|||||||
txs,
|
txs,
|
||||||
&mut last_id,
|
&mut last_id,
|
||||||
threads,
|
threads,
|
||||||
false,
|
reclaim_tokens_back_to_source_account,
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
println!("Get last ID...");
|
|
||||||
last_id = client.get_last_id();
|
|
||||||
println!("Got last ID {:?}", last_id);
|
|
||||||
|
|
||||||
now = Instant::now();
|
|
||||||
while now.elapsed() < time {
|
|
||||||
generate_and_send_txs(
|
|
||||||
&mut client,
|
|
||||||
&clients,
|
|
||||||
&id,
|
|
||||||
&keypairs,
|
|
||||||
&leader,
|
|
||||||
txs,
|
|
||||||
&mut last_id,
|
|
||||||
threads,
|
|
||||||
true,
|
|
||||||
);
|
);
|
||||||
|
reclaim_tokens_back_to_source_account = !reclaim_tokens_back_to_source_account;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Stop the sampling threads so it will collect the stats
|
// Stop the sampling threads so it will collect the stats
|
||||||
@ -440,6 +426,10 @@ fn main() {
|
|||||||
total_txs,
|
total_txs,
|
||||||
maxes.read().unwrap().len()
|
maxes.read().unwrap().len()
|
||||||
);
|
);
|
||||||
|
println!(
|
||||||
|
"\tAverage TPS: {}",
|
||||||
|
total_txs as f32 / duration_as_s(&now.elapsed())
|
||||||
|
);
|
||||||
|
|
||||||
// join the crdt client threads
|
// join the crdt client threads
|
||||||
for t in c_threads {
|
for t in c_threads {
|
||||||
|
Reference in New Issue
Block a user