Backend: add parallel cpu benchmarks processing (#603)

* Add parallel cpu benchmarks processing

* Expose Parallel Hashrate Score in UI (as 'Parallel CPU speed')

* Remove unused variable and fix cfg(debug)

* Fix tests after removing old_chain_name

* Update Dockerfile

* bullseye for both images

---------

Co-authored-by: Volodymyr Brazhnyk <volbr@pm.me>
This commit is contained in:
James Wilson
2025-08-28 14:52:08 +01:00
committed by GitHub
parent 635776328d
commit 4a5cd54cd8
11 changed files with 39 additions and 16 deletions
@@ -211,6 +211,9 @@ pub struct NodeHwBench {
pub memory_memcpy_score: u64,
pub disk_sequential_write_score: Option<u64>,
pub disk_random_write_score: Option<u64>,
pub parallel_cpu_hashrate_score: Option<u64>,
//// This exists but isn't needed at the moment:
// pub parallel_cpu_cores: Option<usize>,
}
impl From<NodeHwBench> for node_types::NodeHwBench {
@@ -220,6 +223,7 @@ impl From<NodeHwBench> for node_types::NodeHwBench {
memory_memcpy_score: hwbench.memory_memcpy_score,
disk_sequential_write_score: hwbench.disk_sequential_write_score,
disk_random_write_score: hwbench.disk_random_write_score,
parallel_cpu_hashrate_score: hwbench.parallel_cpu_hashrate_score,
}
}
}
@@ -231,6 +235,7 @@ impl From<NodeHwBench> for internal::NodeHwBench {
memory_memcpy_score: msg.memory_memcpy_score,
disk_sequential_write_score: msg.disk_sequential_write_score,
disk_random_write_score: msg.disk_random_write_score,
parallel_cpu_hashrate_score: msg.parallel_cpu_hashrate_score,
}
}
}
+2 -2
View File
@@ -323,14 +323,14 @@ where
// Deserialize from JSON, warning in debug mode if deserialization fails:
let node_message: json_message::NodeMessage = match serde_json::from_slice(&bytes) {
Ok(node_message) => node_message,
#[cfg(debug)]
#[cfg(debug_assertions)]
Err(e) => {
let bytes: &[u8] = bytes.get(..512).unwrap_or_else(|| &bytes);
let msg_start = std::str::from_utf8(bytes).unwrap_or_else(|_| "INVALID UTF8");
log::warn!("Failed to parse node message ({msg_start}): {e}");
continue;
},
#[cfg(not(debug))]
#[cfg(not(debug_assertions))]
Err(_) => {
continue;
}