mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-17 12:47:16 +00:00
Update docker image and add the benchmarks
This commit is contained in:
parent
47d2a895af
commit
e6f3a6a8a4
4
.github/workflows/cargo_check.yml
vendored
4
.github/workflows/cargo_check.yml
vendored
@ -10,9 +10,9 @@ jobs:
|
|||||||
test:
|
test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
timeout-minutes: 10
|
timeout-minutes: 10
|
||||||
container: jinuxdev/jinux:0.2.1
|
container: jinuxdev/jinux:0.2.2
|
||||||
steps:
|
steps:
|
||||||
- run: echo "Running in jinuxdev/jinux:0.2.1"
|
- run: echo "Running in jinuxdev/jinux:0.2.2"
|
||||||
|
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
4
.github/workflows/integration_test.yml
vendored
4
.github/workflows/integration_test.yml
vendored
@ -10,9 +10,9 @@ jobs:
|
|||||||
test:
|
test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
timeout-minutes: 30
|
timeout-minutes: 30
|
||||||
container: jinuxdev/jinux:0.2.1
|
container: jinuxdev/jinux:0.2.2
|
||||||
steps:
|
steps:
|
||||||
- run: echo "Running in jinuxdev/jinux:0.2.1"
|
- run: echo "Running in jinuxdev/jinux:0.2.2"
|
||||||
|
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
4
.github/workflows/unit_test.yml
vendored
4
.github/workflows/unit_test.yml
vendored
@ -10,9 +10,9 @@ jobs:
|
|||||||
test:
|
test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
timeout-minutes: 15
|
timeout-minutes: 15
|
||||||
container: jinuxdev/jinux:0.2.1
|
container: jinuxdev/jinux:0.2.2
|
||||||
steps:
|
steps:
|
||||||
- run: echo "Running in jinuxdev/jinux:0.2.1"
|
- run: echo "Running in jinuxdev/jinux:0.2.2"
|
||||||
|
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
2
Cargo.lock
generated
2
Cargo.lock
generated
@ -605,7 +605,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "jinux"
|
name = "jinux"
|
||||||
version = "0.2.1"
|
version = "0.2.2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"component",
|
"component",
|
||||||
"jinux-frame",
|
"jinux-frame",
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "jinux"
|
name = "jinux"
|
||||||
version = "0.2.1"
|
version = "0.2.2"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
[[bin]]
|
[[bin]]
|
||||||
|
2
Makefile
2
Makefile
@ -15,7 +15,7 @@ SKIP_GRUB_MENU ?= 1
|
|||||||
RELEASE_MODE ?= 0
|
RELEASE_MODE ?= 0
|
||||||
# End of setting up Make varaiables
|
# End of setting up Make varaiables
|
||||||
|
|
||||||
KERNEL_CMDLINE := SHELL="/bin/sh" LOGNAME="root" HOME="/" USER="root" PATH="/bin" init=/usr/bin/busybox
|
KERNEL_CMDLINE := SHELL="/bin/sh" LOGNAME="root" HOME="/" USER="root" PATH="/bin:/benchmark" init=/usr/bin/busybox
|
||||||
KERNEL_CMDLINE += ktest.whitelist="$(KTEST_WHITELIST)"
|
KERNEL_CMDLINE += ktest.whitelist="$(KTEST_WHITELIST)"
|
||||||
INIT_CMDLINE := sh -l
|
INIT_CMDLINE := sh -l
|
||||||
ifeq ($(AUTO_TEST), syscall)
|
ifeq ($(AUTO_TEST), syscall)
|
||||||
|
@ -34,12 +34,12 @@ git clone [repository url]
|
|||||||
|
|
||||||
2. After downloading the source code, run the following command to pull the development image.
|
2. After downloading the source code, run the following command to pull the development image.
|
||||||
```bash
|
```bash
|
||||||
docker pull jinuxdev/jinux:0.2.1
|
docker pull jinuxdev/jinux:0.2.2
|
||||||
```
|
```
|
||||||
|
|
||||||
3. Start the development container.
|
3. Start the development container.
|
||||||
```bash
|
```bash
|
||||||
docker run -it --privileged --network=host --device=/dev/kvm -v `pwd`:/root/jinux jinuxdev/jinux:0.2.1
|
docker run -it --privileged --network=host --device=/dev/kvm -v `pwd`:/root/jinux jinuxdev/jinux:0.2.2
|
||||||
```
|
```
|
||||||
|
|
||||||
**All build and test commands should be run inside the development container.**
|
**All build and test commands should be run inside the development container.**
|
||||||
|
@ -18,6 +18,7 @@ INITRAMFS_ALL_DIRS := \
|
|||||||
$(INITRAMFS)/bin \
|
$(INITRAMFS)/bin \
|
||||||
$(INITRAMFS)/usr/bin \
|
$(INITRAMFS)/usr/bin \
|
||||||
$(INITRAMFS)/regression \
|
$(INITRAMFS)/regression \
|
||||||
|
$(INITRAMFS)/benchmark \
|
||||||
$(INITRAMFS_EMPTY_DIRS)
|
$(INITRAMFS_EMPTY_DIRS)
|
||||||
|
|
||||||
.PHONY: all clean
|
.PHONY: all clean
|
||||||
@ -31,6 +32,12 @@ $(INITRAMFS)/lib/x86_64-linux-gnu:
|
|||||||
@cp -L /lib/x86_64-linux-gnu/libm.so.6 $@
|
@cp -L /lib/x86_64-linux-gnu/libm.so.6 $@
|
||||||
@cp -L /lib/x86_64-linux-gnu/libgcc_s.so.1 $@
|
@cp -L /lib/x86_64-linux-gnu/libgcc_s.so.1 $@
|
||||||
@cp -L /lib/x86_64-linux-gnu/libpthread.so.0 $@
|
@cp -L /lib/x86_64-linux-gnu/libpthread.so.0 $@
|
||||||
|
@# required for benchmarks
|
||||||
|
@cp -L /lib/x86_64-linux-gnu/libcrypto.so.3 $@
|
||||||
|
@cp -L /lib/x86_64-linux-gnu/libcrypt.so.1 $@
|
||||||
|
@cp -L /lib/x86_64-linux-gnu/libdl.so.2 $@
|
||||||
|
@cp -L /lib/x86_64-linux-gnu/libz.so.1 $@
|
||||||
|
@cp -L /usr/local/benchmark/iperf/lib/libiperf.so.0 $@
|
||||||
@# TODO: use a custom compiled vdso.so file in the future.
|
@# TODO: use a custom compiled vdso.so file in the future.
|
||||||
@git clone https://github.com/jinzhao-dev/linux_vdso.git
|
@git clone https://github.com/jinzhao-dev/linux_vdso.git
|
||||||
@cd ./linux_vdso && git checkout 2a6d2db 2>/dev/null
|
@cd ./linux_vdso && git checkout 2a6d2db 2>/dev/null
|
||||||
@ -60,6 +67,12 @@ $(INITRAMFS)/usr/bin: $(INITRAMFS)/bin
|
|||||||
$(INITRAMFS)/regression:
|
$(INITRAMFS)/regression:
|
||||||
@make --no-print-directory -C apps
|
@make --no-print-directory -C apps
|
||||||
|
|
||||||
|
$(INITRAMFS)/benchmark:
|
||||||
|
@mkdir -p $@
|
||||||
|
@cp /usr/local/benchmark/sysbench/bin/sysbench $@
|
||||||
|
@cp /usr/local/benchmark/iperf/bin/iperf3 $@
|
||||||
|
@cp /usr/local/benchmark/membench/membench $@
|
||||||
|
|
||||||
# Make necessary directories.
|
# Make necessary directories.
|
||||||
$(INITRAMFS_EMPTY_DIRS):
|
$(INITRAMFS_EMPTY_DIRS):
|
||||||
@mkdir -p $@
|
@mkdir -p $@
|
||||||
|
57
regression/benchmark/README.md
Normal file
57
regression/benchmark/README.md
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
# Introduction to benchmarks
|
||||||
|
|
||||||
|
## Sysbench
|
||||||
|
Sysbench is a scriptable benchmark tool that evaluates system performance. It includes five kinds of tests: CPU, memory, file I/O, mutex performance, and thread performance. Detailed usage and options can be found by using:
|
||||||
|
```shell
|
||||||
|
sysbench --help
|
||||||
|
sysbench --test=<test_name> help
|
||||||
|
```
|
||||||
|
Here we list some general commands for evaluation:
|
||||||
|
```shell
|
||||||
|
# CPU test
|
||||||
|
sysbench --test=cpu --cpu-max-prime=<N> --num-threads=<N> run
|
||||||
|
|
||||||
|
# Thread test
|
||||||
|
sysbench --test=threads --thread-yields=<N> --num-threads=<N> --max-time=<N> run
|
||||||
|
|
||||||
|
# Mutex test
|
||||||
|
sysbench --test=mutex --mutex-num=<N> --mutex-locks=<N> --num-threads=<N>
|
||||||
|
|
||||||
|
# File test, the file-total-size and file-num of prepare and run must be consistent
|
||||||
|
sysbench --test=fileio --file-total-size=<N><K,M,G> --file-num=<N> prepare
|
||||||
|
sysbench --test=fileio --file-total-size=<N><K,M,G> --file-num=<N> --file-test-mode=<Type> --file-block-size=<N><K,M,G> --max-time=<N> run
|
||||||
|
|
||||||
|
# Memory test
|
||||||
|
sysbench --test=memory --memory-block-size=<N><K,M,G> --memory-access-mode=<Type> --memory-oper=<Type> run
|
||||||
|
```
|
||||||
|
|
||||||
|
## Membench
|
||||||
|
Membench is used to establish a baseline for memory bandwidth and latency. For specific usage and options, use:
|
||||||
|
```shell
|
||||||
|
membench --help
|
||||||
|
```
|
||||||
|
Here we list some general commands to use membench:
|
||||||
|
```shell
|
||||||
|
# Measure the latency of mmap
|
||||||
|
membench -runtime=5 -dir=/dev/zero -size=<N><K,M,G> -engine=mmap_lat
|
||||||
|
|
||||||
|
# Measure the latency of page fault handling. The size must be consistent with the file size.
|
||||||
|
membench -runtime=5 -dir=path_to_a_file -size=<N><K,M,G> -copysize=<N><K,M,G> -mode=<Type> -engine=page_fault
|
||||||
|
|
||||||
|
# This is a easy way to generate a file with target size in Linux.
|
||||||
|
# The following command can create a file named 512K.file with the size 512K.
|
||||||
|
dd if=/dev/zero of=512K.file bs=1K count=512
|
||||||
|
```
|
||||||
|
|
||||||
|
## Iperf
|
||||||
|
iPerf is a tool for actively measuring the maximum achievable bandwidth on IP networks. Usage and options are detailed in:
|
||||||
|
```shell
|
||||||
|
iperf3 -h
|
||||||
|
```
|
||||||
|
iperf can run in the following instructions:
|
||||||
|
```shell
|
||||||
|
export HOST_ADDR=127.0.0.1
|
||||||
|
export HOST_PORT=8888
|
||||||
|
iperf3 -s -B $HOST_ADDR -p $HOST_PORT -D # Start the server as a daemon
|
||||||
|
iperf3 -c $HOST_ADDR -p $HOST_PORT # Start the client
|
||||||
|
```
|
@ -14,6 +14,44 @@ RUN apt update && apt-get install -y --no-install-recommends \
|
|||||||
wget \
|
wget \
|
||||||
gnupg
|
gnupg
|
||||||
|
|
||||||
|
#= Build benchmark =========================================================
|
||||||
|
FROM build-base as build-benchmarks
|
||||||
|
|
||||||
|
# Download the source files of benchmarks
|
||||||
|
WORKDIR /root
|
||||||
|
RUN apt install -y automake \
|
||||||
|
libtool \
|
||||||
|
pkg-config
|
||||||
|
RUN wget https://github.com/akopytov/sysbench/archive/1.0.20.tar.gz \
|
||||||
|
&& tar -zxvf 1.0.20.tar.gz \
|
||||||
|
&& rm 1.0.20.tar.gz
|
||||||
|
RUN git clone https://github.com/nicktehrany/membench.git
|
||||||
|
RUN git clone https://github.com/esnet/iperf.git
|
||||||
|
|
||||||
|
# Build sysbench
|
||||||
|
WORKDIR /root/sysbench-1.0.20
|
||||||
|
RUN ./autogen.sh \
|
||||||
|
&& ./configure --without-mysql --prefix=/usr/local/benchmark/sysbench \
|
||||||
|
&& make -j \
|
||||||
|
&& make install
|
||||||
|
|
||||||
|
# Build membench
|
||||||
|
WORKDIR /root/membench
|
||||||
|
RUN make -j \
|
||||||
|
&& mkdir /usr/local/benchmark/membench \
|
||||||
|
&& cp membench /usr/local/benchmark/membench/
|
||||||
|
|
||||||
|
# Build iperf
|
||||||
|
WORKDIR /root/iperf
|
||||||
|
RUN ./configure --prefix=/usr/local/benchmark/iperf \
|
||||||
|
&& make -j \
|
||||||
|
&& make install
|
||||||
|
|
||||||
|
WORKDIR /root
|
||||||
|
RUN rm -rf sysbench-1.0.20 \
|
||||||
|
membench \
|
||||||
|
iperf
|
||||||
|
|
||||||
#= Build syscall test =========================================================
|
#= Build syscall test =========================================================
|
||||||
|
|
||||||
FROM build-base as build-bazel
|
FROM build-base as build-bazel
|
||||||
@ -208,6 +246,9 @@ RUN ln -sf /usr/share/grub/unicode.pf2 /usr/local/grub/share/grub/unicode.pf2
|
|||||||
# Install Busybox built from the previous stages
|
# Install Busybox built from the previous stages
|
||||||
COPY --from=busybox /root/busybox/busybox /bin/busybox
|
COPY --from=busybox /root/busybox/busybox /bin/busybox
|
||||||
|
|
||||||
|
# Install benchmarks built from the previous stages
|
||||||
|
COPY --from=build-benchmarks /usr/local/benchmark /usr/local/benchmark
|
||||||
|
|
||||||
# Add the path of jinux tools
|
# Add the path of jinux tools
|
||||||
ENV PATH="/root/jinux/target/bin:${PATH}"
|
ENV PATH="/root/jinux/target/bin:${PATH}"
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user