Re: sem_lock() vs qspinlocks

From: Peter Zijlstra
Date: Fri May 20 2016 - 05:34:33 EST


On Fri, May 20, 2016 at 11:07:49AM +0200, Giovanni Gherdovich wrote:
> ----------- run_cascade.sh -------------------------------------
> #!/bin/bash
>
> TESTCASE=$1
> CASCADE_PATH="libmicro-1-installed/bin-x86_64"
>
> case $TESTCASE in
> c_flock_200)
> BINNAME="cascade_flock"
> COMMAND="$CASCADE_PATH/cascade_flock -E -D 60000 -L -S -W \
> -N c_flock_200 \
> -P 200 -I 5000000"
> # c_flock_200 is supposed to last 60 seconds.
> SLEEPTIME=70
> ;;
> c_cond_10)
> BINNAME="cascade_cond"
> COMMAND="$CASCADE_PATH/cascade_cond -E -C 2000 -L -S -W \
> -N c_cond_10 \
> -T 10 -I 3000"
> # c_cond_10 terminates in less than 1 second.
> SLEEPTIME=5
> ;;
> *)
> echo "Unknown test case" >&2
> exit 1
> ;;
> esac
>
> ERRORS=0
> uname -a
> for i in {1..10} ; do
> {
> eval $COMMAND &
> } >/dev/null 2>&1
> sleep $SLEEPTIME
> if pidof $BINNAME >/dev/null ; then
> echo Run \#$i: $TESTCASE hangs
> for PID in $(pidof $BINNAME) ; do
> head -1 /proc/$PID/stack
> done | sort | uniq -c
> ERRORS=$((ERRORS+1))
> killall $BINNAME
> else
> echo Run \#$i: $TESTCASE exits successfully
> fi
> done
> echo $TESTCASE hanged $ERRORS times.
> ----------------------------------------------------------------

Thanks, that's a much nicer script than mine ;-)