Add CPU affinity for PoH service thread (#4394)

automerge
This commit is contained in:
Pankaj Garg
2019-05-22 14:21:43 -07:00
committed by Grimes
parent 190656967d
commit eef2bdf690
3 changed files with 18 additions and 0 deletions

View File

@ -2,6 +2,7 @@
//! "ticks", a measure of time in the PoH stream
use crate::poh_recorder::PohRecorder;
use crate::service::Service;
use core_affinity;
use solana_sdk::poh_config::PohConfig;
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::{Arc, Mutex};
@ -33,6 +34,9 @@ impl PohService {
if poh_config.hashes_per_tick.is_none() {
Self::sleepy_tick_producer(poh_recorder, &poh_config, &poh_exit_);
} else {
if let Some(cores) = core_affinity::get_core_ids() {
core_affinity::set_for_current(cores[0]);
}
Self::tick_producer(poh_recorder, &poh_exit_);
}
poh_exit_.store(true, Ordering::Relaxed);