Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
dccce70
Add new hardware and software metrics
koute Mar 18, 2022
99633f9
Move sysinfo tests into `mod tests`
koute Mar 23, 2022
55c7358
Correct a typo in a comment
koute Mar 23, 2022
909df21
Remove unnecessary `nix` dependency
koute Mar 23, 2022
706e4d3
Fix the version tests
koute Mar 23, 2022
c1e409f
Add a `--disable-hardware-benchmarks` CLI argument
koute Mar 24, 2022
a05159a
Disable hardware benchmarks in the integration tests
koute Mar 25, 2022
fff4573
Remove unused import
koute Mar 25, 2022
3d15f0e
Fix benchmarks compilation
koute Mar 25, 2022
a8c71c1
Merge remote-tracking branch 'origin/master' into master_hwswinfo
koute Mar 25, 2022
d215b39
Move code to a new `sc-sysinfo` crate
koute Mar 28, 2022
c1da1fa
Correct `impl_version` comment
koute Mar 28, 2022
b98bcfa
Move `--disable-hardware-benchmarks` to the chain-specific bin crate
koute Mar 28, 2022
0d25408
Move printing out of hardware bench results to `sc-sysinfo`
koute Mar 28, 2022
46c9de2
Move hardware benchmarks to a separate messages; trigger them manually
koute Mar 29, 2022
56a1e3a
Rename some of the fields in the `HwBench` struct
koute Mar 31, 2022
457b4da
Revert changes to the telemetry crate; manually send hwbench messages
koute Apr 4, 2022
bb26cfa
Move sysinfo logs into the sysinfo crate
koute Apr 4, 2022
77f9c5f
Move the `TARGET_OS_*` constants into the sysinfo crate
koute Apr 4, 2022
73b230a
Minor cleanups
koute Apr 5, 2022
c3214e5
Move the `HwBench` struct to the sysinfo crate
koute Apr 5, 2022
b6d78a0
Derive `Clone` for `HwBench`
koute Apr 5, 2022
19f43ab
Fix broken telemetry connection notification stream
koute Apr 5, 2022
15e5f9e
Prevent the telemetry connection notifiers from leaking if they're di…
koute Apr 5, 2022
e5f210f
Turn the telemetry notification failure log into a debug log
koute Apr 6, 2022
0cafbf8
Rename `--disable-hardware-benchmarks` to `--no-hardware-benchmarks`
koute Apr 6, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Move hardware benchmarks to a separate messages; trigger them manually
  • Loading branch information
koute committed Mar 29, 2022
commit 46c9de235d2cc79f2a7396b172868c623a37373c
14 changes: 5 additions & 9 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions bin/node/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ sc-telemetry = { version = "4.0.0-dev", path = "../../../client/telemetry" }
sc-executor = { version = "0.10.0-dev", path = "../../../client/executor" }
sc-authority-discovery = { version = "0.10.0-dev", path = "../../../client/authority-discovery" }
sc-sync-state-rpc = { version = "0.10.0-dev", path = "../../../client/sync-state-rpc" }
sc-sysinfo = { version = "6.0.0-dev", path = "../../../client/sysinfo" }

# frame dependencies
frame-system = { version = "4.0.0-dev", path = "../../../frame/system" }
Expand Down
4 changes: 2 additions & 2 deletions bin/node/cli/benches/block_production.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,10 @@ fn new_node(tokio_handle: Handle) -> node_cli::service::NewFullBase {
base_path: Some(base_path),
informant_output_format: Default::default(),
wasm_runtime_overrides: None,
disable_hardware_benchmarks: true,
};

node_cli::service::new_full_base(config, |_, _| ()).expect("creating a full node doesn't fail")
node_cli::service::new_full_base(config, false, |_, _| ())
.expect("creating a full node doesn't fail")
}

