feat: v3.26.158 诊断导出带上分进程内存拆解;mac 辅助函数补 cfg(unix)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 39s

This commit is contained in:
qiqi committed 2026-12-01 11:35:56 +08:00
1 parent 2f9590bcc7
commit b3cfea4715
6 files changed
+16 -4

No files matched your search

+3
View File
@@ -331,6 +331,7 @@ fn footprint_mb(pid: u32) -> Option<u64> {
// 注意:无任何写操作,只 spawn 只读工具。
// ps 的 etime(DD-HH:MM:SS / HH:MM:SS / MM:SS)→ 秒
#[cfg(unix)]
fn etime_secs(v: &str) -> u64 {
if let Some(pos) = v.find('-') {
let days = v[..pos].parse::<u64>().unwrap_or(0);
@@ -342,6 +343,7 @@ fn etime_secs(v: &str) -> u64 {
v.split(':').fold(0u64, |acc, x| acc * 60 + x.trim().parse::<u64>().unwrap_or(0))
}
#[cfg(unix)]
fn size_to_mb(num: f64, unit: &str) -> u64 {
let f = match unit {
"B" => num / 1048576.0,
@@ -354,6 +356,7 @@ fn size_to_mb(num: f64, unit: &str) -> u64 {
f.round() as u64
}
#[cfg(unix)]
fn parse_footprint(pid: u32) -> Option<serde_json::Value> {
let out = std::process::Command::new("/usr/bin/footprint")
.args(["-p", &pid.to_string()])