mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 08:11:03 +00:00
Add hardware benchmark telemetry (Companion for Substrate#11062) (#5206)
* Align to changes in Substrate * Align to the newest changes in substrate * Rename `--disable-hardware-benchmarks` to `--no-hardware-benchmarks` * Fix `polkadot-test-service` compilation * Fix compilation of test parachains
This commit is contained in:
Generated
+2
@@ -6422,6 +6422,7 @@ dependencies = [
|
||||
"pyroscope",
|
||||
"sc-cli",
|
||||
"sc-service",
|
||||
"sc-sysinfo",
|
||||
"sc-tracing",
|
||||
"sp-core",
|
||||
"sp-trie",
|
||||
@@ -7557,6 +7558,7 @@ dependencies = [
|
||||
"sc-offchain",
|
||||
"sc-service",
|
||||
"sc-sync-state-rpc",
|
||||
"sc-sysinfo",
|
||||
"sc-telemetry",
|
||||
"sc-transaction-pool",
|
||||
"serde",
|
||||
|
||||
@@ -32,6 +32,7 @@ sc-cli = { git = "https://github.com/paritytech/substrate", branch = "master", o
|
||||
sc-service = { git = "https://github.com/paritytech/substrate", branch = "master", optional = true }
|
||||
polkadot-node-metrics = { path = "../node/metrics" }
|
||||
sc-tracing = { git = "https://github.com/paritytech/substrate", branch = "master", optional = true }
|
||||
sc-sysinfo = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
|
||||
# this crate is used only to enable `trie-memory-tracker` feature
|
||||
# see https://github.com/paritytech/substrate/pull/6745
|
||||
|
||||
@@ -128,6 +128,16 @@ pub struct RunCmd {
|
||||
/// commonly `127.0.0.1:4040`.
|
||||
#[clap(long)]
|
||||
pub pyroscope_server: Option<String>,
|
||||
|
||||
/// Disable automatic hardware benchmarks.
|
||||
///
|
||||
/// By default these benchmarks are automatically ran at startup and measure
|
||||
/// the CPU speed, the memory bandwidth and the disk speed.
|
||||
///
|
||||
/// The results are then printed out in the logs, and also sent as part of
|
||||
/// telemetry, if telemetry is enabled.
|
||||
#[clap(long)]
|
||||
pub no_hardware_benchmarks: bool,
|
||||
}
|
||||
|
||||
#[allow(missing_docs)]
|
||||
|
||||
@@ -302,6 +302,15 @@ where
|
||||
};
|
||||
|
||||
runner.run_node_until_exit(move |config| async move {
|
||||
let hwbench = if !cli.run.no_hardware_benchmarks {
|
||||
config.database.path().map(|database_path| {
|
||||
let _ = std::fs::create_dir_all(&database_path);
|
||||
sc_sysinfo::gather_hwbench(Some(database_path))
|
||||
})
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
||||
let role = config.role.clone();
|
||||
|
||||
match role {
|
||||
@@ -315,6 +324,7 @@ where
|
||||
None,
|
||||
false,
|
||||
overseer_gen,
|
||||
hwbench,
|
||||
)
|
||||
.map(|full| full.task_manager)
|
||||
.map_err(Into::into),
|
||||
|
||||
@@ -25,6 +25,7 @@ sc-sync-state-rpc = { git = "https://github.com/paritytech/substrate", branch =
|
||||
sc-keystore = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
sc-basic-authorship = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
sc-offchain = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
sc-sysinfo = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
service = { package = "sc-service", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||
telemetry = { package = "sc-telemetry", git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
|
||||
|
||||
@@ -681,6 +681,7 @@ pub fn new_full<RuntimeApi, ExecutorDispatch, OverseerGenerator>(
|
||||
program_path: Option<std::path::PathBuf>,
|
||||
overseer_enable_anyways: bool,
|
||||
overseer_gen: OverseerGenerator,
|
||||
hwbench: Option<sc_sysinfo::HwBench>,
|
||||
) -> Result<NewFull<Arc<FullClient<RuntimeApi, ExecutorDispatch>>>, Error>
|
||||
where
|
||||
RuntimeApi: ConstructRuntimeApi<Block, FullClient<RuntimeApi, ExecutorDispatch>>
|
||||
@@ -920,6 +921,19 @@ where
|
||||
telemetry: telemetry.as_mut(),
|
||||
})?;
|
||||
|
||||
if let Some(hwbench) = hwbench {
|
||||
sc_sysinfo::print_hwbench(&hwbench);
|
||||
|
||||
if let Some(ref mut telemetry) = telemetry {
|
||||
let telemetry_handle = telemetry.handle();
|
||||
task_manager.spawn_handle().spawn(
|
||||
"telemetry_hwbench",
|
||||
None,
|
||||
sc_sysinfo::initialize_hwbench_telemetry(telemetry_handle, hwbench),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
let (block_import, link_half, babe_link, beefy_links) = import_setup;
|
||||
|
||||
let overseer_client = client.clone();
|
||||
@@ -1290,6 +1304,7 @@ pub fn build_full(
|
||||
telemetry_worker_handle: Option<TelemetryWorkerHandle>,
|
||||
overseer_enable_anyways: bool,
|
||||
overseer_gen: impl OverseerGen,
|
||||
hwbench: Option<sc_sysinfo::HwBench>,
|
||||
) -> Result<NewFull<Client>, Error> {
|
||||
#[cfg(feature = "rococo-native")]
|
||||
if config.chain_spec.is_rococo() ||
|
||||
@@ -1306,6 +1321,7 @@ pub fn build_full(
|
||||
None,
|
||||
overseer_enable_anyways,
|
||||
overseer_gen,
|
||||
hwbench,
|
||||
)
|
||||
.map(|full| full.with_client(Client::Rococo))
|
||||
}
|
||||
@@ -1322,6 +1338,7 @@ pub fn build_full(
|
||||
None,
|
||||
overseer_enable_anyways,
|
||||
overseer_gen,
|
||||
hwbench,
|
||||
)
|
||||
.map(|full| full.with_client(Client::Kusama))
|
||||
}
|
||||
@@ -1338,6 +1355,7 @@ pub fn build_full(
|
||||
None,
|
||||
overseer_enable_anyways,
|
||||
overseer_gen,
|
||||
hwbench,
|
||||
)
|
||||
.map(|full| full.with_client(Client::Westend))
|
||||
}
|
||||
@@ -1354,6 +1372,7 @@ pub fn build_full(
|
||||
None,
|
||||
overseer_enable_anyways,
|
||||
overseer_gen,
|
||||
hwbench,
|
||||
)
|
||||
.map(|full| full.with_client(Client::Polkadot))
|
||||
}
|
||||
|
||||
@@ -97,6 +97,7 @@ pub fn new_full(
|
||||
worker_program_path,
|
||||
false,
|
||||
polkadot_service::RealOverseerGen,
|
||||
None,
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -70,6 +70,7 @@ fn main() -> Result<()> {
|
||||
None,
|
||||
false,
|
||||
polkadot_service::RealOverseerGen,
|
||||
None,
|
||||
)
|
||||
.map_err(|e| e.to_string())?;
|
||||
let mut overseer_handle = full_node
|
||||
|
||||
@@ -70,6 +70,7 @@ fn main() -> Result<()> {
|
||||
None,
|
||||
false,
|
||||
polkadot_service::RealOverseerGen,
|
||||
None,
|
||||
)
|
||||
.map_err(|e| e.to_string())?;
|
||||
let mut overseer_handle = full_node
|
||||
|
||||
@@ -35,6 +35,7 @@ async fn purge_chain_rocksdb_works() {
|
||||
.arg(tmpdir.path())
|
||||
.arg("--port")
|
||||
.arg("33034")
|
||||
.arg("--no-hardware-benchmarks")
|
||||
.spawn()
|
||||
.unwrap();
|
||||
|
||||
@@ -78,6 +79,7 @@ async fn purge_chain_paritydb_works() {
|
||||
.arg(tmpdir.path())
|
||||
.arg("--database")
|
||||
.arg("paritydb-experimental")
|
||||
.arg("--no-hardware-benchmarks")
|
||||
.spawn()
|
||||
.unwrap();
|
||||
|
||||
|
||||
@@ -37,6 +37,7 @@ async fn running_the_node_works_and_can_be_interrupted() {
|
||||
let mut cmd = Command::new(cargo_bin("polkadot"))
|
||||
.args(&["--dev", "-d"])
|
||||
.arg(tmpdir.path())
|
||||
.arg("--no-hardware-benchmarks")
|
||||
.spawn()
|
||||
.unwrap();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user