This repository has been archived by the owner on Jan 13, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(cherry picked from commit 0bda0c3)
- Loading branch information
Showing
5 changed files
with
64 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
use solana_measure::measure::Measure; | ||
use solana_runtime::bank::Bank; | ||
use std::{ | ||
sync::{mpsc::Receiver, Arc}, | ||
thread::{self, Builder, JoinHandle}, | ||
}; | ||
|
||
pub struct DropBankService { | ||
thread_hdl: JoinHandle<()>, | ||
} | ||
|
||
impl DropBankService { | ||
pub fn new(bank_receiver: Receiver<Vec<Arc<Bank>>>) -> Self { | ||
let thread_hdl = Builder::new() | ||
.name("sol-drop-b-service".to_string()) | ||
.spawn(move || { | ||
for banks in bank_receiver.iter() { | ||
let len = banks.len(); | ||
let mut dropped_banks_time = Measure::start("drop_banks"); | ||
drop(banks); | ||
dropped_banks_time.stop(); | ||
if dropped_banks_time.as_ms() > 10 { | ||
datapoint_info!( | ||
"handle_new_root-dropped_banks", | ||
("elapsed_ms", dropped_banks_time.as_ms(), i64), | ||
("len", len, i64) | ||
); | ||
} | ||
} | ||
}) | ||
.unwrap(); | ||
Self { thread_hdl } | ||
} | ||
|
||
pub fn join(self) -> thread::Result<()> { | ||
self.thread_hdl.join() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters