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
33
34
import ProductPipelineListBuilder
34
35
from swift_build_support .swift_build_support .targets \
35
36
import StdlibDeploymentTarget
37
+ from swift_build_support .swift_build_support .utils import clear_log_time
36
38
from swift_build_support .swift_build_support .utils \
37
39
import exit_rejecting_arguments
38
40
from swift_build_support .swift_build_support .utils import fatal_error
41
+ from swift_build_support .swift_build_support .utils import log_time
39
42
40
43
41
44
class BuildScriptInvocation (object ):
@@ -52,6 +55,8 @@ def __init__(self, toolchain, args):
52
55
53
56
self .build_libparser_only = args .build_libparser_only
54
57
58
+ clear_log_time ()
59
+
55
60
@property
56
61
def install_all (self ):
57
62
return self .args .install_all or self .args .infer_dependencies
@@ -764,10 +769,13 @@ def _execute_merged_host_lipo_core_action(self):
764
769
self ._execute_action ("merged-hosts-lipo-core" )
765
770
766
771
def _execute_action (self , action_name ):
772
+ log_time ('start' , action_name )
773
+ t_start = time .time ()
767
774
shell .call_without_sleeping (
768
775
[BUILD_SCRIPT_IMPL_PATH ] + self .impl_args +
769
776
["--only-execute" , action_name ],
770
777
env = self .impl_env , echo = self .args .verbose_build )
778
+ log_time ('end' , action_name , time .time () - t_start )
771
779
772
780
def execute_product_build_steps (self , product_class , host_target ):
773
781
product_source = product_class .product_source_name ()
@@ -784,14 +792,26 @@ def execute_product_build_steps(self, product_class, host_target):
784
792
source_dir = self .workspace .source_dir (product_source ),
785
793
build_dir = build_dir )
786
794
if product .should_clean (host_target ):
787
- print ("--- Cleaning %s ---" % product_name )
795
+ log_message = "Cleaning %s" % product_name
796
+ print ("--- {} ---" .format (log_message ))
797
+ t_start = time .time ()
798
+ log_time ('start' , log_message )
788
799
product .clean (host_target )
800
+ log_time ('end' , log_message , time .time () - t_start )
789
801
if product .should_build (host_target ):
790
- print ("--- Building %s ---" % product_name )
802
+ log_message = "Building %s" % product_name
803
+ print ("--- {} ---" .format (log_message ))
804
+ t_start = time .time ()
805
+ log_time ('start' , log_message , '0' )
791
806
product .build (host_target )
807
+ log_time ('end' , log_message , time .time () - t_start )
792
808
if product .should_test (host_target ):
793
- print ("--- Running tests for %s ---" % product_name )
809
+ log_message = "Running tests for %s" % product_name
810
+ print ("--- {} ---" .format (log_message ))
811
+ t_start = time .time ()
812
+ log_time ('start' , log_message )
794
813
product .test (host_target )
814
+ log_time ('end' , log_message , time .time () - t_start )
795
815
print ("--- Finished tests for %s ---" % product_name )
796
816
# Install the product if it should be installed specifically, or
797
817
# if it should be built and `install_all` is set to True.
@@ -801,5 +821,9 @@ def execute_product_build_steps(self, product_class, host_target):
801
821
if product .should_install (host_target ) or \
802
822
(self .install_all and product .should_build (host_target ) and
803
823
not product .is_ignore_install_all_product ()):
804
- print ("--- Installing %s ---" % product_name )
824
+ log_message = "Installing %s" % product_name
825
+ print ("--- {} ---" .format (log_message ))
826
+ t_start = time .time ()
827
+ log_time ('start' , log_message )
805
828
product .install (host_target )
829
+ log_time ('end' , log_message , time .time () - t_start )
0 commit comments