diff benchmark/benchmark_utils.jl @ 1536:5193e6cd6c6a

Add optional name parameter for benchmark helper. Update benchmark manifest
author Jonatan Werpers <jonatan@werpers.com>
date Thu, 11 Apr 2024 23:48:11 +0200
parents 42738616422e
children 237b980ffb91 471a948cd2b2
line wrap: on
line diff
--- a/benchmark/benchmark_utils.jl	Wed Apr 10 09:01:54 2024 +0200
+++ b/benchmark/benchmark_utils.jl	Thu Apr 11 23:48:11 2024 +0200
@@ -23,7 +23,7 @@
 For control over what happens to the benchmark result datastructure see the
 different methods of [`run_benchmark`](@ref)
 """
-function main(;rev=nothing, target=nothing, baseline=nothing , kwargs...)
+function main(;rev=nothing, target=nothing, baseline=nothing, name=nothing, kwargs...)
     if !isnothing(rev)
         r = run_benchmark(rev; kwargs...)
     elseif !isnothing(baseline)
@@ -37,7 +37,7 @@
         r = run_benchmark(;kwargs...)
     end
 
-    file_path = write_result_html(r)
+    file_path = write_result_html(r; name)
     open_in_default_browser(file_path)
 end
 
@@ -137,9 +137,14 @@
     Mustache.render(io, template, Dict("title"=>dt, "content"=>content))
 end
 
-function write_result_html(r)
+function write_result_html(r; name=nothing)
     dt = Dates.format(PkgBenchmark.date(r), "yyyy-mm-dd HHMMSS")
-    file_path = joinpath(results_dir, dt*".html")
+
+    if isnothing(name)
+        file_path = joinpath(results_dir, dt*".html")
+    else
+        file_path = joinpath(results_dir, dt*" "*name*".html")
+    end
 
     open(file_path, "w") do io
         write_result_html(io, r)