Skip to content

Commit

Permalink
Maximize timekeeper thread priority
Browse files Browse the repository at this point in the history
  • Loading branch information
nazar-pc committed Feb 28, 2024
1 parent 78f2f67 commit d14691d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions crates/sc-proof-of-time/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ derive_more = "0.99.17"
futures = "0.3.29"
lru = "0.12.1"
parity-scale-codec = { version = "3.6.9", features = ["derive"] }
parking_lot = "0.12.1"
rayon = "1.8.1"
sc-client-api = { version = "4.0.0-dev", git = "https://github.com/subspace/polkadot-sdk", rev = "d6b500960579d73c43fc4ef550b703acfa61c4c8" }
sc-consensus-slots = { version = "0.10.0-dev", git = "https://github.com/subspace/polkadot-sdk", rev = "d6b500960579d73c43fc4ef550b703acfa61c4c8" }
sc-network = { version = "0.10.0-dev", git = "https://github.com/subspace/polkadot-sdk", rev = "d6b500960579d73c43fc4ef550b703acfa61c4c8" }
Expand All @@ -30,6 +32,5 @@ sp-inherents = { version = "4.0.0-dev", git = "https://github.com/subspace/polka
sp-runtime = { version = "24.0.0", git = "https://github.com/subspace/polkadot-sdk", rev = "d6b500960579d73c43fc4ef550b703acfa61c4c8" }
subspace-core-primitives = { version = "0.1.0", path = "../subspace-core-primitives" }
subspace-proof-of-time = { version = "0.1.0", path = "../subspace-proof-of-time" }
parking_lot = "0.12.1"
rayon = "1.8.1"
tracing = "0.1.40"
thread-priority = "0.16.0"
9 changes: 9 additions & 0 deletions crates/sc-proof-of-time/src/source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ use std::marker::PhantomData;
use std::sync::Arc;
use std::thread;
use subspace_core_primitives::PotCheckpoints;
use thread_priority::{set_current_thread_priority, ThreadPriority};
use tracing::{debug, error, trace, warn};

const LOCAL_PROOFS_CHANNEL_CAPACITY: usize = 10;
Expand Down Expand Up @@ -150,6 +151,14 @@ where
}
}

if let Err(error) = set_current_thread_priority(ThreadPriority::Max) {
warn!(
%error,
"Failed to set thread priority, timekeeper performance may be \
negatively impacted by other software running on this machine",
);
}

if let Err(error) =
run_timekeeper(state, pot_verifier, timekeeper_proofs_sender)
{
Expand Down

0 comments on commit d14691d

Please sign in to comment.