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

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

Version: ~ [ linux-6.1-rc5 ] ~ [ linux-6.0.8 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.78 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.154 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.224 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.265 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.299 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.333 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.302 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ 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 )
 19 
 20 TEST_NAME=(
 21         "spinlock"
 22         "list"
 23         "buffer"
 24         "buffer with barrier"
 25         "memcpy"
 26         "memcpy with barrier"
 27         "increment"
 28 )
 29 IFS="$OLDIFS"
 30 
 31 REPS=1000
 32 SLOW_REPS=100
 33 NR_THREADS=$((6*${NR_CPUS}))
 34 
 35 function do_tests()
 36 {
 37         local i=0
 38         while [ "$i" -lt "${#TEST_LIST[@]}" ]; do
 39                 echo "Running test ${TEST_NAME[$i]}"
 40                 ./param_test ${TEST_LIST[$i]} -r ${REPS} -t ${NR_THREADS} ${@} ${EXTRA_ARGS} || exit 1
 41                 echo "Running compare-twice test ${TEST_NAME[$i]}"
 42                 ./param_test_compare_twice ${TEST_LIST[$i]} -r ${REPS} -t ${NR_THREADS} ${@} ${EXTRA_ARGS} || exit 1
 43                 let "i++"
 44         done
 45 }
 46 
 47 echo "Default parameters"
 48 do_tests
 49 
 50 echo "Loop injection: 10000 loops"
 51 
 52 OLDIFS="$IFS"
 53 IFS=$'\n'
 54 INJECT_LIST=(
 55         "1"
 56         "2"
 57         "3"
 58         "4"
 59         "5"
 60         "6"
 61         "7"
 62         "8"
 63         "9"
 64 )
 65 IFS="$OLDIFS"
 66 
 67 NR_LOOPS=10000
 68 
 69 i=0
 70 while [ "$i" -lt "${#INJECT_LIST[@]}" ]; do
 71         echo "Injecting at <${INJECT_LIST[$i]}>"
 72         do_tests -${INJECT_LIST[i]} ${NR_LOOPS}
 73         let "i++"
 74 done
 75 NR_LOOPS=
 76 
 77 function inject_blocking()
 78 {
 79         OLDIFS="$IFS"
 80         IFS=$'\n'
 81         INJECT_LIST=(
 82                 "7"
 83                 "8"
 84                 "9"
 85         )
 86         IFS="$OLDIFS"
 87 
 88         NR_LOOPS=-1
 89 
 90         i=0
 91         while [ "$i" -lt "${#INJECT_LIST[@]}" ]; do
 92                 echo "Injecting at <${INJECT_LIST[$i]}>"
 93                 do_tests -${INJECT_LIST[i]} -1 ${@}
 94                 let "i++"
 95         done
 96         NR_LOOPS=
 97 }
 98 
 99 echo "Yield injection (25%)"
100 inject_blocking -m 4 -y
101 
102 echo "Yield injection (50%)"
103 inject_blocking -m 2 -y
104 
105 echo "Yield injection (100%)"
106 inject_blocking -m 1 -y
107 
108 echo "Kill injection (25%)"
109 inject_blocking -m 4 -k
110 
111 echo "Kill injection (50%)"
112 inject_blocking -m 2 -k
113 
114 echo "Kill injection (100%)"
115 inject_blocking -m 1 -k
116 
117 echo "Sleep injection (1ms, 25%)"
118 inject_blocking -m 4 -s 1
119 
120 echo "Sleep injection (1ms, 50%)"
121 inject_blocking -m 2 -s 1
122 
123 echo "Sleep injection (1ms, 100%)"
124 inject_blocking -m 1 -s 1

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

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | 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.

osdn.jp