Move Throughput into sc-sysinfo (#12368)

* move Throughput to sc-sysinfo

* replace u64

* fix in tests

* change Throughput

* refactored Throughput

* fixes

* moved tests & fixes

* custom serializer

* note

* fix serializer

* forgot to remove

* deserialize

* functioning deserialization :)

* try to make clipply happy

* Serialize as function

* test HwBench

* rename

* fix serialization

* deserialize as function

* unused import

* move serialize/deserialize

* don't serialize none

* remove nonsense

* remove nonsense comment :P

* fixes

* remove all the todos

* return enum

* fixes

* fix nit

* improve docs & readability

* Update client/sysinfo/src/sysinfo.rs

Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* fix all the nits

* rename

* fix

* Update client/sysinfo/src/sysinfo.rs

Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* remove unit from serialization

* Update utils/frame/benchmarking-cli/src/machine/hardware.rs

Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
This commit is contained in:
Sergej Sakac
2022-11-04 18:13:57 +01:00
committed by GitHub
parent 6ba635fcff
commit 65b285e632
8 changed files with 236 additions and 144 deletions
+15 -4
View File
@@ -29,6 +29,7 @@ mod sysinfo_linux;
pub use sysinfo::{
benchmark_cpu, benchmark_disk_random_writes, benchmark_disk_sequential_writes,
benchmark_memory, benchmark_sr25519_verify, gather_hwbench, gather_sysinfo,
serialize_throughput, serialize_throughput_option, Throughput,
};
/// The operating system part of the current target triplet.
@@ -44,13 +45,23 @@ pub const TARGET_ENV: &str = include_str!(concat!(env!("OUT_DIR"), "/target_env.
#[derive(Clone, Debug, serde::Serialize)]
pub struct HwBench {
/// The CPU speed, as measured in how many MB/s it can hash using the BLAKE2b-256 hash.
pub cpu_hashrate_score: u64,
#[serde(serialize_with = "serialize_throughput")]
pub cpu_hashrate_score: Throughput,
/// Memory bandwidth in MB/s, calculated by measuring the throughput of `memcpy`.
pub memory_memcpy_score: u64,
#[serde(serialize_with = "serialize_throughput")]
pub memory_memcpy_score: Throughput,
/// Sequential disk write speed in MB/s.
pub disk_sequential_write_score: Option<u64>,
#[serde(
serialize_with = "serialize_throughput_option",
skip_serializing_if = "Option::is_none"
)]
pub disk_sequential_write_score: Option<Throughput>,
/// Random disk write speed in MB/s.
pub disk_random_write_score: Option<u64>,
#[serde(
serialize_with = "serialize_throughput_option",
skip_serializing_if = "Option::is_none"
)]
pub disk_random_write_score: Option<Throughput>,
}
/// Limit the execution time of a benchmark.