@@ -71,6 +71,7 @@ KNOWN_SETTINGS=(
71
71
swift-tools-num-parallel-lto-link-jobs " " " The number of parallel link jobs to use when compiling swift tools"
72
72
use-gold-linker " " " Enable using the gold linker"
73
73
workspace " ${HOME} /src" " source directory containing llvm, clang, swift"
74
+ dsymutil-jobs " 1" " number of parallel invocations of dsymutil"
74
75
75
76
# # Build Tools
76
77
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
3043
3044
done
3044
3045
done
3045
3046
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
+
3046
3066
for host in " ${ALL_HOSTS[@]} " ; do
3047
3067
# Check if we should perform this action.
3048
3068
if ! [[ $( should_execute_action " ${host} -extractsymbols" ) ]]; then
@@ -3075,6 +3095,9 @@ for host in "${ALL_HOSTS[@]}"; do
3075
3095
# Instead, just echo we do "darwin_intall_extract_symbols".
3076
3096
if [[ " ${DRY_RUN} " ]]; then
3077
3097
call darwin_install_extract_symbols
3098
+ printJSONStartTimestamp dsymutil
3099
+ echo xargs -n 1 -P ${DSYMUTIL_JOBS} dsymutil
3100
+ printJSONEndTimestamp dsymutil
3078
3101
else
3079
3102
set -x
3080
3103
@@ -3097,13 +3120,16 @@ for host in "${ALL_HOSTS[@]}"; do
3097
3120
#
3098
3121
# Exclude shell scripts and static archives.
3099
3122
# 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
3101
3126
(cd " ${host_symroot} " &&
3102
3127
find ./" ${CURRENT_PREFIX} " -perm -0111 -type f -print | \
3103
3128
grep -v ' .py$' | \
3104
3129
grep -v ' .a$' | \
3105
3130
grep -v ' swift-api-digester' | \
3106
- xargs -P 1 ${dsymutil_path} )
3131
+ xargs -n 1 -P ${DSYMUTIL_JOBS} ${dsymutil_path} )
3132
+ printJSONEndTimestamp dsymutil
3107
3133
3108
3134
# Strip executables, shared libraries and static libraries in
3109
3135
# `host_install_destdir`.
0 commit comments