Add option to wait for a specific epoch length to bench-tps (#10083)
This commit is contained in:
@ -36,6 +36,7 @@ use solana_sdk::{
|
||||
Epoch, Slot, SlotCount, SlotIndex, UnixTimestamp, DEFAULT_TICKS_PER_SECOND,
|
||||
MAX_PROCESSING_AGE, MAX_RECENT_BLOCKHASHES, SECONDS_PER_DAY,
|
||||
},
|
||||
epoch_info::EpochInfo,
|
||||
epoch_schedule::EpochSchedule,
|
||||
fee_calculator::{FeeCalculator, FeeRateGovernor},
|
||||
genesis_config::{GenesisConfig, OperatingMode},
|
||||
@ -2468,6 +2469,18 @@ impl Bank {
|
||||
self.epoch_schedule.get_epoch_and_slot_index(slot)
|
||||
}
|
||||
|
||||
pub fn get_epoch_info(&self) -> EpochInfo {
|
||||
let absolute_slot = self.slot();
|
||||
let (epoch, slot_index) = self.get_epoch_and_slot_index(absolute_slot);
|
||||
let slots_in_epoch = self.get_slots_in_epoch(epoch);
|
||||
EpochInfo {
|
||||
epoch,
|
||||
slot_index,
|
||||
slots_in_epoch,
|
||||
absolute_slot,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn is_empty(&self) -> bool {
|
||||
!self.is_delta.load(Ordering::Relaxed)
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ use solana_sdk::{
|
||||
account::Account,
|
||||
client::{AsyncClient, Client, SyncClient},
|
||||
commitment_config::CommitmentConfig,
|
||||
epoch_info::EpochInfo,
|
||||
fee_calculator::{FeeCalculator, FeeRateGovernor},
|
||||
hash::Hash,
|
||||
instruction::Instruction,
|
||||
@ -241,6 +242,10 @@ impl SyncClient for BankClient {
|
||||
)))
|
||||
}
|
||||
}
|
||||
|
||||
fn get_epoch_info(&self) -> Result<EpochInfo> {
|
||||
Ok(self.bank.get_epoch_info())
|
||||
}
|
||||
}
|
||||
|
||||
impl BankClient {
|
||||
|
Reference in New Issue
Block a user