feat: add more useful debug information to system metadata

This commit is contained in:
Chance 2025-04-03 18:21:19 -04:00
parent 4a46c0e438
commit 7739275353
5 changed files with 1055 additions and 42 deletions

View file

@ -195,8 +195,10 @@ impl CPU {
);
sys.refresh_cpu_all();
let cpu_opt = sys.cpus().first();
let brand = cpu_opt
.map(|cpu| cpu.brand().into())
.unwrap_or(CPUBrand::Other("unknown".into()));
@ -464,16 +466,20 @@ impl SystemMemory {
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct CompileInfo {
pub struct EngineInfo {
pub timestamp: String,
pub pkg_version: String,
pub pkg_name: String,
pub target_arch: String,
pub target_os: String,
pub target_env: String,
pub rustc_version: String,
pub wgpu_version: String,
pub winit_version: String,
pub commit_hash: String,
}
impl CompileInfo {
impl EngineInfo {
pub fn current() -> Self {
Self {
timestamp: build_info::BUILT_TIME_UTC.to_string(),
@ -482,6 +488,10 @@ impl CompileInfo {
target_arch: build_info::CFG_TARGET_ARCH.to_string(),
target_os: build_info::CFG_OS.to_string(),
target_env: build_info::CFG_ENV.to_string(),
rustc_version: build_info::RUSTC_VERSION.to_string(),
wgpu_version: build_info::WGPU_VERSION.to_string(),
winit_version: build_info::WGPU_VERSION.to_string(),
commit_hash: build_info::GIT_COMMIT_HASH.to_string()
}
}
@ -491,13 +501,21 @@ impl CompileInfo {
- Timestamp: {}\n\
- Package: {} v{}\n\
- Target: {} {} {}\n\
- Rustc version: {}\n\
- Wgpu version: {}\n\
- Winit version: {}\n\
- commit_hash: {}\n\
",
self.timestamp,
self.pkg_name,
self.pkg_version,
self.target_arch,
self.target_os,
self.target_env
self.target_env,
self.rustc_version,
self.wgpu_version,
self.winit_version,
self.commit_hash
)
}
}
@ -507,7 +525,7 @@ pub struct SystemMetadata {
pub cpu: CPU,
pub memory: SystemMemory,
pub gpus: Vec<GPU>,
pub compile_info: CompileInfo,
pub compile_info: EngineInfo,
}
impl SystemMetadata {
@ -516,7 +534,7 @@ impl SystemMetadata {
cpu: CPU::current(),
memory: SystemMemory::current(),
gpus: GPU::current(),
compile_info: CompileInfo::current(),
compile_info: EngineInfo::current(),
}
}