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
@@ -766,10 +771,13 @@ def _execute_merged_host_lipo_core_action(self):
766
771
self ._execute_action ("merged-hosts-lipo-core" )
767
772
768
773
def _execute_action (self , action_name ):
774
+ log_time ('start' , action_name )
775
+ t_start = time .time ()
769
776
shell .call_without_sleeping (
770
777
[BUILD_SCRIPT_IMPL_PATH ] + self .impl_args +
771
778
["--only-execute" , action_name ],
772
779
env = self .impl_env , echo = self .args .verbose_build )
780
+ log_time ('end' , action_name , time .time () - t_start )
773
781
774
782
def execute_product_build_steps (self , product_class , host_target ):
775
783
product_source = product_class .product_source_name ()
@@ -786,14 +794,26 @@ def execute_product_build_steps(self, product_class, host_target):
786
794
source_dir = self .workspace .source_dir (product_source ),
787
795
build_dir = build_dir )
788
796
if product .should_clean (host_target ):
789
- print ("--- Cleaning %s ---" % product_name )
797
+ log_message = "Cleaning %s" % product_name
798
+ print ("--- {} ---" .format (log_message ))
799
+ t_start = time .time ()
800
+ log_time ('start' , log_message )
790
801
product .clean (host_target )
802
+ log_time ('end' , log_message , time .time () - t_start )
791
803
if product .should_build (host_target ):
792
- print ("--- Building %s ---" % product_name )
804
+ log_message = "Building %s" % product_name
805
+ print ("--- {} ---" .format (log_message ))
806
+ t_start = time .time ()
807
+ log_time ('start' , log_message , '0' )
793
808
product .build (host_target )
809
+ log_time ('end' , log_message , time .time () - t_start )
794
810
if product .should_test (host_target ):
795
- print ("--- Running tests for %s ---" % product_name )
811
+ log_message = "Running tests for %s" % product_name
812
+ print ("--- {} ---" .format (log_message ))
813
+ t_start = time .time ()
814
+ log_time ('start' , log_message )
796
815
product .test (host_target )
816
+ log_time ('end' , log_message , time .time () - t_start )
797
817
print ("--- Finished tests for %s ---" % product_name )
798
818
# Install the product if it should be installed specifically, or
799
819
# if it should be built and `install_all` is set to True.
@@ -803,5 +823,9 @@ def execute_product_build_steps(self, product_class, host_target):
803
823
if product .should_install (host_target ) or \
804
824
(self .install_all and product .should_build (host_target ) and
805
825
not product .is_ignore_install_all_product ()):
806
- print ("--- Installing %s ---" % product_name )
826
+ log_message = "Installing %s" % product_name
827
+ print ("--- {} ---" .format (log_message ))
828
+ t_start = time .time ()
829
+ log_time ('start' , log_message )
807
830
product .install (host_target )
831
+ log_time ('end' , log_message , time .time () - t_start )
0 commit comments