mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 10:31: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",
|
"pyroscope",
|
||||||
"sc-cli",
|
"sc-cli",
|
||||||
"sc-service",
|
"sc-service",
|
||||||
|
"sc-sysinfo",
|
||||||
"sc-tracing",
|
"sc-tracing",
|
||||||
"sp-core",
|
"sp-core",
|
||||||
"sp-trie",
|
"sp-trie",
|
||||||
@@ -7557,6 +7558,7 @@ dependencies = [
|
|||||||
"sc-offchain",
|
"sc-offchain",
|
||||||
"sc-service",
|
"sc-service",
|
||||||
"sc-sync-state-rpc",
|
"sc-sync-state-rpc",
|
||||||
|
"sc-sysinfo",
|
||||||
"sc-telemetry",
|
"sc-telemetry",
|
||||||
"sc-transaction-pool",
|
"sc-transaction-pool",
|
||||||
"serde",
|
"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 }
|
sc-service = { git = "https://github.com/paritytech/substrate", branch = "master", optional = true }
|
||||||
polkadot-node-metrics = { path = "../node/metrics" }
|
polkadot-node-metrics = { path = "../node/metrics" }
|
||||||
sc-tracing = { git = "https://github.com/paritytech/substrate", branch = "master", optional = true }
|
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
|
# this crate is used only to enable `trie-memory-tracker` feature
|
||||||
# see https://github.com/paritytech/substrate/pull/6745
|
# see https://github.com/paritytech/substrate/pull/6745
|
||||||
|
|||||||
@@ -128,6 +128,16 @@ pub struct RunCmd {
|
|||||||
/// commonly `127.0.0.1:4040`.
|
/// commonly `127.0.0.1:4040`.
|
||||||
#[clap(long)]
|
#[clap(long)]
|
||||||
pub pyroscope_server: Option<String>,
|
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)]
|
#[allow(missing_docs)]
|
||||||
|
|||||||
@@ -302,6 +302,15 @@ where
|
|||||||
};
|
};
|
||||||
|
|
||||||
runner.run_node_until_exit(move |config| async move {
|
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();
|
let role = config.role.clone();
|
||||||
|
|
||||||
match role {
|
match role {
|
||||||
@@ -315,6 +324,7 @@ where
|
|||||||
None,
|
None,
|
||||||
false,
|
false,
|
||||||
overseer_gen,
|
overseer_gen,
|
||||||
|
hwbench,
|
||||||
)
|
)
|
||||||
.map(|full| full.task_manager)
|
.map(|full| full.task_manager)
|
||||||
.map_err(Into::into),
|
.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-keystore = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||||
sc-basic-authorship = { 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-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 }
|
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" }
|
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>,
|
program_path: Option<std::path::PathBuf>,
|
||||||
overseer_enable_anyways: bool,
|
overseer_enable_anyways: bool,
|
||||||
overseer_gen: OverseerGenerator,
|
overseer_gen: OverseerGenerator,
|
||||||
|
hwbench: Option<sc_sysinfo::HwBench>,
|
||||||
) -> Result<NewFull<Arc<FullClient<RuntimeApi, ExecutorDispatch>>>, Error>
|
) -> Result<NewFull<Arc<FullClient<RuntimeApi, ExecutorDispatch>>>, Error>
|
||||||
where
|
where
|
||||||
RuntimeApi: ConstructRuntimeApi<Block, FullClient<RuntimeApi, ExecutorDispatch>>
|
RuntimeApi: ConstructRuntimeApi<Block, FullClient<RuntimeApi, ExecutorDispatch>>
|
||||||
@@ -920,6 +921,19 @@ where
|
|||||||
telemetry: telemetry.as_mut(),
|
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 (block_import, link_half, babe_link, beefy_links) = import_setup;
|
||||||
|
|
||||||
let overseer_client = client.clone();
|
let overseer_client = client.clone();
|
||||||
@@ -1290,6 +1304,7 @@ pub fn build_full(
|
|||||||
telemetry_worker_handle: Option<TelemetryWorkerHandle>,
|
telemetry_worker_handle: Option<TelemetryWorkerHandle>,
|
||||||
overseer_enable_anyways: bool,
|
overseer_enable_anyways: bool,
|
||||||
overseer_gen: impl OverseerGen,
|
overseer_gen: impl OverseerGen,
|
||||||
|
hwbench: Option<sc_sysinfo::HwBench>,
|
||||||
) -> Result<NewFull<Client>, Error> {
|
) -> Result<NewFull<Client>, Error> {
|
||||||
#[cfg(feature = "rococo-native")]
|
#[cfg(feature = "rococo-native")]
|
||||||
if config.chain_spec.is_rococo() ||
|
if config.chain_spec.is_rococo() ||
|
||||||
@@ -1306,6 +1321,7 @@ pub fn build_full(
|
|||||||
None,
|
None,
|
||||||
overseer_enable_anyways,
|
overseer_enable_anyways,
|
||||||
overseer_gen,
|
overseer_gen,
|
||||||
|
hwbench,
|
||||||
)
|
)
|
||||||
.map(|full| full.with_client(Client::Rococo))
|
.map(|full| full.with_client(Client::Rococo))
|
||||||
}
|
}
|
||||||
@@ -1322,6 +1338,7 @@ pub fn build_full(
|
|||||||
None,
|
None,
|
||||||
overseer_enable_anyways,
|
overseer_enable_anyways,
|
||||||
overseer_gen,
|
overseer_gen,
|
||||||
|
hwbench,
|
||||||
)
|
)
|
||||||
.map(|full| full.with_client(Client::Kusama))
|
.map(|full| full.with_client(Client::Kusama))
|
||||||
}
|
}
|
||||||
@@ -1338,6 +1355,7 @@ pub fn build_full(
|
|||||||
None,
|
None,
|
||||||
overseer_enable_anyways,
|
overseer_enable_anyways,
|
||||||
overseer_gen,
|
overseer_gen,
|
||||||
|
hwbench,
|
||||||
)
|
)
|
||||||
.map(|full| full.with_client(Client::Westend))
|
.map(|full| full.with_client(Client::Westend))
|
||||||
}
|
}
|
||||||
@@ -1354,6 +1372,7 @@ pub fn build_full(
|
|||||||
None,
|
None,
|
||||||
overseer_enable_anyways,
|
overseer_enable_anyways,
|
||||||
overseer_gen,
|
overseer_gen,
|
||||||
|
hwbench,
|
||||||
)
|
)
|
||||||
.map(|full| full.with_client(Client::Polkadot))
|
.map(|full| full.with_client(Client::Polkadot))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -97,6 +97,7 @@ pub fn new_full(
|
|||||||
worker_program_path,
|
worker_program_path,
|
||||||
false,
|
false,
|
||||||
polkadot_service::RealOverseerGen,
|
polkadot_service::RealOverseerGen,
|
||||||
|
None,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -70,6 +70,7 @@ fn main() -> Result<()> {
|
|||||||
None,
|
None,
|
||||||
false,
|
false,
|
||||||
polkadot_service::RealOverseerGen,
|
polkadot_service::RealOverseerGen,
|
||||||
|
None,
|
||||||
)
|
)
|
||||||
.map_err(|e| e.to_string())?;
|
.map_err(|e| e.to_string())?;
|
||||||
let mut overseer_handle = full_node
|
let mut overseer_handle = full_node
|
||||||
|
|||||||
@@ -70,6 +70,7 @@ fn main() -> Result<()> {
|
|||||||
None,
|
None,
|
||||||
false,
|
false,
|
||||||
polkadot_service::RealOverseerGen,
|
polkadot_service::RealOverseerGen,
|
||||||
|
None,
|
||||||
)
|
)
|
||||||
.map_err(|e| e.to_string())?;
|
.map_err(|e| e.to_string())?;
|
||||||
let mut overseer_handle = full_node
|
let mut overseer_handle = full_node
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ async fn purge_chain_rocksdb_works() {
|
|||||||
.arg(tmpdir.path())
|
.arg(tmpdir.path())
|
||||||
.arg("--port")
|
.arg("--port")
|
||||||
.arg("33034")
|
.arg("33034")
|
||||||
|
.arg("--no-hardware-benchmarks")
|
||||||
.spawn()
|
.spawn()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
@@ -78,6 +79,7 @@ async fn purge_chain_paritydb_works() {
|
|||||||
.arg(tmpdir.path())
|
.arg(tmpdir.path())
|
||||||
.arg("--database")
|
.arg("--database")
|
||||||
.arg("paritydb-experimental")
|
.arg("paritydb-experimental")
|
||||||
|
.arg("--no-hardware-benchmarks")
|
||||||
.spawn()
|
.spawn()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ async fn running_the_node_works_and_can_be_interrupted() {
|
|||||||
let mut cmd = Command::new(cargo_bin("polkadot"))
|
let mut cmd = Command::new(cargo_bin("polkadot"))
|
||||||
.args(&["--dev", "-d"])
|
.args(&["--dev", "-d"])
|
||||||
.arg(tmpdir.path())
|
.arg(tmpdir.path())
|
||||||
|
.arg("--no-hardware-benchmarks")
|
||||||
.spawn()
|
.spawn()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user