From 469a245d400a6175ad7b11c97814771b45a8b785 Mon Sep 17 00:00:00 2001 From: Zentrik Date: Mon, 25 Mar 2024 21:39:43 +0000 Subject: [PATCH] Save sizes of built dynamic libraries and sys images I just picked some big files that seemed related to Julia or LLVM. This is not shown in the report currently, I don't expect these sizes to change much so it didn't seem necessary. --- src/jobs/BenchmarkJob.jl | 37 ++++++++++++++++++++++++++++++++++--- test/runtests.jl | 4 +++- 2 files changed, 37 insertions(+), 4 deletions(-) diff --git a/src/jobs/BenchmarkJob.jl b/src/jobs/BenchmarkJob.jl index 1e6e9de1..482ed65a 100644 --- a/src/jobs/BenchmarkJob.jl +++ b/src/jobs/BenchmarkJob.jl @@ -238,7 +238,7 @@ function Base.run(job::BenchmarkJob) # run primary job julia_primary = fetch(julia_primary) nodelog(cfg, node, "running primary build for $(summary(job))") - results["primary"], results["primary.vinfo"] = + results["primary"], results["primary.vinfo"], results["primary.artifact-sizes"] = execute_benchmarks!(job, julia_primary, :primary) nodelog(cfg, node, "finished primary build for $(summary(job))") @@ -268,7 +268,7 @@ function Base.run(job::BenchmarkJob) elseif job.against !== nothing # run comparison build julia_against = fetch(julia_against) nodelog(cfg, node, "running comparison build for $(summary(job))") - results["against"], results["against.vinfo"] = + results["against"], results["against.vinfo"], results["against.artifact-sizes"] = execute_benchmarks!(job, julia_against, :against) nodelog(cfg, node, "finished comparison build for $(summary(job))") end @@ -285,6 +285,22 @@ function Base.run(job::BenchmarkJob) end end + # save artifact sizes + try + open(joinpath(tmpdir(job), "artifact-sizes.csv"), "w") do file + for (artifact, size) in results["primary.artifact-sizes"] + println(file, "$(submission(job).build.sha),$artifact,$size") + end + if job.against !== nothing + for (artifact, size) in results["against.artifact-sizes"] + println(file, "$(job.against.sha),$artifact,$size") + end + end + end + catch err + vinfo = string("Saving artifact sizes failed: ", sprint(showerror, err)) + end + # report results nodelog(cfg, node, "reporting results for $(summary(job))") report(job, results) @@ -498,10 +514,25 @@ function execute_benchmarks!(job::BenchmarkJob, juliapath, whichbuild::Symbol) vinfo = string("retrieving versioninfo() failed: ", sprint(showerror, err)) end + # Get artifact sizes + try + artifact_sizes = Dict{String, Int}() + julia_build_dir = splitdir(juliapath)[1] + lib_dir = joinpath(julia_build_dir, "usr", "lib") + for artifact in ("libLLVM.so", "libjulia-codegen.so", "libjulia-internal.so") + artifact_sizes[artifact] = filesize(joinpath(lib_dir, artifact)) + end + for artifact in ("corecompiler.ji", "sys.ji", "sys.so") + artifact_sizes[artifact] = filesize(joinpath(lib_dir, "julia", artifact)) + end + catch err + vinfo = string("Retrieving artifact sizes failed: ", sprint(showerror, err)) + end + # delete the builddir now that we're done with it rm(builddir, recursive=true) - return minimum(results), vinfo + return minimum(results), vinfo, artifact_sizes end ########################## diff --git a/test/runtests.jl b/test/runtests.jl index bb27624a..38f558f6 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -193,7 +193,9 @@ results = Dict( ) ) ), - "against.vinfo" => vinfo*"_against" + "against.vinfo" => vinfo*"_against", + "primary.artifact_sizes" => Dict("libLLVM.so" => 123456, "sys.so" => 789012), + "against.artifact_sizes" => Dict("libLLVM.so" => 123456, "sys.so" => 789012), ) results["judged"] = BenchmarkTools.judge(results["primary"], results["against"])