@@ -71,6 +71,7 @@ KNOWN_SETTINGS=(
7171 swift-tools-num-parallel-lto-link-jobs " " " The number of parallel link jobs to use when compiling swift tools"
7272 use-gold-linker " " " Enable using the gold linker"
7373 workspace " ${HOME} /src" " source directory containing llvm, clang, swift"
74+ dsymutil-jobs " 1" " number of parallel invocations of dsymutil"
7475
7576 # # Build Tools
7677 host-cc " " " the path to CC, the 'clang' compiler for the host platform. **This argument is required**"
@@ -3043,6 +3044,25 @@ for host in "${ALL_HOSTS[@]}"; do
30433044 done
30443045done
30453046
3047+ function printJSONTimestamp() {
3048+ local command=$1
3049+ local kind=$2
3050+
3051+ echo " { \" command\" : \" ${command} \" , \" ${kind} \" : \" $( date " +%Y-%m-%dT%H:%M:%S" ) \" }"
3052+ }
3053+
3054+ function printJSONStartTimestamp() {
3055+ local command=$1
3056+
3057+ printJSONTimestamp ${command} " start"
3058+ }
3059+
3060+ function printJSONEndTimestamp() {
3061+ local command=$1
3062+
3063+ printJSONTimestamp ${command} " end"
3064+ }
3065+
30463066for host in " ${ALL_HOSTS[@]} " ; do
30473067 # Check if we should perform this action.
30483068 if ! [[ $( should_execute_action " ${host} -extractsymbols" ) ]]; then
@@ -3075,6 +3095,9 @@ for host in "${ALL_HOSTS[@]}"; do
30753095 # Instead, just echo we do "darwin_intall_extract_symbols".
30763096 if [[ " ${DRY_RUN} " ]]; then
30773097 call darwin_install_extract_symbols
3098+ printJSONStartTimestamp dsymutil
3099+ echo xargs -n 1 -P ${DSYMUTIL_JOBS} dsymutil
3100+ printJSONEndTimestamp dsymutil
30783101 else
30793102 set -x
30803103
@@ -3097,13 +3120,16 @@ for host in "${ALL_HOSTS[@]}"; do
30973120 #
30983121 # Exclude shell scripts and static archives.
30993122 # Exclude swift-api-digester dSYM to reduce debug toolchain size.
3100- # Run sequentially -- dsymutil is multithreaded and can be memory intensive
3123+ # Tweak carefully the amount of parallelism -- dsymutil can be memory intensive and
3124+ # as such too many instance can exhaust the memory and slow down/panic the machine
3125+ printJSONStartTimestamp dsymutil
31013126 (cd " ${host_symroot} " &&
31023127 find ./" ${CURRENT_PREFIX} " -perm -0111 -type f -print | \
31033128 grep -v ' .py$' | \
31043129 grep -v ' .a$' | \
31053130 grep -v ' swift-api-digester' | \
3106- xargs -P 1 ${dsymutil_path} )
3131+ xargs -n 1 -P ${DSYMUTIL_JOBS} ${dsymutil_path} )
3132+ printJSONEndTimestamp dsymutil
31073133
31083134 # Strip executables, shared libraries and static libraries in
31093135 # `host_install_destdir`.
0 commit comments