diff --git a/.github/workflows/benchmark_asterinas.yml b/.github/workflows/benchmark_asterinas.yml index 02dba5d40..373a90b6c 100644 --- a/.github/workflows/benchmark_asterinas.yml +++ b/.github/workflows/benchmark_asterinas.yml @@ -101,7 +101,8 @@ jobs: command: | make install_osdk BENCHMARK_TYPE=$(jq -r '.benchmark_type' test/benchmark/${{ matrix.benchmark }}/config.json) - bash test/benchmark/bench_linux_and_aster.sh ${{ matrix.benchmark }} $BENCHMARK_TYPE + ASTER_SCHEME=$(jq -r '.aster_scheme' test/benchmark/${{ matrix.benchmark }}/config.json) + bash test/benchmark/bench_linux_and_aster.sh ${{ matrix.benchmark }} $BENCHMARK_TYPE $ASTER_SCHEME - name: Set up benchmark configuration run: | diff --git a/test/benchmark/README.md b/test/benchmark/README.md index f92fc7b0c..c03202615 100644 --- a/test/benchmark/README.md +++ b/test/benchmark/README.md @@ -84,7 +84,8 @@ To add a new benchmark to the Asternias Continuous Integration (CI) system, foll "result_index": "3", "description": "lat_syscall null", "title": "[Process] The cost of getpid", - "benchmark_type": "host_guest" + "benchmark_type": "host_guest", + "aster_scheme": "iommu" } ``` @@ -97,6 +98,7 @@ To add a new benchmark to the Asternias Continuous Integration (CI) system, foll - `benchmark_type`: This parameter defines the type of benchmark to be executed. The default value is `guest_only`. The available options include `guest_only`, and `host_guest`. - `guest_only`: Use this option when the benchmark is intended solely for the guest environment. - `host_guest`: Choose this option when the benchmark involves both the host and guest environments. When using this option, you will need to define your own `host.sh` and `bench_runner.sh` scripts to handle the host-side operations and benchmark execution. + - `aster_scheme`: Specify the scheme used in Asterinas. The optional values, e.g., `iommu`, are aligned with the `SCHEME` parameter in `asterinas/Makefile`. For example, if the benchmark output is "Syscall average latency: 1000 ns", the `search_pattern` is "Syscall average latency:", and the `result_index` is "4". `awk` will extract "1000" as the benchmark result. See the `awk` [manual](https://www.gnu.org/software/gawk/manual/gawk.html#Getting-Started) for more information. diff --git a/test/benchmark/bench_linux_and_aster.sh b/test/benchmark/bench_linux_and_aster.sh index cf3bb4f12..e16b9982b 100755 --- a/test/benchmark/bench_linux_and_aster.sh +++ b/test/benchmark/bench_linux_and_aster.sh @@ -45,8 +45,9 @@ parse_results() { run_benchmark() { local benchmark="$1" local benchmark_type="$2" - local search_pattern="$3" - local result_index="$4" + local aster_scheme="$3" + local search_pattern="$4" + local result_index="$5" local linux_output="${BENCHMARK_DIR}/linux_output.txt" local aster_output="${BENCHMARK_DIR}/aster_output.txt" @@ -58,7 +59,11 @@ run_benchmark() { echo "Preparing libraries..." prepare_libs - local asterinas_cmd="make run BENCHMARK=${benchmark} ENABLE_KVM=1 RELEASE_LTO=1 2>&1" + local aster_scheme_cmd="" + if [ -n "$aster_scheme" ] && [ "$aster_scheme" != "null" ]; then + aster_scheme_cmd="SCHEME=${aster_scheme}" + fi + local asterinas_cmd="make run BENCHMARK=${benchmark} ${aster_scheme_cmd} ENABLE_KVM=1 RELEASE_LTO=1 2>&1" local linux_cmd="/usr/local/qemu/bin/qemu-system-x86_64 \ --no-reboot \ -smp 1 \ @@ -114,6 +119,7 @@ if [ -z "$2" ] || [ "$2" = "null" ]; then else BENCHMARK_TYPE="$2" fi +ASTER_SCHEME="$3" echo "Running benchmark ${BENCHMARK}..." pwd @@ -125,6 +131,6 @@ fi search_pattern=$(jq -r '.search_pattern' "$BENCHMARK_DIR/$BENCHMARK/config.json") result_index=$(jq -r '.result_index' "$BENCHMARK_DIR/$BENCHMARK/config.json") -run_benchmark "$BENCHMARK" "$BENCHMARK_TYPE" "$search_pattern" "$result_index" +run_benchmark "$BENCHMARK" "$BENCHMARK_TYPE" "$ASTER_SCHEME" "$search_pattern" "$result_index" echo "Benchmark completed successfully."