v0.12 specific stability changes
This commit is contained in:
@ -27,13 +27,9 @@ use std::sync::{Arc, Mutex, RwLock};
|
||||
use std::thread::{self, Builder, JoinHandle};
|
||||
use std::time::Duration;
|
||||
use std::time::Instant;
|
||||
use sys_info;
|
||||
|
||||
pub type UnprocessedPackets = Vec<(SharedPackets, usize)>; // `usize` is the index of the first unprocessed packet in `SharedPackets`
|
||||
|
||||
// number of threads is 1 until mt bank is ready
|
||||
pub const NUM_THREADS: u32 = 10;
|
||||
|
||||
/// Stores the stage's thread handle and output receiver.
|
||||
pub struct BankingStage {
|
||||
bank_thread_hdls: Vec<JoinHandle<()>>,
|
||||
@ -57,7 +53,7 @@ impl BankingStage {
|
||||
// Single thread to compute confirmation
|
||||
let lcs_handle = LeaderConfirmationService::start(&poh_recorder, exit.clone());
|
||||
// Many banks that process transactions in parallel.
|
||||
let mut bank_thread_hdls: Vec<JoinHandle<()>> = (0..Self::num_threads())
|
||||
let mut bank_thread_hdls: Vec<JoinHandle<()>> = (0..4)
|
||||
.map(|_| {
|
||||
let verified_receiver = verified_receiver.clone();
|
||||
let poh_recorder = poh_recorder.clone();
|
||||
@ -189,10 +185,6 @@ impl BankingStage {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn num_threads() -> u32 {
|
||||
sys_info::cpu_num().unwrap_or(NUM_THREADS)
|
||||
}
|
||||
|
||||
/// Convert the transactions from a blob of binary data to a vector of transactions
|
||||
fn deserialize_transactions(p: &Packets) -> Vec<Option<Transaction>> {
|
||||
p.packets
|
||||
|
@ -44,10 +44,9 @@ pub fn slot_leader_at(slot: u64, bank: &Bank) -> Option<Pubkey> {
|
||||
}
|
||||
|
||||
/// Return the next slot after the given current_slot that the given node will be leader
|
||||
pub fn next_leader_slot(pubkey: &Pubkey, current_slot: u64, bank: &Bank) -> Option<u64> {
|
||||
let (epoch, slot_index) = bank.get_epoch_and_slot_index(current_slot + 1);
|
||||
|
||||
if let Some(leader_schedule) = leader_schedule(epoch, bank) {
|
||||
pub fn next_leader_slot(pubkey: &Pubkey, mut current_slot: u64, bank: &Bank) -> Option<u64> {
|
||||
let (mut epoch, mut start_index) = bank.get_epoch_and_slot_index(current_slot + 1);
|
||||
while let Some(leader_schedule) = leader_schedule(epoch, bank) {
|
||||
// clippy thinks I should do this:
|
||||
// for (i, <item>) in leader_schedule
|
||||
// .iter()
|
||||
@ -57,11 +56,15 @@ pub fn next_leader_slot(pubkey: &Pubkey, current_slot: u64, bank: &Bank) -> Opti
|
||||
//
|
||||
// but leader_schedule doesn't implement Iter...
|
||||
#[allow(clippy::needless_range_loop)]
|
||||
for i in slot_index..bank.get_slots_in_epoch(epoch) {
|
||||
for i in start_index..bank.get_slots_in_epoch(epoch) {
|
||||
current_slot += 1;
|
||||
if *pubkey == leader_schedule[i] {
|
||||
return Some(current_slot + 1 + (i - slot_index) as u64);
|
||||
return Some(current_slot);
|
||||
}
|
||||
}
|
||||
|
||||
epoch += 1;
|
||||
start_index = 0;
|
||||
}
|
||||
None
|
||||
}
|
||||
|
@ -57,6 +57,7 @@ clientCommand="\
|
||||
--duration 7500 \
|
||||
--sustained \
|
||||
--threads $threadCount \
|
||||
--tx_count 10000 \
|
||||
"
|
||||
|
||||
tmux new -s solana-bench-tps -d "
|
||||
|
Reference in New Issue
Block a user