blob: 2b32f2afe3c353a6fb8606221915f293957495e1 (
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
|
#!/bin/sh -e
#
# PIPAPO - PIle PAcket POlicies
#
# tests/run.sh - Run functional and performance tests, plot matching rates
#
# Author: Stefano Brivio <sbrivio@redhat.com>
# License: GPLv2
check() {
if ! ../pipapo.check ${type}.${size} ${type}.${size}.packets >/dev/null; then
echo " functional test: FAIL at ${type}.${size} ${type}.${size}.packets"
exit 1
fi
echo " functional test: PASS"
}
pps() {
s="$(wc -l ${type}.${size})"
s=${s% *}
if [ ${s} -gt 10 ]; then
s=$((s / 10))
s=$((s * 10))
fi
pps="$(../pipapo ${type}.${size} ${type}.${size}.packets | sed -nr 's/.* \((.*) Mpps\)$/\1/p')"
printf "%i %f\n" "${s}" "${pps}" >> plots/rate_${type}.data
echo " matching rate (AVX2): ${pps} Mpps"
pps="$(../pipapo.noavx2 ${type}.${size} ${type}.${size}.packets | sed -nr 's/.* \((.*) Mpps\)$/\1/p')"
printf "%i %f\n" "${s}" "${pps}" >> plots/rate_noavx2_${type}.data
echo " matching rate (no AVX2): ${pps} Mpps"
pps="$(../pipapo.nosimd ${type}.${size} ${type}.${size}.packets | sed -nr 's/.* \((.*) Mpps\)$/\1/p')"
printf "%i %f\n" "${s}" "${pps}" >> plots/rate_nosimd_${type}.data
echo " matching rate (no SIMD): ${pps} Mpps"
}
mem() {
s="$(wc -l ${type}.${size})"
s=${s% *}
if [ ${s} -gt 10 ]; then
s=$((s / 10))
s=$((s * 10))
fi
out="$(../pipapo.mem ${type}.${size} ${type}.${size}.packets | sed -nr 's/^Total: ([0-9].*)((KiB$|MiB$|B$))$/\1 \2/p')"
case ${out} in
*" KiB")
_out=$((${out%% *} * 1024))
;;
*" MiB")
_out=$((${out%% *} * 1024 * 1024))
;;
*" B")
_out=${out%% *}
;;
esac
printf "%i %i\n" "${s}" "${_out}" >> plots/memory_${type}.data
echo " memory used: $(echo ${out} | tr -d ' ')"
}
[ -d plots ] || { ./gen.sh && mkdir -p plots; }
plot() {
title="$(echo ${title} | tr '_' ', ')"
gnuplot <<EOF
set terminal pngcairo size 600,400 enhanced font 'Lucida Sans,10' rounded
set logscale x
set xlabel "Entries for each field"
set ylabel "Mpps"
set title '${title}'
set grid
set key right top
set output 'plots/${type}.png'
plot 'plots/rate_${type}.data' w l ls 1 t 'AVX2', 'plots/rate_noavx2_${type}.data' w l ls 2 t 'No AVX2', 'plots/rate_nosimd_${type}.data' w l ls 3 t 'No SIMD'
EOF
}
for type in port net_port net_port_ranged mac_net6_ranged; do
echo "=== TEST: ${type}"
for size in single tiny small mid big huge; do
:> plots/rate_${type}.data
:> plots/rate_noavx2_${type}.data
:> plots/rate_nosimd_${type}.data
:> plots/memory_${type}.data
done
for size in single tiny small mid big huge; do
echo " - size: ${size}"
check
pps
mem
done
plot
echo
done
for test in *.static; do
echo "=== TEST: ${test}"
type="${test%*.static}"
:> plots/rate_${type}.data
:> plots/rate_noavx2_${type}.data
:> plots/rate_nosimd_${type}.data
:> plots/memory_${type}.data
size="static"
check
pps
mem
echo
done
exit 0
|