feat(proc): 在proc中添加进程在cpu上运行的时间与进程开始运行的时间的信息 (#1238)

This commit is contained in:
kaleidoscope416 2025-08-10 16:31:14 +08:00 committed by GitHub
parent aaca906914
commit 169b3a7988
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 2 deletions

View File

@ -187,7 +187,8 @@ impl ProcFSInode {
let priority = sched_info_guard.policy();
let vrtime = sched_info_guard.sched_entity.vruntime;
let time = sched_info_guard.sched_entity.sum_exec_runtime;
let start_time = sched_info_guard.sched_entity.exec_start;
// State
pdata.append(&mut format!("\nState:\t{:?}", state).as_bytes().to_owned());
@ -237,9 +238,12 @@ impl ProcFSInode {
};
pdata.append(&mut format!("\nTty:\t{}", name).as_bytes().to_owned());
// 进程在cpu上的运行时间
pdata.append(&mut format!("\nTime:\t{}", time).as_bytes().to_owned());
// 进程开始运行的时间
pdata.append(&mut format!("\nStime:\t{}", start_time).as_bytes().to_owned());
// kthread
pdata.append(&mut format!("\nKthread:\t{}", pcb.is_kthread() as usize).into());
pdata.append(&mut format!("\ncpu_id:\t{}", cpu_id).as_bytes().to_owned());
pdata.append(&mut format!("\npriority:\t{:?}", priority).as_bytes().to_owned());
pdata.append(