From 3db9dcf698bbc3cc531f3885acd2fed98fea2cb3 Mon Sep 17 00:00:00 2001 From: Wal-eed <77413499+Wal-eed@users.noreply.github.com> Date: Thu, 6 Apr 2023 13:38:49 +1000 Subject: [PATCH] Add documentation for adding a new benchmark (#36) * Update documentation about new benchmarks Signed-off-by: Waleed --- README.md | 21 +++++++++++++++++++++ apps/sel4bench/CMakeLists.txt | 3 +++ apps/sel4bench/src/benchmark.h | 1 + easy-settings.cmake | 1 + settings.cmake | 2 ++ 5 files changed, 28 insertions(+) diff --git a/README.md b/README.md index d185dcb4..4599874c 100644 --- a/README.md +++ b/README.md @@ -73,3 +73,24 @@ hardware tests. Since this benchmark will cause the kernel image to be an EL2 image, it will have an impact on the observed numbers for the other benchmark applications as well, since they'll be using an unexpected kernel build. + + +# Adding a new benchmark + +Contributing a new benchmark to seL4bench requires a few steps: + +* Under `apps`, create a directory for your new benchmark and: + * Provide a `CMakelists.txt` file that defines a new executable. + * Provide a `src` folder that contains the source code for your + benchmark. +* Under `apps/sel4bench`: + * Update `CMakeLists.txt` to add your new benchmark to the list of + benchmarks. + * Under `src`: + * Update `benchmark.h` to include your generated config for your benchmark, and provide a function declaration that will act as the entry point for your benchmark. + * Provide a `.c` file that implements the above function declaration. This function should return a `benchmark_t` struct. Construct this struct accordingly. The struct expects a function to process the results of the benchmark, which you should provide in this file as well + * Inside `main.c`, add your entry point function that was declared/defined above to the array of `benchmark_t` present. +* Update `easy-settings.cmake` to add your new benchmark. You can define here whether the benchmark should be enabled by default or not. +* Under `libsel4benchsupport/include`: + * Provide a `` file that provides any extra definitions that your benchmark may need. You will also generally provide a `benchmark_name_results_t` struct here, which will be used to store the results of your benchmark when processing. +* Update `settings.cmake` to include your new benchmark. \ No newline at end of file diff --git a/apps/sel4bench/CMakeLists.txt b/apps/sel4bench/CMakeLists.txt index 97ef2df9..07b291e6 100644 --- a/apps/sel4bench/CMakeLists.txt +++ b/apps/sel4bench/CMakeLists.txt @@ -72,6 +72,8 @@ add_subdirectory(../signal signal) add_subdirectory(../smp smp) add_subdirectory(../sync sync) add_subdirectory(../vcpu vcpu) +# Add new benchmark applications here + add_subdirectory(../../libsel4benchsupport libsel4benchsupport) config_option(Sel4Bench SEL4_BENCH "Enable seL4 benchmarking" DEFAULT ON) @@ -106,6 +108,7 @@ if(Sel4Bench) smp_Config sel4benchsync_Config sel4benchvcpu_Config + # Add new benchmark configs here ) include(rootserver) DeclareRootserver(sel4benchapp) diff --git a/apps/sel4bench/src/benchmark.h b/apps/sel4bench/src/benchmark.h index cd103cef..8b51be96 100644 --- a/apps/sel4bench/src/benchmark.h +++ b/apps/sel4bench/src/benchmark.h @@ -106,6 +106,7 @@ benchmark_t *sync_benchmark_new(void); benchmark_t *page_mapping_benchmark_new(void); benchmark_t *smp_benchmark_new(void); benchmark_t *vcpu_benchmark_new(void); +/* Add new benchmarks here */ static inline void blank_init(UNUSED vka_t *vka, UNUSED simple_t *simple, UNUSED sel4utils_process_t *process) { diff --git a/easy-settings.cmake b/easy-settings.cmake index d3f90d58..5403f282 100644 --- a/easy-settings.cmake +++ b/easy-settings.cmake @@ -26,6 +26,7 @@ set(ARM_HYP OFF CACHE BOOL "ARM EL2 hypervisor features on or off") set(MCS OFF CACHE BOOL "MCS kernel") # Set the list of benchmark applications to be included into the image +# Add any new benchmark applications to this list # default is OFF set(HARDWARE OFF CACHE BOOL "Application to benchmark hardware-related operations") diff --git a/settings.cmake b/settings.cmake index e99ceb97..9838c020 100644 --- a/settings.cmake +++ b/settings.cmake @@ -162,4 +162,6 @@ if(NOT Sel4benchAllowSettingsOverride) else() set(AppSyncBench OFF CACHE BOOL "" FORCE) endif() + + # Add new app-specific configuration here endif()