feat(controller): compute the LSF CPU peak and efficiency fields (bug-1736)

update_job_cpu_stats() (misc.c), run after each usage report:
- each host's cpu_rate = CPU-seconds gained / wall seconds since its
  previous report; the job's cores = the sum over hosts
- peak_cpu = highest job cores seen (peak_cpu_time = it rounded, the
  wire field is an integer); peak_cpu_duration = the interval that set it
- avg_cpu_efficiency = cpu_time / elapsed / slots, peak_cpu_efficiency =
  peak_cpu / slots, mem_efficiency = highest used_mem / rusage[mem]
  request (job-wide total, per task by default), all in percent
aggregate_job_runusage() no longer treats cumulative cpu_time as a peak.

New fields host sample_time/cpu_rate and job peak_cpu are appended to
the capnp structs (old WAL entries still decode) and copied by
merge_job_runusage(), so a promoted standby keeps the rate baselines.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Rongsong Shen 2026-10-02 04:14:35 +00:00
parent 77b5102b3e
commit 6df644e6d5
Signed by untrusted user: rshen
GPG key ID: 80533536B0EB651C
8 changed files with 325 additions and 50 deletions

View file

@ -286,6 +286,8 @@ struct HostRunusage $C.mapname("xce_host_runusage_t"){
memUsage @2: Float64 $C.mapname("mem_usage");
memSwap @3: Float64 $C.mapname("mem_swap");
tasksCurrent @4: Int32 $C.mapname("tasks_current");
sampleTime @5: Int64 $C.mapname("sample_time");
cpuRate @6: Float32 $C.mapname("cpu_rate");
}
struct JobRunusage $C.mapname("xce_job_runusage_t"){
@ -299,6 +301,7 @@ struct JobRunusage $C.mapname("xce_job_runusage_t"){
avgCpuEfficiency @7: Float32 $C.mapname("avg_cpu_efficiency");
peakCpuEfficiency @8: Float32 $C.mapname("peak_cpu_efficiency");
hostRunusage @9: List(HostRunusage) $C.mapname("host_runusage") $C.maplistcount("num_hosts");
peakCpu @10: Float32 $C.mapname("peak_cpu");
}
struct JobFail $C.mapname("job_failinfo_t"){