Split SDK's timing.rs (#5823)
This commit is contained in:
@ -22,12 +22,13 @@ use solana_metrics::{inc_new_counter_debug, inc_new_counter_info, inc_new_counte
|
||||
use solana_runtime::accounts_db::ErrorCounters;
|
||||
use solana_runtime::bank::Bank;
|
||||
use solana_runtime::locked_accounts_results::LockedAccountsResults;
|
||||
use solana_sdk::poh_config::PohConfig;
|
||||
use solana_sdk::pubkey::Pubkey;
|
||||
use solana_sdk::timing::{
|
||||
self, DEFAULT_TICKS_PER_SECOND, DEFAULT_TICKS_PER_SLOT, MAX_PROCESSING_AGE,
|
||||
use solana_sdk::clock::{
|
||||
DEFAULT_TICKS_PER_SECOND, DEFAULT_TICKS_PER_SLOT, MAX_PROCESSING_AGE,
|
||||
MAX_TRANSACTION_FORWARDING_DELAY,
|
||||
};
|
||||
use solana_sdk::poh_config::PohConfig;
|
||||
use solana_sdk::pubkey::Pubkey;
|
||||
use solana_sdk::timing::{duration_as_ms, timestamp};
|
||||
use solana_sdk::transaction::{self, Transaction, TransactionError};
|
||||
use std::cmp;
|
||||
use std::env;
|
||||
@ -222,7 +223,7 @@ impl BankingStage {
|
||||
|
||||
debug!(
|
||||
"@{:?} done processing buffered batches: {} time: {:?}ms tx count: {} tx/s: {}",
|
||||
timing::timestamp(),
|
||||
timestamp(),
|
||||
buffered_len,
|
||||
proc_start.as_ms(),
|
||||
new_tx_count,
|
||||
@ -808,8 +809,8 @@ impl BankingStage {
|
||||
let count: usize = mms.iter().map(|x| x.1.len()).sum();
|
||||
debug!(
|
||||
"@{:?} process start stalled for: {:?}ms txs: {} id: {}",
|
||||
timing::timestamp(),
|
||||
timing::duration_as_ms(&recv_start.elapsed()),
|
||||
timestamp(),
|
||||
duration_as_ms(&recv_start.elapsed()),
|
||||
count,
|
||||
id,
|
||||
);
|
||||
@ -878,7 +879,7 @@ impl BankingStage {
|
||||
inc_new_counter_debug!("banking_stage-time_ms", proc_start.as_ms() as usize);
|
||||
debug!(
|
||||
"@{:?} done processing transaction batches: {} time: {:?}ms tx count: {} tx/s: {} total count: {} id: {}",
|
||||
timing::timestamp(),
|
||||
timestamp(),
|
||||
mms_len,
|
||||
proc_start.as_ms(),
|
||||
new_tx_count,
|
||||
|
@ -34,7 +34,7 @@ use std::sync::{Arc, RwLock};
|
||||
pub use self::meta::*;
|
||||
pub use self::rooted_slot_iterator::*;
|
||||
use crate::leader_schedule_cache::LeaderScheduleCache;
|
||||
use solana_sdk::timing::Slot;
|
||||
use solana_sdk::clock::Slot;
|
||||
|
||||
mod db;
|
||||
mod meta;
|
||||
|
@ -5,7 +5,7 @@ use bincode::{deserialize, serialize};
|
||||
use serde::de::DeserializeOwned;
|
||||
use serde::Serialize;
|
||||
|
||||
use solana_sdk::timing::Slot;
|
||||
use solana_sdk::clock::Slot;
|
||||
use std::borrow::Borrow;
|
||||
use std::collections::HashMap;
|
||||
use std::marker::PhantomData;
|
||||
|
@ -4,7 +4,7 @@ use crate::blocktree::db::{
|
||||
};
|
||||
use crate::blocktree::BlocktreeError;
|
||||
use crate::result::{Error, Result};
|
||||
use solana_sdk::timing::Slot;
|
||||
use solana_sdk::clock::Slot;
|
||||
|
||||
use byteorder::{BigEndian, ByteOrder};
|
||||
|
||||
|
@ -7,9 +7,10 @@ use rayon::ThreadPool;
|
||||
use solana_metrics::{datapoint, datapoint_error, inc_new_counter_debug};
|
||||
use solana_runtime::bank::Bank;
|
||||
use solana_runtime::locked_accounts_results::LockedAccountsResults;
|
||||
use solana_sdk::clock::{Slot, MAX_RECENT_BLOCKHASHES};
|
||||
use solana_sdk::genesis_block::GenesisBlock;
|
||||
use solana_sdk::hash::Hash;
|
||||
use solana_sdk::timing::{duration_as_ms, Slot, MAX_RECENT_BLOCKHASHES};
|
||||
use solana_sdk::timing::duration_as_ms;
|
||||
use solana_sdk::transaction::Result;
|
||||
use std::result;
|
||||
use std::sync::Arc;
|
||||
|
@ -120,9 +120,9 @@ mod tests {
|
||||
use crate::chacha_cuda::chacha_cbc_encrypt_file_many_keys;
|
||||
use crate::entry::make_tiny_test_entries;
|
||||
use crate::replicator::sample_file;
|
||||
use solana_sdk::clock::DEFAULT_SLOTS_PER_SEGMENT;
|
||||
use solana_sdk::hash::Hash;
|
||||
use solana_sdk::signature::{Keypair, KeypairUtil};
|
||||
use solana_sdk::timing::DEFAULT_SLOTS_PER_SEGMENT;
|
||||
use std::fs::{remove_dir_all, remove_file};
|
||||
use std::path::Path;
|
||||
use std::sync::Arc;
|
||||
|
@ -1769,9 +1769,9 @@ mod tests {
|
||||
use crate::result::Error;
|
||||
use crate::shred::{DataShred, Shred};
|
||||
use crate::test_tx::test_tx;
|
||||
use solana_sdk::clock::DEFAULT_TICKS_PER_SLOT;
|
||||
use solana_sdk::hash::Hash;
|
||||
use solana_sdk::signature::{Keypair, KeypairUtil};
|
||||
use solana_sdk::timing::DEFAULT_TICKS_PER_SLOT;
|
||||
use std::collections::HashSet;
|
||||
use std::net::{IpAddr, Ipv4Addr};
|
||||
use std::sync::{Arc, RwLock};
|
||||
|
@ -7,7 +7,7 @@ use crate::result::{Error, Result};
|
||||
use crate::service::Service;
|
||||
use crate::streamer::{self, PacketReceiver, PacketSender};
|
||||
use solana_metrics::{inc_new_counter_debug, inc_new_counter_info};
|
||||
use solana_sdk::timing::DEFAULT_TICKS_PER_SLOT;
|
||||
use solana_sdk::clock::DEFAULT_TICKS_PER_SLOT;
|
||||
use std::net::UdpSocket;
|
||||
use std::sync::atomic::AtomicBool;
|
||||
use std::sync::mpsc::{channel, RecvTimeoutError};
|
||||
|
@ -1,8 +1,8 @@
|
||||
use crate::leader_schedule::LeaderSchedule;
|
||||
use crate::staking_utils;
|
||||
use solana_runtime::bank::Bank;
|
||||
use solana_sdk::clock::NUM_CONSECUTIVE_LEADER_SLOTS;
|
||||
use solana_sdk::pubkey::Pubkey;
|
||||
use solana_sdk::timing::NUM_CONSECUTIVE_LEADER_SLOTS;
|
||||
|
||||
/// Return the leader schedule for the given epoch.
|
||||
pub fn leader_schedule(epoch: u64, bank: &Bank) -> Option<LeaderSchedule> {
|
||||
|
@ -3,8 +3,8 @@
|
||||
use crate::blocktree::Blocktree;
|
||||
use crate::result::{Error, Result};
|
||||
use crate::service::Service;
|
||||
use solana_sdk::clock::DEFAULT_SLOTS_PER_EPOCH;
|
||||
use solana_sdk::pubkey::Pubkey;
|
||||
use solana_sdk::timing::DEFAULT_SLOTS_PER_EPOCH;
|
||||
use std::string::ToString;
|
||||
use std::sync::atomic::{AtomicBool, Ordering};
|
||||
use std::sync::mpsc::{Receiver, RecvTimeoutError};
|
||||
|
@ -16,12 +16,12 @@ use crate::leader_schedule_cache::LeaderScheduleCache;
|
||||
use crate::poh::Poh;
|
||||
use crate::result::{Error, Result};
|
||||
use solana_runtime::bank::Bank;
|
||||
pub use solana_sdk::clock::Slot;
|
||||
use solana_sdk::clock::NUM_CONSECUTIVE_LEADER_SLOTS;
|
||||
use solana_sdk::hash::Hash;
|
||||
use solana_sdk::poh_config::PohConfig;
|
||||
use solana_sdk::pubkey::Pubkey;
|
||||
use solana_sdk::timing;
|
||||
pub use solana_sdk::timing::Slot;
|
||||
use solana_sdk::timing::NUM_CONSECUTIVE_LEADER_SLOTS;
|
||||
use solana_sdk::transaction::Transaction;
|
||||
use std::cmp;
|
||||
use std::sync::mpsc::{channel, Receiver, Sender, SyncSender};
|
||||
@ -447,8 +447,8 @@ mod tests {
|
||||
use crate::blocktree::{get_tmp_ledger_path, Blocktree};
|
||||
use crate::genesis_utils::{create_genesis_block, GenesisBlockInfo};
|
||||
use crate::test_tx::test_tx;
|
||||
use solana_sdk::clock::DEFAULT_TICKS_PER_SLOT;
|
||||
use solana_sdk::hash::hash;
|
||||
use solana_sdk::timing::DEFAULT_TICKS_PER_SLOT;
|
||||
use std::sync::mpsc::sync_channel;
|
||||
|
||||
#[test]
|
||||
|
@ -27,10 +27,11 @@ use solana_ed25519_dalek as ed25519_dalek;
|
||||
use solana_netutil::bind_in_range;
|
||||
use solana_sdk::account_utils::State;
|
||||
use solana_sdk::client::{AsyncClient, SyncClient};
|
||||
use solana_sdk::clock::{get_complete_segment_from_slot, get_segment_from_slot};
|
||||
use solana_sdk::hash::{Hash, Hasher};
|
||||
use solana_sdk::message::Message;
|
||||
use solana_sdk::signature::{Keypair, KeypairUtil, Signature};
|
||||
use solana_sdk::timing::{get_complete_segment_from_slot, get_segment_from_slot, timestamp};
|
||||
use solana_sdk::timing::timestamp;
|
||||
use solana_sdk::transaction::Transaction;
|
||||
use solana_sdk::transport::TransportError;
|
||||
use solana_storage_api::storage_contract::StorageContract;
|
||||
|
@ -15,12 +15,12 @@ use solana_runtime::bank::Bank;
|
||||
use solana_runtime::storage_utils::replicator_accounts;
|
||||
use solana_sdk::account::Account;
|
||||
use solana_sdk::account_utils::State;
|
||||
use solana_sdk::clock::get_segment_from_slot;
|
||||
use solana_sdk::hash::Hash;
|
||||
use solana_sdk::instruction::Instruction;
|
||||
use solana_sdk::message::Message;
|
||||
use solana_sdk::pubkey::Pubkey;
|
||||
use solana_sdk::signature::{Keypair, KeypairUtil, Signature};
|
||||
use solana_sdk::timing::get_segment_from_slot;
|
||||
use solana_sdk::transaction::Transaction;
|
||||
use solana_storage_api::storage_contract::{Proof, ProofStatus, StorageContract};
|
||||
use solana_storage_api::storage_instruction;
|
||||
@ -638,10 +638,10 @@ mod tests {
|
||||
use crate::{blocktree_processor, entry};
|
||||
use rayon::prelude::*;
|
||||
use solana_runtime::bank::Bank;
|
||||
use solana_sdk::clock::DEFAULT_TICKS_PER_SLOT;
|
||||
use solana_sdk::hash::{Hash, Hasher};
|
||||
use solana_sdk::pubkey::Pubkey;
|
||||
use solana_sdk::signature::{Keypair, KeypairUtil};
|
||||
use solana_sdk::timing::DEFAULT_TICKS_PER_SLOT;
|
||||
use std::cmp::{max, min};
|
||||
use std::fs::remove_dir_all;
|
||||
use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering};
|
||||
|
@ -21,12 +21,14 @@ use crate::storage_stage::StorageState;
|
||||
use crate::tpu::Tpu;
|
||||
use crate::tvu::{Sockets, Tvu};
|
||||
use solana_metrics::datapoint_info;
|
||||
use solana_sdk::clock::{Slot, DEFAULT_SLOTS_PER_TURN};
|
||||
use solana_sdk::genesis_block::GenesisBlock;
|
||||
use solana_sdk::hash::Hash;
|
||||
use solana_sdk::poh_config::PohConfig;
|
||||
use solana_sdk::pubkey::Pubkey;
|
||||
use solana_sdk::signature::{Keypair, KeypairUtil};
|
||||
use solana_sdk::timing::{timestamp, Slot, DEFAULT_SLOTS_PER_TURN};
|
||||
use solana_sdk::timing::timestamp;
|
||||
|
||||
use std::fs;
|
||||
use std::net::{IpAddr, Ipv4Addr, SocketAddr};
|
||||
use std::path::{Path, PathBuf};
|
||||
|
@ -63,7 +63,7 @@ fn test_rpc_send_tx() {
|
||||
"params": [signature],
|
||||
});
|
||||
|
||||
for _ in 0..solana_sdk::timing::DEFAULT_TICKS_PER_SLOT {
|
||||
for _ in 0..solana_sdk::clock::DEFAULT_TICKS_PER_SLOT {
|
||||
let response = client
|
||||
.post(&rpc_string)
|
||||
.set("Content-Type", "application/json")
|
||||
|
Reference in New Issue
Block a user