Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Save sizes of built dynamic libraries and sys images #186

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 34 additions & 3 deletions src/jobs/BenchmarkJob.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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))")

Expand Down Expand Up @@ -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
Expand All @@ -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)
Expand Down Expand Up @@ -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

##########################
Expand Down
4 changes: 3 additions & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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"])
Expand Down
Loading