Support specifying SCHEME in the benchmark

This commit is contained in:
Shaowei Song
2024-11-06 11:11:44 +00:00
committed by Tate, Hongliang Tian
parent 012dacab93
commit 31ebcbf264
3 changed files with 15 additions and 6 deletions

View File

@ -101,7 +101,8 @@ jobs:
command: | command: |
make install_osdk make install_osdk
BENCHMARK_TYPE=$(jq -r '.benchmark_type' test/benchmark/${{ matrix.benchmark }}/config.json) 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 - name: Set up benchmark configuration
run: | run: |

View File

@ -84,7 +84,8 @@ To add a new benchmark to the Asternias Continuous Integration (CI) system, foll
"result_index": "3", "result_index": "3",
"description": "lat_syscall null", "description": "lat_syscall null",
"title": "[Process] The cost of getpid", "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`. - `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. - `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. - `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. 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.

View File

@ -45,8 +45,9 @@ parse_results() {
run_benchmark() { run_benchmark() {
local benchmark="$1" local benchmark="$1"
local benchmark_type="$2" local benchmark_type="$2"
local search_pattern="$3" local aster_scheme="$3"
local result_index="$4" local search_pattern="$4"
local result_index="$5"
local linux_output="${BENCHMARK_DIR}/linux_output.txt" local linux_output="${BENCHMARK_DIR}/linux_output.txt"
local aster_output="${BENCHMARK_DIR}/aster_output.txt" local aster_output="${BENCHMARK_DIR}/aster_output.txt"
@ -58,7 +59,11 @@ run_benchmark() {
echo "Preparing libraries..." echo "Preparing libraries..."
prepare_libs 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 \ local linux_cmd="/usr/local/qemu/bin/qemu-system-x86_64 \
--no-reboot \ --no-reboot \
-smp 1 \ -smp 1 \
@ -114,6 +119,7 @@ if [ -z "$2" ] || [ "$2" = "null" ]; then
else else
BENCHMARK_TYPE="$2" BENCHMARK_TYPE="$2"
fi fi
ASTER_SCHEME="$3"
echo "Running benchmark ${BENCHMARK}..." echo "Running benchmark ${BENCHMARK}..."
pwd pwd
@ -125,6 +131,6 @@ fi
search_pattern=$(jq -r '.search_pattern' "$BENCHMARK_DIR/$BENCHMARK/config.json") search_pattern=$(jq -r '.search_pattern' "$BENCHMARK_DIR/$BENCHMARK/config.json")
result_index=$(jq -r '.result_index' "$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." echo "Benchmark completed successfully."