Skip to content

Commit b894f84

Browse files
AnHeuermannclaude
andcommitted
Add total run time to summary.json and HTML report
Track wall-clock duration of the full test run in RunInfo.total_time_s. The value is written to summary.json and displayed in the HTML report as a human-readable string (e.g. "3 min 12 s"). Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent c2991eb commit b894f84

4 files changed

Lines changed: 21 additions & 1 deletion

File tree

src/pipeline.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ function main(;
6666
results_root :: String = "",
6767
ref_root :: String = get(ENV, "MAPLIB_REF", ""),
6868
)
69+
t0 = time()
70+
6971
if isempty(results_root)
7072
results_root = joinpath(library, version)
7173
end
@@ -150,6 +152,7 @@ function main(;
150152
isempty(cpu_info) ? "unknown" : strip(cpu_info[1].model),
151153
length(cpu_info),
152154
Sys.total_memory() / 1024^3,
155+
time() - t0,
153156
)
154157

155158
generate_report(results, results_root, info)

src/report.jl

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,15 @@ function rel_log_file_or_nothing(results_root::String, model::String,
3333
isfile(path) ? joinpath("files", model, "$(model)_$(phase).log") : nothing
3434
end
3535

36+
function _format_duration(t::Float64)::String
37+
t < 60 && return @sprintf("%.1f s", t)
38+
m = div(floor(Int, t), 60)
39+
s = floor(Int, t) % 60
40+
m < 60 && return @sprintf("%d min %d s", m, s)
41+
h = div(m, 60)
42+
return @sprintf("%d h %d min %d s", h, m % 60, s)
43+
end
44+
3645
"""
3746
generate_report(results, results_root, info) → report_path
3847
@@ -66,6 +75,7 @@ function generate_report(results::Vector{ModelResult}, results_root::String,
6675
filter_row = isempty(info.filter) ? "" : "<br>Filter: $(info.filter)"
6776
ref_row = isempty(info.ref_root) ? "" : "<br>Reference results: $(info.ref_root)"
6877
ram_str = @sprintf("%.1f", info.ram_gb)
78+
time_str = _format_duration(info.total_time_s)
6979

7080
html = """<!DOCTYPE html>
7181
<html lang="en">
@@ -91,7 +101,8 @@ function generate_report(results::Vector{ModelResult}, results_root::String,
91101
OpenModelica: $(info.omc_version)<br>
92102
BaseModelica.jl: $(info.bm_version)$(filter_row)$(ref_row)</p>
93103
<p>CPU: $(info.cpu_model) ($(info.cpu_threads) threads)<br>
94-
RAM: $(ram_str) GiB</p>
104+
RAM: $(ram_str) GiB<br>
105+
Total run time: $(time_str)</p>
95106
96107
<table style="width:auto; margin-bottom:1.5em;">
97108
<tr><th>Stage</th><th>Passed</th><th>Total</th><th>Rate</th></tr>

src/summary.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ function write_summary(
3030
print(io, " \"cpu_model\": \"$(_esc_json(info.cpu_model))\",\n")
3131
print(io, " \"cpu_threads\": $(info.cpu_threads),\n")
3232
print(io, " \"ram_gb\": $(@sprintf "%.2f" info.ram_gb),\n")
33+
print(io, " \"total_time_s\": $(@sprintf "%.2f" info.total_time_s),\n")
3334
print(io, " \"models\": [\n")
3435
for (i, r) in enumerate(results)
3536
sep = i < length(results) ? "," : ""
@@ -65,6 +66,7 @@ Parsed contents of a single `summary.json` file.
6566
- `cpu_model` — CPU model name
6667
- `cpu_threads` — number of logical CPU threads
6768
- `ram_gb` — total system RAM in GiB
69+
- `total_time_s` — wall-clock duration of the full test run in seconds
6870
- `models` — vector of per-model dicts; each has keys
6971
`"name"`, `"export"`, `"parse"`, `"sim"`, `"cmp_total"`, `"cmp_pass"`
7072
"""
@@ -80,6 +82,7 @@ struct RunSummary
8082
cpu_model :: String
8183
cpu_threads :: Int
8284
ram_gb :: Float64
85+
total_time_s :: Float64
8386
models :: Vector{Dict{String,Any}}
8487
end
8588

@@ -132,6 +135,7 @@ function load_summary(results_root::String)::Union{RunSummary,Nothing}
132135
_str("cpu_model"),
133136
_int("cpu_threads"),
134137
_float("ram_gb"),
138+
_float("total_time_s"),
135139
models,
136140
)
137141
end

src/types.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ Metadata about a single test run, collected by `main()` and written into both
5353
- `cpu_model` — CPU model name from `Sys.cpu_info()`
5454
- `cpu_threads` — number of logical CPU threads
5555
- `ram_gb` — total system RAM in GiB
56+
- `total_time_s` — wall-clock duration of the full test run in seconds
5657
"""
5758
struct RunInfo
5859
library :: String
@@ -66,6 +67,7 @@ struct RunInfo
6667
cpu_model :: String
6768
cpu_threads :: Int
6869
ram_gb :: Float64
70+
total_time_s :: Float64
6971
end
7072

7173
# ── Result type ────────────────────────────────────────────────────────────────

0 commit comments

Comments
 (0)