summaryrefslogtreecommitdiff
path: root/benchmarks/ezbench.d/gem_latency.test
blob: 22d91b2ed52decaabd435d5910d7eae73ea65e6b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
test_exec_time=2
test_invert=1

[ -e $IGT_BENCHMARKS/gem_latency ] || return 1
sudo -n true || return 1

__gem:dispatch__() {
    for (( c=0; c<$1; c++ )); do
        sudo $IGT_BENCHMARKS/gem_latency -t 2 -n $2 -p $3 -f $4
    done
}

# Measure the delay to execute N nops
for n in 0 1 2 4 8 16 32 64 128 256 512 1024; do
	name="gem:exec:latency:$n"
	test_name="$test_name $name"
	eval "${name}_run() { __gem:dispatch__ \$1 $n 1 1 ; } "
done

# Measure the execution delay vs contention, just for fun
for p in 1 2 4 8 16 32 64 128 256 512 1024; do
	name="gem:latency:dispatch:$p"
	test_name="$test_name $name"
	eval "${name}_run() { __gem:dispatch__ \$1 0 $p 1 ; } "
done

for p in 1 2 4 8 16 32 64 128 256 512 1024; do
	name="gem:throughput:dispatch:$p"
	test_name="$test_name $name"
	eval "${name}_run() { __gem:dispatch__ \$1 8 $p 5 ; } "
done

# Measure the wakeup delay (each wakeup should be uncontended)
__gem:latency:wait__() {
    for (( c=0; c<$1; c++ )); do
        sudo $IGT_BENCHMARKS/gem_latency -t 2 -w 2 -p $2 -f 2 $3
    done
}
for p in 1 2 4 8 16 32 64 128 256 512 1024; do
	name="gem:latency:wait:$p"
	test_name="$test_name $name"
	eval "${name}_run() { __gem:latency:wait__ \$1 $p ; } "

	name="gem:latency:wait:$p:fence"
	test_name="$test_name $name"
	eval "${name}_run() { __gem:latency:wait__ \$1 $p -F ; } "
done

# Measure the total CPU cycles for the uncontended wakeups
__gem:latency:cpu__() {
    for (( c=0; c<$1; c++ )); do
        sudo $IGT_BENCHMARKS/gem_latency -t 2 -w 2 -p $2 -f 4 $3
    done
}
for p in 1 2 4 8 16 32 64 128 512 1024; do
	name="gem:latency:cpu:$p"
	test_name="$test_name $name"
	eval "${name}_run() { __gem:latency:cpu__ \$1 $p ; } "

	name="gem:latency:cpu:$p:fence"
	test_name="$test_name $name"
	eval "${name}_run() { __gem:latency:cpu__ \$1 $p -F ; } "
done

# Measure the wakeup delay for contended wakeups (multiple waiters per request)
__gem:latency:herd__() {
    for (( c=0; c<$1; c++ )); do
        sudo $IGT_BENCHMARKS/gem_latency -t 2 -w 1 -c $2 -f 2 $3
    done
}
for p in 0 1 2 4 8 16 32 64 128 512 1024; do
	name="gem:latency:herd:$p"
	test_name="$test_name $name"
	eval "${name}_run() { __gem:latency:herd__ \$1 $p ; } "

	name="gem:latency:herd:$p:fence"
	test_name="$test_name $name"
	eval "${name}_run() { __gem:latency:herd__ \$1 $p -F ; } "
done

# Measure the impact of contended wakeups on the RealTime waiter
__gem:latency:realtime__() {
    for (( c=0; c<$1; c++ )); do
        sudo $IGT_BENCHMARKS/gem_latency -t 2 -w 1 -c $2 -R -f 3 $3
    done
}
for p in 0 1 2 4 8 16 32 64 128 512 1024; do
	name="gem:latency:realtime:$p"
	test_name="$test_name $name"
	eval "${name}_run() { __gem:latency:realtime__ \$1 $p ; } "

	name="gem:latency:realtime:$p:fence"
	test_name="$test_name $name"
	eval "${name}_run() { __gem:latency:realtime__ \$1 $p -F ; } "
done