@@ -9,6 +9,39 @@ import PkgLicenses
9
9
const DEFAULT_JULIA_VERSION_SPEC = " 1.0"
10
10
const PKG_VERSIONS = Base. VERSION >= v " 1.7-" ? Pkg. Versions : Pkg. Types
11
11
12
+ mutable struct BuildTimer
13
+ begin_setup:: Float64
14
+ end_setup:: Float64
15
+ begin_build:: Float64
16
+ end_build:: Float64
17
+ begin_audit:: Float64
18
+ end_audit:: Float64
19
+ begin_package:: Float64
20
+ end_package:: Float64
21
+ BuildTimer () = new (NaN , NaN , NaN , NaN , NaN , NaN , NaN , NaN )
22
+ end
23
+
24
+ function Base. show (io:: IO , t:: BuildTimer )
25
+ function rnd (a, b)
26
+ min, sec = divrem (b - a, 60 )
27
+ out = " "
28
+ if min ≥ 1
29
+ out *= string (Int (min), " m " )
30
+ end
31
+ out *= string (round (sec; digits= 2 ), " s" )
32
+ return out
33
+ end
34
+ # Sanity check: make sure all fields are non-NaN: if that's not the case, just skip.
35
+ if all (.! (isnan .(getfield .((t,), fieldnames (BuildTimer)))))
36
+ print (io, " Timings: " ,
37
+ " setup: " , rnd (t. begin_setup, t. end_setup), " , " ,
38
+ " build: " , rnd (t. begin_build, t. end_build), " , " ,
39
+ " audit: " , rnd (t. begin_audit, t. end_audit), " , " ,
40
+ " packaging: " , rnd (t. begin_package, t. end_package),
41
+ )
42
+ end
43
+ end
44
+
12
45
const BUILD_HELP = (
13
46
"""
14
47
Usage: build_tarballs.jl [target1,target2,...] [--help]
@@ -663,6 +696,9 @@ function autobuild(dir::AbstractString,
663
696
try mkpath (out_path) catch ; end
664
697
665
698
for platform in sort (collect (platforms), by = triplet)
699
+ timer = BuildTimer ()
700
+ timer. begin_setup = time ()
701
+
666
702
# We build in a platform-specific directory
667
703
build_path = joinpath (dir, " build" , triplet (platform))
668
704
mkpath (build_path)
@@ -745,8 +781,12 @@ function autobuild(dir::AbstractString,
745
781
# teeing to stdout
746
782
run (ur, ` /bin/bash -l -c $(get_compilers_versions (; compilers... )) ` , io;
747
783
verbose = verbose, tee_stream = devnull )
784
+ timer. end_setup = time ()
748
785
# Run the build script
749
- run (ur, ` /bin/bash -l -c $(trapper_wrapper) ` , io; verbose= verbose)
786
+ timer. begin_build = time ()
787
+ res = run (ur, ` /bin/bash -l -c $(trapper_wrapper) ` , io; verbose= verbose)
788
+ timer. end_build = time ()
789
+ res
750
790
end
751
791
if ! did_succeed
752
792
if debug
@@ -758,6 +798,7 @@ function autobuild(dir::AbstractString,
758
798
end
759
799
760
800
# Run an audit of the prefix to ensure it is properly relocatable
801
+ timer. begin_audit = time ()
761
802
if ! skip_audit
762
803
audit_result = audit (dest_prefix, src_name;
763
804
platform= platform, verbose= verbose,
@@ -772,6 +813,7 @@ function autobuild(dir::AbstractString,
772
813
error (strip (msg))
773
814
end
774
815
end
816
+ timer. end_audit = time ()
775
817
776
818
# Finally, error out if something isn't satisfied
777
819
unsatisfied_so_die = false
@@ -828,6 +870,7 @@ function autobuild(dir::AbstractString,
828
870
compress_dir (logdir (dest_prefix; subdir= src_name); verbose)
829
871
830
872
# Once we're built up, go ahead and package this dest_prefix out
873
+ timer. begin_package = time ()
831
874
tarball_path, tarball_hash, git_hash = package (
832
875
dest_prefix,
833
876
joinpath (out_path, src_name),
@@ -836,6 +879,7 @@ function autobuild(dir::AbstractString,
836
879
verbose= verbose,
837
880
force= true ,
838
881
)
882
+ timer. end_package = time ()
839
883
840
884
build_output_meta[platform] = (
841
885
tarball_path,
@@ -855,6 +899,7 @@ function autobuild(dir::AbstractString,
855
899
if isempty (readdir (build_path))
856
900
rm (build_path; recursive= true )
857
901
end
902
+ verbose && @info timer
858
903
end
859
904
860
905
# Return our product hashes
0 commit comments