pps_fetch: introduce a helper to handle timeouts
[dragonfly.git] / test / sysperf / ipitest
blob28ff8f1923ffbfb09d86013439598627d6da4cef
1 #!/bin/csh
3 # ipitest [ Cmode ]
5 # NOTE: Run from current directory as ./ipitest, output in ipitest.out
7 # NOTE: Running powerd during this test is not recommended.
9 # Force test to run from cpu 0
11 if ( $?DIDUSCHED == 0 ) then
12 setenv DIDUSCHED ok
13 usched :1 ./ipitest $argv
14 exit 0
15 endif
17 # CX mode can be specified on the command line, if not
18 # specified test all available CX modes.
20 if ( $#argv == 0 ) then
21 set modes = "`sysctl -n machdep.mwait.CX.supported`"
22 else
23 set modes = "$argv"
24 endif
26 set ncpus = "`sysctl -n hw.ncpu`"
27 set cpus = "`seq 1 $ncpus`"
29 # Start test. Use a sleep to give other cpus time to go
30 # idle. Try to avoid being on a hardclock boundary.
32 set file = "ipitest.out"
33 echo "Testing $modes"
35 fgrep CPU /var/run/dmesg.boot | fgrep @ | head -1 > ${file}
36 date >> ${file}
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