xref: /dragonfly/test/sysperf/ipitest (revision ec21d9fb)
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#
11if ( $?DIDUSCHED == 0 ) then
12	setenv DIDUSCHED ok
13	usched :1 ./ipitest $argv
14	exit 0
15endif
16
17# CX mode can be specified on the command line, if not
18# specified test all available CX modes.
19#
20if ( $#argv == 0 ) then
21    set modes = "`sysctl -n machdep.mwait.CX.supported`"
22else
23    set modes = "$argv"
24endif
25
26set ncpus = "`sysctl -n hw.ncpu`"
27set 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#
32set file = "ipitest.out"
33echo "Testing $modes"
34
35fgrep CPU /var/run/dmesg.boot | fgrep @ | head -1 > ${file}
36date >> ${file}
37
38foreach 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 ""
51end
52