Skip to content

Commit

Permalink
fixup gh
Browse files Browse the repository at this point in the history
  • Loading branch information
thehajime committed Sep 21, 2024
1 parent aadadb9 commit f1410f6
Show file tree
Hide file tree
Showing 7 changed files with 166 additions and 5 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/bench.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/sh

mount proc /proc -t proc
export PATH=/home:/sbin:/usr/sbin:/bin:/usr/bin


cd /lmbench2/bin/x86_64-linux-gnulibc1
sh lmbench_run.sh

/root/do_getpid -c 10000

halt -f
49 changes: 44 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,14 @@ jobs:
runs_on: ubuntu-22.04
shell: bash
defconfig: defconfig
testname: um-mmu
- displayTargetName: ubuntu-22.04 (nommu)
os: unix
runs_on: ubuntu-22.04
shell: bash
defconfig: x86_64_nommu_defconfig
kunit_opts: --kconfig_add CONFIG_MMU=n
testname: um-nommu
timeout-minutes: 100
env:
CCACHE_DIR: ${{ github.workspace }}/.ccache
Expand All @@ -48,10 +50,11 @@ jobs:
key: ${{ runner.os }}-${{ matrix.defconfig }}-ccache-build-${{ github.sha }}
restore-keys: ${{ runner.os }}-${{ matrix.defconfig }}-ccache-build-
- name: Install packages
if: runner.os == 'Linux'
run: |
sudo apt update -y
sudo apt install -y ccache libseccomp-dev
- name: Setup faketty
uses: Yuri6037/Action-FakeTTY@v1.1
- name: build-0
run: |
make ARCH=um ${{ matrix.defconfig }} O=build
Expand Down Expand Up @@ -85,11 +88,14 @@ jobs:
echo "/sbin/halt" >> .github/workflows/rcS
sudo cp .github/workflows/rcS $mnt/etc/init.d/
sudo cp .github/workflows/inittab $mnt/etc/
cat .github/workflows/bench.sh | sed "s/time //" > /tmp/bench.sh
sudo cp /tmp/bench.sh $mnt/
sudo cp .github/workflows/do_getpid.alpine $mnt/root/do_getpid
sudo umount $mnt
- name: test-0
run: |
sudo sh -c "echo 0 > /proc/sys/vm/mmap_min_addr"
./build/vmlinux ubd0=./alpine.ext4 rw mem=1024m loglevel=8 console=tty init=/sbin/init 2>&1 | tee /tmp/log.txt
faketty ./build/vmlinux eth0=tuntap,tap100,0e:fd:0:0:0:1,172.17.0.1 ubd0=./alpine.ext4 rw mem=1024m loglevel=8 console=tty init=/sbin/init 2>&1 | tee /tmp/log.txt
echo "========="
cat /tmp/log.txt
- name: kunit test
Expand All @@ -104,11 +110,22 @@ jobs:
make -j8 ARCH=um
- name: test-1
run: |
./vmlinux ubd0=./alpine.ext4 rw mem=1024m loglevel=8 console=tty init=/sbin/init 2>&1 | tee /tmp/log.txt
faketty ./vmlinux eth0=tuntap,tap100,0e:fd:0:0:0:1,172.17.0.1 ubd0=./alpine.ext4 rw mem=1024m loglevel=8 init=/sbin/init 2>&1 | tee /tmp/log.txt
echo "========="
cat /tmp/log.txt
#- name: Setup tmate session
# uses: mxschmitt/action-tmate@v3
- name: benchmark-0
run: |
mkdir -p output
faketty ./vmlinux eth0=tuntap,tap100,0e:fd:0:0:0:1,172.17.0.1 ubd0=./alpine.ext4 rw mem=1024m \
loglevel=0 init=/bench.sh | tee output/${{ matrix.testname }}.dat
- uses: actions/upload-artifact@v4
with:
name: bench-result
path: output/${{ matrix.testname }}.dat
- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
with:
detached: true

