1test_exec_time=2 2test_invert=1 3 4[ -e $IGT_BENCHMARKS/gem_latency ] || return 1 5sudo -n true || return 1 6 7__gem:dispatch__() { 8 for (( c=0; c<$1; c++ )); do 9 sudo $IGT_BENCHMARKS/gem_latency -t 2 -n $2 -p $3 -f $4 10 done 11} 12 13# Measure the delay to execute N nops 14for n in 0 1 2 4 8 16 32 64 128 256 512 1024; do 15 name="gem:exec:latency:$n" 16 test_name="$test_name $name" 17 eval "${name}_run() { __gem:dispatch__ \$1 $n 1 1 ; } " 18done 19 20# Measure the execution delay vs contention, just for fun 21for p in 1 2 4 8 16 32 64 128 256 512 1024; do 22 name="gem:latency:dispatch:$p" 23 test_name="$test_name $name" 24 eval "${name}_run() { __gem:dispatch__ \$1 0 $p 1 ; } " 25done 26 27for p in 1 2 4 8 16 32 64 128 256 512 1024; do 28 name="gem:throughput:dispatch:$p" 29 test_name="$test_name $name" 30 eval "${name}_run() { __gem:dispatch__ \$1 8 $p 5 ; } " 31done 32 33# Measure the wakeup delay (each wakeup should be uncontended) 34__gem:latency:wait__() { 35 for (( c=0; c<$1; c++ )); do 36 sudo $IGT_BENCHMARKS/gem_latency -t 2 -w 2 -p $2 -f 2 $3 37 done 38} 39for p in 1 2 4 8 16 32 64 128 256 512 1024; do 40 name="gem:latency:wait:$p" 41 test_name="$test_name $name" 42 eval "${name}_run() { __gem:latency:wait__ \$1 $p ; } " 43 44 name="gem:latency:wait:$p:fence" 45 test_name="$test_name $name" 46 eval "${name}_run() { __gem:latency:wait__ \$1 $p -F ; } " 47done 48 49# Measure the total CPU cycles for the uncontended wakeups 50__gem:latency:cpu__() { 51 for (( c=0; c<$1; c++ )); do 52 sudo $IGT_BENCHMARKS/gem_latency -t 2 -w 2 -p $2 -f 4 $3 53 done 54} 55for p in 1 2 4 8 16 32 64 128 512 1024; do 56 name="gem:latency:cpu:$p" 57 test_name="$test_name $name" 58 eval "${name}_run() { __gem:latency:cpu__ \$1 $p ; } " 59 60 name="gem:latency:cpu:$p:fence" 61 test_name="$test_name $name" 62 eval "${name}_run() { __gem:latency:cpu__ \$1 $p -F ; } " 63done 64 65# Measure the wakeup delay for contended wakeups (multiple waiters per request) 66__gem:latency:herd__() { 67 for (( c=0; c<$1; c++ )); do 68 sudo $IGT_BENCHMARKS/gem_latency -t 2 -w 1 -c $2 -f 2 $3 69 done 70} 71for p in 0 1 2 4 8 16 32 64 128 512 1024; do 72 name="gem:latency:herd:$p" 73 test_name="$test_name $name" 74 eval "${name}_run() { __gem:latency:herd__ \$1 $p ; } " 75 76 name="gem:latency:herd:$p:fence" 77 test_name="$test_name $name" 78 eval "${name}_run() { __gem:latency:herd__ \$1 $p -F ; } " 79done 80 81# Measure the impact of contended wakeups on the RealTime waiter 82__gem:latency:realtime__() { 83 for (( c=0; c<$1; c++ )); do 84 sudo $IGT_BENCHMARKS/gem_latency -t 2 -w 1 -c $2 -R -f 3 $3 85 done 86} 87for p in 0 1 2 4 8 16 32 64 128 512 1024; do 88 name="gem:latency:realtime:$p" 89 test_name="$test_name $name" 90 eval "${name}_run() { __gem:latency:realtime__ \$1 $p ; } " 91 92 name="gem:latency:realtime:$p:fence" 93 test_name="$test_name $name" 94 eval "${name}_run() { __gem:latency:realtime__ \$1 $p -F ; } " 95done 96