rc: Move stop_boot() from rc.d/fsck to rc.subr and improve it
[dragonfly.git] / test / sysperf / ipitest
1 #!/bin/csh
2 #
3 # ipitest [ Cmode ]
4 #
5 # NOTE: Run from current directory as ./ipitest, output in ipitest.out
6 #
7 # NOTE: Running powerd during this test is not recommended.
8
9 # Force test to run from cpu 0
10 #
11 if ( $?DIDUSCHED == 0 ) then
12         setenv DIDUSCHED ok
13         usched :1 ./ipitest $argv
14         exit 0
15 endif
16
17 # CX mode can be specified on the command line, if not
18 # specified test all available CX modes.
19 #
20 if ( $#argv == 0 ) then
21     set modes = "`sysctl -n machdep.mwait.CX.supported`"
22 else
23     set modes = "$argv"
24 endif
25
26 set ncpus = "`sysctl -n hw.ncpu`"
27 set cpus = "`seq 1 $ncpus`"
28
29 # Start test.  Use a sleep to give other cpus time to go
30 # idle.  Try to avoid being on a hardclock boundary.
31 #
32 set file = "ipitest.out"
33 echo "Testing $modes"
34
35 fgrep CPU /var/run/dmesg.boot | fgrep @ | head -1 > ${file}
36 date >> ${file}
37
38 foreach mode ( $modes )
39     echo "Testing mode $mode"
40     sysctl machdep.mwait.CX.idle=$mode
41     foreach i ( $cpus )
42         foreach j ( x x x x x x x x x )
43                 sleep 0.200010
44                 sysctl debug.ipiq.latency_test=$i >& /dev/null
45         end
46     end
47     sleep 0.2
48     echo "Testing mode $mode" >> ${file}
49     sysctl debug.ipiq >> ${file}
50     echo ""
51 end