aboutsummaryrefslogtreecommitdiffstats
path: root/erts
diff options
context:
space:
mode:
authorLukas Larsson <[email protected]>2019-06-04 09:12:19 +0200
committerLukas Larsson <[email protected]>2019-06-27 16:27:19 +0200
commit2c445bcb04d2d5d3537b31ac93007b03f26695f9 (patch)
tree2080b224ee366a6d58391532a0110071f8f13a96 /erts
parenta4752223c850305a2870a82eeb043391c372eec9 (diff)
downloadotp-2c445bcb04d2d5d3537b31ac93007b03f26695f9.tar.gz
otp-2c445bcb04d2d5d3537b31ac93007b03f26695f9.tar.bz2
otp-2c445bcb04d2d5d3537b31ac93007b03f26695f9.zip
erts: Randomize valgrind taskset CPU
When running multiple valgrinds on the same machine we want to attempt to make sure that they do not end up on the same core.
Diffstat (limited to 'erts')
-rw-r--r--erts/etc/unix/cerl.src5
1 files changed, 4 insertions, 1 deletions
diff --git a/erts/etc/unix/cerl.src b/erts/etc/unix/cerl.src
index 710a7a9ef6..59de9bdec8 100644
--- a/erts/etc/unix/cerl.src
+++ b/erts/etc/unix/cerl.src
@@ -312,8 +312,11 @@ if [ "x$GDB" = "x" ]; then
# on multiple cores (especially with async threads). Valgrind only run one pthread
# at a time anyway so there is no point letting it utilize more than one core.
# Use $sched_arg to force all schedulers online to emulate multicore.
- taskset1="taskset 1"
ncpu=`cat /proc/cpuinfo | grep -w processor | wc -l`
+ # Choose a random core in order to not collide with any other valgrind
+ # run on the same machine.
+ taskset1=$((1 << (`shuf -i 1-$ncpu -n 1` - 1) ))
+ taskset1="taskset $taskset1"
sched_arg="-S$ncpu:$ncpu"
else
taskset1=