fn extrinsic_set_time(now: u64) -> OpaqueExtrinsic {
Expand Down
3 changes: 1 addition & 2 deletions bin/node/cli/benches/transaction_pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,9 @@ fn new_node(tokio_handle: Handle) -> node_cli::service::NewFullBase {
base_path: Some(base_path),
informant_output_format: Default::default(),
wasm_runtime_overrides: None,
disable_hardware_benchmarks: true,
};

node_cli::service::new_full_base(config, |_, _| ()).expect("Creates node")
node_cli::service::new_full_base(config, false, |_, _| ()).expect("Creates node")
}

fn create_accounts(num: usize) -> Vec<sr25519::Pair> {
Expand Down
2 changes: 1 addition & 1 deletion bin/node/cli/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ pub(crate) mod tests {

sc_service_test::connectivity(integration_test_config_with_two_authorities(), |config| {
let NewFullBase { task_manager, client, network, transaction_pool, .. } =
new_full_base(config, |_, _| ())?;
new_full_base(config, false, |_, _| ())?;
Ok(sc_service_test::TestNetComponents::new(
task_manager,
client,
Expand Down
6 changes: 3 additions & 3 deletions bin/node/cli/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ pub fn run() -> Result<()> {
match &cli.subcommand {
None => {
let runner = cli.create_runner(&cli.run)?;
runner.run_node_until_exit(|mut config| async move {
config.disable_hardware_benchmarks = cli.disable_hardware_benchmarks;
service::new_full(config).map_err(sc_cli::Error::Service)
runner.run_node_until_exit(|config| async move {
service::new_full(config, cli.disable_hardware_benchmarks)
.map_err(sc_cli::Error::Service)
})
},
Some(Subcommand::Inspect(cmd)) => {
Expand Down
29 changes: 26 additions & 3 deletions bin/node/cli/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -309,11 +309,21 @@ pub struct NewFullBase {
/// Creates a full service from the configuration.
pub fn new_full_base(
mut config: Configuration,
disable_hardware_benchmarks: bool,
with_startup_data: impl FnOnce(
&sc_consensus_babe::BabeBlockImport<Block, FullClient, FullGrandpaBlockImport>,
&sc_consensus_babe::BabeLink<Block>,
),
) -> Result<NewFullBase, ServiceError> {
let hwbench = if !disable_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 sc_service::PartialComponents {
client,
backend,
Expand Down Expand Up @@ -383,6 +393,14 @@ pub fn new_full_base(
telemetry: telemetry.as_mut(),
})?;

if let Some(hwbench) = hwbench {
sc_sysinfo::print_hwbench(&hwbench);

if let Some(ref mut telemetry) = telemetry {
telemetry.handle().send_hwbench(hwbench);
}
}

let (block_import, grandpa_link, babe_link) = import_setup;

(with_startup_data)(&block_import, &babe_link);
Expand Down Expand Up @@ -530,8 +548,12 @@ pub fn new_full_base(
}

/// Builds a new service for a full client.
pub fn new_full(config: Configuration) -> Result<TaskManager, ServiceError> {
new_full_base(config, |_, _| ()).map(|NewFullBase { task_manager, .. }| task_manager)
pub fn new_full(
config: Configuration,
disable_hardware_benchmarks: bool,
) -> Result<TaskManager, ServiceError> {
new_full_base(config, disable_hardware_benchmarks, |_, _| ())
.map(|NewFullBase { task_manager, .. }| task_manager)
}

#[cfg(test)]
Expand Down Expand Up @@ -598,6 +620,7 @@ mod tests {
let NewFullBase { task_manager, client, network, transaction_pool, .. } =
new_full_base(
config,
false,
|block_import: &sc_consensus_babe::BabeBlockImport<Block, _, _>,
babe_link: &sc_consensus_babe::BabeLink<Block>| {
setup_handles = Some((block_import.clone(), babe_link.clone()));
Expand Down Expand Up @@ -775,7 +798,7 @@ mod tests {
crate::chain_spec::tests::integration_test_config_with_two_authorities(),
|config| {
let NewFullBase { task_manager, client, network, transaction_pool, .. } =
new_full_base(config, |_, _| ())?;
new_full_base(config, false, |_, _| ())?;
Ok(sc_service_test::TestNetComponents::new(
task_manager,
client,
Expand Down
1 change: 0 additions & 1 deletion client/cli/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,6 @@ pub trait CliConfiguration<DCV: DefaultConfigurationValues = ()>: Sized {
base_path: Some(base_path),
informant_output_format: Default::default(),
runtime_cache_size,
disable_hardware_benchmarks: true,
})
}

Expand Down
32 changes: 1 addition & 31 deletions client/service/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -491,24 +491,7 @@ where
)
.map_err(|e| Error::Application(Box::new(e)))?;

let database_path = match config.database {
sc_client_db::DatabaseSource::Auto { ref paritydb_path, ref rocksdb_path, .. } =>
if rocksdb_path.exists() {
Some(rocksdb_path.as_path())
} else {
Some(paritydb_path.as_path())
},
sc_client_db::DatabaseSource::RocksDb { ref path, .. } |
sc_client_db::DatabaseSource::ParityDb { ref path, .. } => Some(path.as_path()),
sc_client_db::DatabaseSource::Custom { .. } => None,
};

let sysinfo = sc_sysinfo::gather_sysinfo();
let hwbench = if config.disable_hardware_benchmarks {
None
} else {
Some(sc_sysinfo::gather_hwbench(database_path))
};

info!("💻 Operating system: {}", TARGET_OS);
info!("💻 CPU architecture: {}", TARGET_ARCH);
Expand All @@ -534,20 +517,9 @@ where
info!("💻 Virtual machine: {}", if is_virtual_machine { "yes" } else { "no" });
}

if let Some(ref hwbench) = hwbench {
sc_sysinfo::print_hwbench(hwbench);
}

let telemetry = telemetry
.map(|telemetry| {
init_telemetry(
&mut config,
network.clone(),
client.clone(),
telemetry,
Some(sysinfo),
hwbench,
)
init_telemetry(&mut config, network.clone(), client.clone(), telemetry, Some(sysinfo))
})
.transpose()?;

Expand Down Expand Up @@ -670,7 +642,6 @@ fn init_telemetry<TBl: BlockT, TCl: BlockBackend<TBl>>(
client: Arc<TCl>,
telemetry: &mut Telemetry,
sysinfo: Option<sc_telemetry::SysInfo>,
hwbench: Option<sc_telemetry::HwBench>,
) -> sc_telemetry::Result<TelemetryHandle> {
let genesis_hash = client.block_hash(Zero::zero()).ok().flatten().unwrap_or_default();
let connection_message = ConnectionMessage {
Expand All @@ -691,7 +662,6 @@ fn init_telemetry<TBl: BlockT, TCl: BlockBackend<TBl>>(
.to_string(),
network_id: network.local_peer_id().to_base58(),
sysinfo,
hwbench,
};

telemetry.start_telemetry(connection_message)?;
Expand Down
8 changes: 0 additions & 8 deletions client/service/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,14 +132,6 @@ pub struct Configuration {
pub informant_output_format: sc_informant::OutputFormat,
/// Maximum number of different runtime versions that can be cached.
pub runtime_cache_size: u8,
/// 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.
pub disable_hardware_benchmarks: bool,
}

/// Type for tasks spawned by the executor.
Expand Down
1 change: 0 additions & 1 deletion client/service/test/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,6 @@ fn node_config<
base_path: Some(BasePath::new(root)),
informant_output_format: Default::default(),
runtime_cache_size: 2,
disable_hardware_benchmarks: true,
}
}

Expand Down
1 change: 1 addition & 0 deletions client/telemetry/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@ serde = { version = "1.0.136", features = ["derive"] }
serde_json = "1.0.79"
chrono = "0.4.19"
thiserror = "1.0.30"
indexmap = "1.8.0"
Loading