Skip to content

Commit

Permalink
netp bench
Browse files Browse the repository at this point in the history
  • Loading branch information
thehajime committed Dec 19, 2024
1 parent b52bef7 commit c3bcdf8
Show file tree
Hide file tree
Showing 6 changed files with 108 additions and 20 deletions.
1 change: 1 addition & 0 deletions .github/workflows/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ RUN sed "s/\'/\"/g" /etc/profile > /.profile

ADD bench.sh /
ADD iperf3.sh /root/
ADD netperf-bench.sh /root/
ADD iperf3.static /root/
ADD do_getpid /root/.
ADD clone /root/.
Expand Down
16 changes: 11 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -317,11 +317,11 @@ jobs:
iperf3 -s &
iperf3 -c localhost -fm | tee output/native-iperf3.dat
iperf3 -c localhost -fm -R | tee -a output/native-iperf3.dat
netperf -H localhost -t TCP_STREAM -- -o THROUGHPUT,THROUGHPUT_UNITS,COMMAND_LINE | tee -a output/native-iperf3.dat
netperf -H localhost -t TCP_MAERTS -- -o THROUGHPUT,THROUGHPUT_UNITS,COMMAND_LINE | tee -a output/native-iperf3.dat
bash .github/workflows/netperf-bench.sh localhost netperf | tee -a output/native-iperf3.dat
- name: bench data parse/out
run: |
bash .github/workflows/um-nommu-plot.sh output |& tee um-nommu.log
bash .github/workflows/netperf-plot.sh output
export TMP_OUTPUT=$(cat um-nommu.log)
echo "TMP_OUTPUT<<EOF" >> $GITHUB_ENV
echo "$TMP_OUTPUT" >> $GITHUB_ENV
Expand All @@ -330,7 +330,7 @@ jobs:
- uses: actions/upload-artifact@v4
with:
name: bench-result-all
path: output/out/lmbench.*
path: output/out/*
- name: publish to imgur
uses: devicons/public-upload-to-imgur@v2.2.2
id: lmbench-imgur
Expand All @@ -343,9 +343,15 @@ jobs:
with:
path: "output/out/iperf3.png"
client_id: ${{secrets.IMGUR_CLIENT_ID}}
- name: bench data parse/out
- name: publish to imgur-netperf
uses: devicons/public-upload-to-imgur@v2.2.2
id: netperf-imgur
with:
path: "output/out/tcp-stream.png"
client_id: ${{secrets.IMGUR_CLIENT_ID}}
- name: prepare action post
run: |
export SCRIPT_OUTPUT="${{ join(fromJSON(steps.lmbench-imgur.outputs.markdown_urls)) }} ${{ join(fromJSON(steps.iperf3-imgur.outputs.markdown_urls)) }}"
export SCRIPT_OUTPUT="${{ join(fromJSON(steps.lmbench-imgur.outputs.markdown_urls)) }} ${{ join(fromJSON(steps.iperf3-imgur.outputs.markdown_urls)) }} ${{ join(fromJSON(steps.netperf-imgur.outputs.markdown_urls)) }}"
echo "SCRIPT_OUTPUT<<EOF" >> $GITHUB_ENV
echo "$TMP_OUTPUT" >> $GITHUB_ENV
echo "" >> $GITHUB_ENV
Expand Down
7 changes: 1 addition & 6 deletions .github/workflows/iperf3.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,6 @@ $IPERF -c 192.168.122.1 -fm
echo "===iperf3 reverse==="
$IPERF -c 192.168.122.1 -R -fm

/sbin/sysctl -w net.ipv4.tcp_wmem="40960 873800 1677721600"

echo "===netperf forward==="
/root/netperf -H 192.168.122.1 -t TCP_STREAM -- -o THROUGHPUT,THROUGHPUT_UNITS,COMMAND_LINE
echo "===netperf reverse==="
/root/netperf -H 192.168.122.1 -t TCP_MAERTS -- -o THROUGHPUT,THROUGHPUT_UNITS,COMMAND_LINE
sh /root/netperf-bench.sh

/sbin/halt -f
18 changes: 18 additions & 0 deletions .github/workflows/netperf-bench.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/sh

PSIZES="64 128 256 512 1024 1500 65507"
TESTNAMES="TCP_STREAM TCP_MAERTS"
DEST_ADDR=${1:-"192.168.122.1"}
NETPERF=${2:-/root/netperf}

/sbin/sysctl -w net.ipv4.tcp_wmem="40960 873800 1677721600"

for size in $PSIZES
do
for test in $TESTNAMES
do
echo "== netperf ($size-$test) =="
$NETPERF -H $DEST_ADDR -t $test -- -o THROUGHPUT,THROUGHPUT_UNITS,LOCAL_SEND_SIZE,COMMAND_LINE -m "$size,$size"

done
done
76 changes: 76 additions & 0 deletions .github/workflows/netperf-plot.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
#!/bin/bash

SCRIPT_DIR="$(dirname "${BASH_SOURCE[0]}")"
OUTPUT="$1"

mkdir -p "$OUTPUT/out/"

# parse outputs
# TCP_STREAM
for f in `ls $OUTPUT/*-iperf3.dat`
do
cat $f | grep bits |grep STREAM | awk -F',' '{print $3" " $1}' \
> $OUTPUT/out/`basename $f .dat|sed "s/iperf3/netperf/g"`-fwd-out.dat
cat $f | grep bits |grep MAERTS | awk -F',' '{print $3" " $1}' \
> $OUTPUT/out/`basename $f .dat|sed "s/iperf3/netperf/g"`-rev-out.dat
done # end of ${DIR}


PSIZE_XTICS="('64' 0, '128' 2, '256' 4, '512' 6, '1024' 8, '1500' 10, '65507' 12)"
PAT_NATIVE='fill patter 2 lc rgb "red"'
PAT_MMU='fill patter 2 lc rgb "green"'
PAT_NOMMU_S='fill patter 2 lc rgb "royalblue"'
PAT_NOMMU_Z='fill patter 2 lc rgb "blue"'

gnuplot << EndGNUPLOT
set terminal postscript color eps lw 3 "Helvetica" 24
set output "${OUTPUT}/out/tcp-stream.eps"
#set xtics font "Helvetica,14"
set pointsize 2
set xzeroaxis
set grid ytics
set boxwidth 0.4
set style fill pattern
set size 1.0,0.9
set key font ",18"
set key top left Left reverse
#set key above vertical maxrows 2
set xrange [-1:13]
set xtics ${PSIZE_XTICS}
set xlabel "Payload size (bytes)"
set yrange [-20:20]
#set ytics ('0' -10, '5' -5, '0' 0, '5' 5, '10' 10)
set ylabel "Goodput (Gbps)" offset +0.8
plot \
'${OUTPUT}/out/native-netperf-fwd-out.dat' usin (\$0*2-0.6):(\$2/1000) w boxes $PAT_NATIVE title "native" ,\
'${OUTPUT}/out/um-mmu-netperf-fwd-out.dat' usin (\$0*2-0.2):(\$2/1000) w boxes $PAT_MMU title "um(mmu)" ,\
'${OUTPUT}/out/um-nommu-seccomp-netperf-fwd-out.dat' usin (\$0*2+0.2):(\$2/1000) w boxes $PAT_NOMMU_S title "um(nommu(s))" ,\
'${OUTPUT}/out/um-nommu-zpoline-netperf-fwd-out.dat' usin (\$0*2+0.6):(\$2/1000) w boxes $PAT_NOMMU_Z title "um(nommu(z))" ,\
'${OUTPUT}/out/native-netperf-rev-out.dat' usin (\$0*2-0.6):(\$2*-1/1000) w boxes $PAT_NATIVE notitle ,\
'${OUTPUT}/out/um-mmu-netperf-rev-out.dat' usin (\$0*2-0.2):(\$2*-1/1000) w boxes $PAT_MMU notitle ,\
'${OUTPUT}/out/um-nommu-seccomp-netperf-rev-out.dat' usin (\$0*2+0.2):(\$2*-1/1000) w boxes $PAT_NOMMU_S notitle ,\
'${OUTPUT}/out/um-nommu-zpoline-netperf-rev-out.dat' usin (\$0*2+0.6):(\$2*-1/1000) w boxes $PAT_NOMMU_Z notitle
set terminal png lw 3 14 crop
set key font ",12"
set size 1.0,1.0
set ylabel "Goodput (Gbps)" offset +0.5
set output "${OUTPUT}/out/tcp-stream.png"
replot
#set terminal dumb
#unset key
#unset output
#replot
quit
EndGNUPLOT

10 changes: 1 addition & 9 deletions .github/workflows/um-nommu-plot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@ for f in `ls $OUTPUT/*-iperf3.dat`
do
cat $f | grep receiver | awk '{print $7}' \
> $OUTPUT/out/`basename $f .dat`-out.dat
cat $f | grep bits |grep STREAM | cut -d',' -f1 \
>> $OUTPUT/out/`basename $f .dat`-out.dat
cat $f | grep bits |grep MAERTS | cut -d',' -f1 \
>> $OUTPUT/out/`basename $f .dat`-out.dat
done

gnuplot << EndGNUPLOT
Expand Down Expand Up @@ -95,7 +91,7 @@ set size 1.0,0.8
set key top left
set xrange [-0.5:]
set xtics ('iperf(f)' 0, 'iperf(r)' 1, 'netperf(f)' 2, 'netperf(r)' 3)
set xtics ('iperf(f)' 0, 'iperf(r)' 1)
#set xtics rotate by 45 right
set yrange [:50]
set ytics 10
Expand All @@ -120,13 +116,9 @@ for f in `ls $OUTPUT/out/*iperf3*.dat`
do
export $(basename $f .dat|sed "s/-/_/g" | sed "s/_iperf3_out/_f/")=`cat $f|awk NR==1`
export $(basename $f .dat|sed "s/-/_/g" | sed "s/_iperf3_out/_r/")=`cat $f|awk NR==2`
export $(basename $f .dat|sed "s/-/_/g" | sed "s/_iperf3_out/_nf/")=`cat $f|awk NR==3`
export $(basename $f .dat|sed "s/-/_/g" | sed "s/_iperf3_out/_nr/")=`cat $f|awk NR==4`


done
echo -e "||native|um|um-nommu(s)|um-nommu(z)|\n|--|--|--|--|--|"
echo "|iperf3(f) | ${native_f} | ${um_mmu_f} | ${um_nommu_seccomp_f}| ${um_nommu_zpoline_f}|"
echo "|iperf3(r) | ${native_r} | ${um_mmu_r} | ${um_nommu_seccomp_r}| ${um_nommu_zpoline_r}|"
echo "|netperf(f) | ${native_nf} | ${um_mmu_nf} | ${um_nommu_seccomp_nf}| ${um_nommu_zpoline_nf}|"
echo "|netperf(r) | ${native_nr} | ${um_mmu_nr} | ${um_nommu_seccomp_nr}| ${um_nommu_zpoline_nr}|"

0 comments on commit c3bcdf8

Please sign in to comment.