checkpatch:
runs-on: ubuntu-22.04
Expand All @@ -129,3 +146,25 @@ jobs:
git checkout -b tmp
git format-patch -o p1 v6.10..HEAD~1
./scripts/checkpatch.pl --summary-file --ignore FILE_PATH_CHANGES p1/*.patch
bench-result:
runs-on: ubuntu-22.04
name: bench-result
needs: tests
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
- name: Display structure of downloaded files
run: ls -R
- name: Install packages
run: |
sudo apt update -y
sudo apt install -y gnuplot lmbench
- name: benchmark-host
run: |
mkdir -p output
sh .github/workflows/lmbench_run.sh |& tee output/native.dat
.github/workflows/do_getpid -c 100 | tee -a output/native.dat
- name: bench data parse/out
run: |
bash .github/workflows/um-nommu-plot.sh output
Binary file added .github/workflows/do_getpid
Binary file not shown.
Binary file added .github/workflows/do_getpid.alpine
Binary file not shown.
15 changes: 15 additions & 0 deletions .github/workflows/lmbench_run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
cp /usr/lib/lmbench/bin/x86_64-linux-gnu/hello /var/tmp/lmbench/hello

PATH=/usr/lib/lmbench/bin/x86_64-linux-gnu/:$PATH

ENOUGH=10000 lat_select -n 10 file
ENOUGH=10000 lat_select -n 100 file
ENOUGH=10000 lat_select -n 1000 file

ENOUGH=100000 lat_syscall null
ENOUGH=100000 lat_syscall read
ENOUGH=100000 lat_syscall write
ENOUGH=100000 lat_syscall stat
ENOUGH=100000 lat_syscall open
ENOUGH=10000 lat_proc shell
ENOUGH=10000 lat_proc exec
28 changes: 28 additions & 0 deletions .github/workflows/um-nommu-bench.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/bash

SCRIPT_DIR="$(cd $(dirname "${BASH_SOURCE[0]}"); pwd)"

# macos has different syntax
OUTPUT=$SCRIPT_DIR/$(date "+%Y-%m-%d")
mkdir -p $OUTPUT

TRIALS="1"
ENTRIES="1000000"
VSIZES="1 8 256 1024 8192"
RUNTIMES="build/mmu build"


echo "$(tput bold)== um (mmu) ($test-$num-$vsize) ==$(tput sgr0)"
../linux-um-nommu/build-mmu/vmlinux eth0=tuntap,tap100,0e:fd:0:0:0:1,172.17.0.1 ubd0=./alpine-test.ext3 rw mem=1024m loglevel=0 init=/bench.sh \
| tee "$OUTPUT/um-mmu.dat"

echo "$(tput bold)== um (nommu) ($test-$num-$vsize) ==$(tput sgr0)"
../linux-um-nommu/build/vmlinux eth0=tuntap,tap100,0e:fd:0:0:0:1,172.17.0.1 ubd0=./alpine-test.ext3 rw mem=1024m loglevel=0 init=/bench.sh \
| tee "$OUTPUT/um-nommu.dat"

echo "$(tput bold)== host (mmu) ($test-$num-$vsize) ==$(tput sgr0)"
sh docker/alpine/lmbench_run.sh \
|& tee "$OUTPUT/native.dat"
./zpoline-bench/do_getpid -c 100 | tee -a "$OUTPUT/native.dat"

bash ${SCRIPT_DIR}/um-nommu-plot.sh ${OUTPUT}
67 changes: 67 additions & 0 deletions .github/workflows/um-nommu-plot.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
#!/bin/bash

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

OUTPUT="$1"
DIRS="read fill"

mkdir -p "$OUTPUT/out/"

# parse outputs

for f in `ls $OUTPUT/*.dat`
do
cat $f | grep microsec | sed "s/.*:\(.*\)/\1/" | awk '{print $1}' \
> $OUTPUT/out/`basename $f .dat`-out.dat

cat $f | grep average | awk '{print $2 $3}' \
> $OUTPUT/out/`basename $f .dat`-getpid-out.dat
done

gnuplot << EndGNUPLOT
set terminal postscript eps lw 3 "Helvetica" 24
set output "${OUTPUT}/out/lmbench.eps"
#set xtics font "Helvetica,14"
set pointsize 2
set xzeroaxis
set grid ytics
set boxwidth 0.2
set style fill pattern
set size 1.0,0.8
set key top left
set xrange [-0.5:10]
set xtics ('select10' 0, 'select-100' 1, 'select-1000' 2, 'syscall' 3, 'read' 4, 'write' 5, 'stat' 6, 'open/close' 7, 'fork+sh' 8, 'fork+execve' 9)
set xtics rotate by 45 right
set yrange [0.01:100000]
set ylabel "Latency (usec)"
set logscale y
plot \
'${OUTPUT}/out/um-mmu-out.dat' usin (\$0-0.2):(\$1) w boxes fill patter 2 lt 1 lc rgb "green" title "um(mmu)" ,\
'${OUTPUT}/out/um-nommu-out.dat' usin (\$0):(\$1) w boxes fill patter 2 lt 1 lc rgb "blue" title "um(nommu)" ,\
'${OUTPUT}/out/native-out.dat' usin (\$0+0.2):(\$1) w boxes fill patter 2 lt 1 lc rgb "red" title "native"
set terminal png lw 3 14 crop
set output "${OUTPUT}/out/lmbench.png"
replot
EndGNUPLOT

echo -e "### lmbench (usec)\n"
echo -e "|select-10\n|select-100\n|select-1000\n|syscall\n|read\n|write\n|stat\n|open/close\n|fork+sh\n|fork+execve" > /tmp/a

echo -e "||native|um|um-nommu| \n|--|--|--|--|"; paste -d "|" `ls ${OUTPUT}/out/*.dat |grep -v getpid` | sed "s/\(.*\)/\|\1\|/" | paste /tmp/a - | column -t

rm -f /tmp/a

echo ""
echo -e "### do_getpid bench (nsec)\n"
for f in `ls $OUTPUT/*.dat`
do
export $(basename $f .dat|sed "s/-/_/")=`grep aver $f | awk '{print $2}'`
done
echo -e "||native|um|um-nommu| \n|--|--|--|--|"
echo "|getpid | ${native} | ${um_mmu} | ${um_nommu}|"

0 comments on commit f1410f6

Please sign in to comment.