-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathProfileEngine.jl
More file actions
87 lines (70 loc) · 3.76 KB
/
ProfileEngine.jl
File metadata and controls
87 lines (70 loc) · 3.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# ═══════════════════════════════════════════════════════════════════════════════
# Profile Engine Module
# ═══════════════════════════════════════════════════════════════════════════════
#
# This module provides the infrastructure for registering and using performance
# profile configurations.
#
# ═══════════════════════════════════════════════════════════════════════════════
"""
PROFILE_REGISTRY
Global registry for performance profile configurations used in the documentation.
"""
const PROFILE_REGISTRY = CTBenchmarks.PerformanceProfileRegistry()
# ───────────────────────────────────────────────────────────────────────────────
# Registry-based Wrappers
# ───────────────────────────────────────────────────────────────────────────────
"""
plot_profile_from_registry(name::String, bench_id::AbstractString, src_dir::AbstractString; combos=nothing)
Generate a performance profile plot for a benchmark using a registered configuration.
# Arguments
- `name`: Name of the profile configuration in the registry.
- `bench_id`: Benchmark identifier.
- `src_dir`: Directory containing the benchmark results.
- `combos`: Optional list of solver combinations to include.
"""
function plot_profile_from_registry(
name::String,
bench_id::AbstractString,
src_dir::AbstractString;
combos::Union{Nothing,Vector{<:Tuple}}=nothing,
)
config = CTBenchmarks.get_config(PROFILE_REGISTRY, name)
json_path = joinpath(src_dir, "assets", "benchmarks", bench_id, bench_id * ".json")
df = CTBenchmarks.load_benchmark_df(json_path)
if isempty(df)
return Plots.plot() # Empty plot if no data
end
pp = CTBenchmarks.build_profile_from_df(df, bench_id, config; allowed_combos=combos)
if pp === nothing
return Plots.plot()
end
return CTBenchmarks.plot_performance_profile(pp)
end
"""
analyze_profile_from_registry(name::String, bench_id::AbstractString, src_dir::AbstractString; combos=nothing)
Generate a textual analysis of a performance profile for a benchmark using a registered configuration.
# Arguments
- `name`: Name of the profile configuration in the registry.
- `bench_id`: Benchmark identifier.
- `src_dir`: Directory containing the benchmark results.
- `combos`: Optional list of solver combinations to include.
"""
function analyze_profile_from_registry(
name::String,
bench_id::AbstractString,
src_dir::AbstractString;
combos::Union{Nothing,Vector{<:Tuple}}=nothing,
)
config = CTBenchmarks.get_config(PROFILE_REGISTRY, name)
json_path = joinpath(src_dir, "assets", "benchmarks", bench_id, bench_id * ".json")
df = CTBenchmarks.load_benchmark_df(json_path)
if isempty(df)
return "!!! warning\n No benchmark data available for analysis for `$bench_id`.\n"
end
pp = CTBenchmarks.build_profile_from_df(df, bench_id, config; allowed_combos=combos)
if pp === nothing
return "!!! warning\n No successful runs found to analyze for `$bench_id`.\n"
end
return CTBenchmarks.analyze_performance_profile(pp)
end