comparison benchmark/run_and_view.jl @ 1177:68445e87fa93 tooling/benchmarks

Use benchmark time field instead of now()
author Jonatan Werpers <jonatan@werpers.com>
date Wed, 25 Jan 2023 14:00:16 +0100
parents 27ee001df3e5
children 5c34dfc73b37
comparison
equal deleted inserted replaced
1176:27ee001df3e5 1177:68445e87fa93
29 r.vinfo, 29 r.vinfo,
30 r.benchmarkconfig, 30 r.benchmarkconfig,
31 ) 31 )
32 end 32 end
33 33
34 function write_result_html(io, r; title) 34 function write_result_html(io, r)
35 iobuffer = IOBuffer() 35 iobuffer = IOBuffer()
36 PkgBenchmark.export_markdown(iobuffer, r) 36 PkgBenchmark.export_markdown(iobuffer, r)
37 37
38 parsed_md = Markdown.parse(String(take!(iobuffer))) 38 parsed_md = Markdown.parse(String(take!(iobuffer)))
39 content = Markdown.html(parsed_md) 39 content = Markdown.html(parsed_md)
40 40
41 template = Mustache.load(template_path) 41 template = Mustache.load(template_path)
42 Mustache.render(io, template, Dict("title"=>title, "content"=>content)) 42
43 dt = Dates.format(PkgBenchmark.date(r), "yyyy-mm-dd HH:MM:SS")
44 Mustache.render(io, template, Dict("title"=>dt, "content"=>content))
43 end 45 end
44 46
45 function write_result_html(r) 47 function write_result_html(r)
46 dt = Dates.format(Dates.now(), "yyyy-mm-dd HH:MM:SS") 48 dt = Dates.format(PkgBenchmark.date(r), "yyyy-mm-dd HH:MM:SS")
47 file_path = joinpath(results_dir, dt*".html") 49 file_path = joinpath(results_dir, dt*".html")
48 50
49 open(file_path, "w") do io 51 open(file_path, "w") do io
50 write_result_html(io, r; title=dt) 52 write_result_html(io, r)
51 end 53 end
52 54
53 return file_path 55 return file_path
54 end 56 end
55 57