replay stage feed back program cost (#17731)
* replay stage feeds back realtime per-program execution cost to cost model; * program cost execution table is initialized into empty table, no longer populated with hardcoded numbers; * changed cost unit to microsecond, using value collected from mainnet; * add ExecuteCostTable with fixed capacity for security concern, when its limit is reached, programs with old age AND less occurrence will be pushed out to make room for new programs.
This commit is contained in:
@@ -34,7 +34,7 @@ use solana_sdk::transaction::Transaction;
|
||||
use std::collections::VecDeque;
|
||||
use std::sync::atomic::Ordering;
|
||||
use std::sync::mpsc::Receiver;
|
||||
use std::sync::{Arc, Mutex};
|
||||
use std::sync::{Arc, Mutex, RwLock};
|
||||
use std::time::{Duration, Instant};
|
||||
use test::Bencher;
|
||||
|
||||
@@ -93,8 +93,8 @@ fn bench_consume_buffered(bencher: &mut Bencher) {
|
||||
None::<Box<dyn Fn()>>,
|
||||
&BankingStageStats::default(),
|
||||
&recorder,
|
||||
&Arc::new(CostModel::default()),
|
||||
&Arc::new(Mutex::new(CostTracker::new(std::u32::MAX, std::u32::MAX))),
|
||||
&Arc::new(RwLock::new(CostModel::default())),
|
||||
&Arc::new(Mutex::new(CostTracker::new(std::u64::MAX, std::u64::MAX))),
|
||||
);
|
||||
});
|
||||
|
||||
@@ -215,8 +215,7 @@ fn bench_banking(bencher: &mut Bencher, tx_type: TransactionType) {
|
||||
vote_receiver,
|
||||
None,
|
||||
s,
|
||||
std::u32::MAX,
|
||||
std::u32::MAX,
|
||||
&Arc::new(RwLock::new(CostModel::new(std::u64::MAX, std::u64::MAX))),
|
||||
);
|
||||
poh_recorder.lock().unwrap().set_bank(&bank);
|
||||
|
||||
|
Reference in New Issue
Block a user