~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/tools/testing/selftests/rseq/run_param_test.sh

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 #!/bin/bash
  2 # SPDX-License-Identifier: GPL-2.0+ or MIT
  3 
  4 NR_CPUS=`grep '^processor' /proc/cpuinfo | wc -l`
  5 
  6 EXTRA_ARGS=${@}
  7 
  8 OLDIFS="$IFS"
  9 IFS=$'\n'
 10 TEST_LIST=(
 11         "-T s"
 12         "-T l"
 13         "-T b"
 14         "-T b -M"
 15         "-T m"
 16         "-T m -M"
 17         "-T i"
 18         "-T r"
 19 )
 20 
 21 TEST_NAME=(
 22         "spinlock"
 23         "list"
 24         "buffer"
 25         "buffer with barrier"
 26         "memcpy"
 27         "memcpy with barrier"
 28         "increment"
 29         "membarrier"
 30 )
 31 IFS="$OLDIFS"
 32 
 33 REPS=1000
 34 SLOW_REPS=100
 35 NR_THREADS=$((6*${NR_CPUS}))
 36 
 37 function do_tests()
 38 {
 39         local i=0
 40         while [ "$i" -lt "${#TEST_LIST[@]}" ]; do
 41                 echo "Running test ${TEST_NAME[$i]}"
 42                 ./param_test ${TEST_LIST[$i]} -r ${REPS} -t ${NR_THREADS} ${@} ${EXTRA_ARGS} || exit 1
 43                 echo "Running compare-twice test ${TEST_NAME[$i]}"
 44                 ./param_test_compare_twice ${TEST_LIST[$i]} -r ${REPS} -t ${NR_THREADS} ${@} ${EXTRA_ARGS} || exit 1
 45 
 46                 echo "Running mm_cid test ${TEST_NAME[$i]}"
 47                 ./param_test_mm_cid ${TEST_LIST[$i]} -r ${REPS} -t ${NR_THREADS} ${@} ${EXTRA_ARGS} || exit 1
 48                 echo "Running mm_cid compare-twice test ${TEST_NAME[$i]}"
 49                 ./param_test_mm_cid_compare_twice ${TEST_LIST[$i]} -r ${REPS} -t ${NR_THREADS} ${@} ${EXTRA_ARGS} || exit 1
 50                 let "i++"
 51         done
 52 }
 53 
 54 echo "Default parameters"
 55 do_tests
 56 
 57 echo "Loop injection: 10000 loops"
 58 
 59 OLDIFS="$IFS"
 60 IFS=$'\n'
 61 INJECT_LIST=(
 62         "1"
 63         "2"
 64         "3"
 65         "4"
 66         "5"
 67         "6"
 68         "7"
 69         "8"
 70         "9"
 71 )
 72 IFS="$OLDIFS"
 73 
 74 NR_LOOPS=10000
 75 
 76 i=0
 77 while [ "$i" -lt "${#INJECT_LIST[@]}" ]; do
 78         echo "Injecting at <${INJECT_LIST[$i]}>"
 79         do_tests -${INJECT_LIST[i]} ${NR_LOOPS}
 80         let "i++"
 81 done
 82 NR_LOOPS=
 83 
 84 function inject_blocking()
 85 {
 86         OLDIFS="$IFS"
 87         IFS=$'\n'
 88         INJECT_LIST=(
 89                 "7"
 90                 "8"
 91                 "9"
 92         )
 93         IFS="$OLDIFS"
 94 
 95         NR_LOOPS=-1
 96 
 97         i=0
 98         while [ "$i" -lt "${#INJECT_LIST[@]}" ]; do
 99                 echo "Injecting at <${INJECT_LIST[$i]}>"
100                 do_tests -${INJECT_LIST[i]} -1 ${@}
101                 let "i++"
102         done
103         NR_LOOPS=
104 }
105 
106 echo "Yield injection (25%)"
107 inject_blocking -m 4 -y
108 
109 echo "Yield injection (50%)"
110 inject_blocking -m 2 -y
111 
112 echo "Yield injection (100%)"
113 inject_blocking -m 1 -y
114 
115 echo "Kill injection (25%)"
116 inject_blocking -m 4 -k
117 
118 echo "Kill injection (50%)"
119 inject_blocking -m 2 -k
120 
121 echo "Kill injection (100%)"
122 inject_blocking -m 1 -k
123 
124 echo "Sleep injection (1ms, 25%)"
125 inject_blocking -m 4 -s 1
126 
127 echo "Sleep injection (1ms, 50%)"
128 inject_blocking -m 2 -s 1
129 
130 echo "Sleep injection (1ms, 100%)"
131 inject_blocking -m 1 -s 1

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php