13
13
import os
14
14
import pipes
15
15
import platform
16
+ import time
16
17
17
18
from build_swift .build_swift import argparse
18
19
from build_swift .build_swift .constants import BUILD_SCRIPT_IMPL_PATH
31
32
import ProductPipelineListBuilder
32
33
from swift_build_support .swift_build_support .targets \
33
34
import StdlibDeploymentTarget
35
+ from swift_build_support .swift_build_support .utils import clear_log_time
34
36
from swift_build_support .swift_build_support .utils \
35
37
import exit_rejecting_arguments
36
38
from swift_build_support .swift_build_support .utils import fatal_error
39
+ from swift_build_support .swift_build_support .utils import log_time
37
40
38
41
39
42
class BuildScriptInvocation (object ):
@@ -50,6 +53,8 @@ def __init__(self, toolchain, args):
50
53
51
54
self .build_libparser_only = args .build_libparser_only
52
55
56
+ clear_log_time ()
57
+
53
58
@property
54
59
def install_all (self ):
55
60
return self .args .install_all or self .args .infer_dependencies
@@ -776,10 +781,13 @@ def _execute_merged_host_lipo_core_action(self):
776
781
self ._execute_action ("merged-hosts-lipo-core" )
777
782
778
783
def _execute_action (self , action_name ):
784
+ log_time ('start' , action_name )
785
+ t_start = time .time ()
779
786
shell .call_without_sleeping (
780
787
[BUILD_SCRIPT_IMPL_PATH ] + self .impl_args +
781
788
["--only-execute" , action_name ],
782
789
env = self .impl_env , echo = self .args .verbose_build )
790
+ log_time ('end' , action_name , time .time () - t_start )
783
791
784
792
def execute_product_build_steps (self , product_class , host_target ):
785
793
product_source = product_class .product_source_name ()
@@ -796,14 +804,26 @@ def execute_product_build_steps(self, product_class, host_target):
796
804
source_dir = self .workspace .source_dir (product_source ),
797
805
build_dir = build_dir )
798
806
if product .should_clean (host_target ):
799
- print ("--- Cleaning %s ---" % product_name )
807
+ log_message = "Cleaning %s" % product_name
808
+ print ("--- {} ---" .format (log_message ))
809
+ t_start = time .time ()
810
+ log_time ('start' , log_message )
800
811
product .clean (host_target )
812
+ log_time ('end' , log_message , time .time () - t_start )
801
813
if product .should_build (host_target ):
802
- print ("--- Building %s ---" % product_name )
814
+ log_message = "Building %s" % product_name
815
+ print ("--- {} ---" .format (log_message ))
816
+ t_start = time .time ()
817
+ log_time ('start' , log_message , '0' )
803
818
product .build (host_target )
819
+ log_time ('end' , log_message , time .time () - t_start )
804
820
if product .should_test (host_target ):
805
- print ("--- Running tests for %s ---" % product_name )
821
+ log_message = "Running tests for %s" % product_name
822
+ print ("--- {} ---" .format (log_message ))
823
+ t_start = time .time ()
824
+ log_time ('start' , log_message )
806
825
product .test (host_target )
826
+ log_time ('end' , log_message , time .time () - t_start )
807
827
print ("--- Finished tests for %s ---" % product_name )
808
828
# Install the product if it should be installed specifically, or
809
829
# if it should be built and `install_all` is set to True.
@@ -813,5 +833,9 @@ def execute_product_build_steps(self, product_class, host_target):
813
833
if product .should_install (host_target ) or \
814
834
(self .install_all and product .should_build (host_target ) and
815
835
not product .is_ignore_install_all_product ()):
816
- print ("--- Installing %s ---" % product_name )
836
+ log_message = "Installing %s" % product_name
837
+ print ("--- {} ---" .format (log_message ))
838
+ t_start = time .time ()
839
+ log_time ('start' , log_message )
817
840
product .install (host_target )
841
+ log_time ('end' , log_message , time .time () - t_start )
0 commit comments