Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions .github/workflows/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
benchmark: [bm_empty, bm_server_redis, min_mysql_close_dup_0_0]
benchmark: [bm_empty, bm_server_redis, mysql/min_mysql_close_dup_0_0]
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -163,11 +163,15 @@ jobs:
- name: Fix artifact permissions
if: always()
run: sudo chmod -R a+r results/

- name: Create unique name
run: echo "ARTIFACT_NAME=$(echo '${{ matrix.benchmark }}' | tr '/' '_')" >> $GITHUB_ENV

- name: Upload results
uses: actions/upload-artifact@v4
if: always()
with:
name: results-${{ matrix.benchmark }}
name: results-${{ env.ARTIFACT_NAME }}
path: results/

Run-External-Benchmark:
Expand Down
23 changes: 13 additions & 10 deletions .github/workflows/openeuler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ jobs:
matrix:
test:
- bm_empty
- min_mysql_close_dup_0_0
- min_mysql_getdents64_close_0_0
- min_mysql_lseek_read_1_0
- min_mysql_newfstatat_0_1
- min_mysql_newfstatat_openat_0_1
- min_mysql_openat_fsync_0_2
- min_mysql_pread64_faccessat2_0_5
- min_mysql_read_close_0_0
- min_mysql_read_write_0_1
- mysql/min_mysql_close_dup_0_0
- mysql/min_mysql_getdents64_close_0_0
- mysql/min_mysql_lseek_read_1_0
- mysql/min_mysql_newfstatat_0_1
- mysql/min_mysql_newfstatat_openat_0_1
- mysql/min_mysql_openat_fsync_0_2
- mysql/min_mysql_pread64_faccessat2_0_5
- mysql/min_mysql_read_close_0_0
- mysql/min_mysql_read_write_0_1

env:
TEST_TAG: ghcr.io/${{ github.repository }}/openeuler_for_csb:latest
Expand Down Expand Up @@ -54,9 +54,12 @@ jobs:
run: |
sudo chmod -R a+r /tmp/csb/results/

- name: Create unique name
run: echo "ARTIFACT_NAME=$(echo '${{ matrix.test }}' | tr '/' '_')" >> $GITHUB_ENV

- name: Upload results
uses: actions/upload-artifact@v4
if: always()
with:
name: openeuler-results-${{ matrix.test }}
name: openeuler-results-${{ env.ARTIFACT_NAME }}
path: /tmp/csb/results/
19 changes: 16 additions & 3 deletions bench/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ elseif(CSB_THREAD_SANITIZER)
target_link_options(CSB INTERFACE -fsanitize=thread)
endif()

file(GLOB TARGETS CONFIGURE_DEPENDS targets/*.h)
# search subdirectories as well
file(GLOB_RECURSE TARGETS CONFIGURE_DEPENDS targets/*.h)
# exclude files under syz
list(FILTER TARGETS EXCLUDE REGEX ".*/syz/.*")

set(BM_DEFS _GNU_SOURCE)

Expand Down Expand Up @@ -51,8 +54,18 @@ set(BM_FILE benchmark.c)

foreach(target IN ITEMS ${TARGETS})
get_filename_component(bm_target_prefix ${target} NAME_WLE)
get_filename_component(PARENT "${target}" DIRECTORY)

if("${PARENT}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}/targets")
set(TARGET_PREFIX "")
else()
# get direct parent directory name
get_filename_component(PARENT "${PARENT}" NAME)
string(TOLOWER "${PARENT}_" TARGET_PREFIX)
endif()

set(bm_target_name "\"${target}\"")
set(TEST_CASE ${bm_target_prefix})
set(TEST_CASE "${TARGET_PREFIX}${bm_target_prefix}")

string(TOLOWER ${TEST_CASE} TEST_CASE)

Expand All @@ -67,7 +80,7 @@ foreach(target IN ITEMS ${TARGETS})
-Wno-unused-function)
# use -fno-var-tracking to speed up compilation of big auto-generated test
# cases
if(bm_target_prefix MATCHES "^min_.*")
if(bm_target_prefix MATCHES ".*min_.*")
target_compile_options(${TEST_CASE} PRIVATE "-fno-var-tracking")
endif()

Expand Down
2 changes: 1 addition & 1 deletion bm-generator/04_prepare.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ if [ ! -d "${DIR_PROG}" ]; then
exit 1
fi

DIR_TARGETS="../bench/targets/syz"
DIR_TARGETS="../bench/targets/gen-ws/syz"

if [ -d "${DIR_TARGETS}" ]; then
echo "`readlink -e ${DIR_TARGETS}` exist!"
Expand Down
3 changes: 2 additions & 1 deletion bm-generator/helper/prog2bm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ fi

PROG="`basename ${FILEPROG} .prog`"

DIR_TARGETS="../bench/targets/syz"
# TODO: sync. with the definition in cmake `set(SUBDIR "gen-ws")`
DIR_TARGETS="../bench/targets/gen-ws/syz"

DIR_TARGETS_ABS="`readlink -e ${DIR_TARGETS}`"
FILEPROG_ABS="`readlink -e ${FILEPROG}`"
Expand Down
14 changes: 9 additions & 5 deletions bm-generator/templates/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,17 @@ add_custom_command(

# Find all single template files
file(GLOB TEMPLATES *single*.in)
# Output subfolder for auto-generated workspace
set(SUBDIR "gen-ws")
# Collect all input headers
file(GLOB HEADERS CONFIGURE_DEPENDS "${CMAKE_SOURCE_DIR}/bench/targets/syz/*.h")
file(GLOB HEADERS CONFIGURE_DEPENDS
"${CMAKE_SOURCE_DIR}/bench/targets/${SUBDIR}/syz/*.h")
# Output dir for config files
set(CONFIG_DIR "${CMAKE_SOURCE_DIR}/config")
file(MAKE_DIRECTORY "${CONFIG_DIR}/${SUBDIR}")
# Output dir for header files
set(HEADER_DIR "${CMAKE_SOURCE_DIR}/bench/targets")

file(MAKE_DIRECTORY "${HEADER_DIR}/${SUBDIR}")
# For each header input we want to generate a JSON config files and a matching
# header
foreach(HEADER ${HEADERS})
Expand All @@ -43,11 +47,11 @@ foreach(HEADER ${HEADERS})
set(TARGET ${HEADER_NAME}_json)
set(TMPLR_PARAMS -DPROBAVG="" -DPROBEND="1024"
-DBINNAME="${HEADER_NAME}")
set(OUTPUT_FILE "${CONFIG_DIR}/${HEADER_NAME}.json")
set(OUTPUT_FILE "${CONFIG_DIR}/${SUBDIR}/${HEADER_NAME}.json")
elseif(EXTENSION STREQUAL ".h")
set(TARGET ${HEADER_NAME}_h)
set(TMPLR_PARAMS -DNCALLS="1" -DNNOPS="1" -DNN="${HEADER_NAME}")
set(OUTPUT_FILE "${HEADER_DIR}/${HEADER_NAME}.h")
set(OUTPUT_FILE "${HEADER_DIR}/${SUBDIR}/${HEADER_NAME}.h")
else()
message(FATAL_ERROR "Unsupported extension ${EXTENSION}")
endif()
Expand All @@ -66,7 +70,7 @@ endforeach(HEADER)
# ##############################################################################
set(AGGREGATE_TARGET csb-gen-agg)
set(INPUT_TEMPLATE ${CMAKE_CURRENT_SOURCE_DIR}/syz_bm.json.in)
set(OUTPUT_FILE ${CONFIG_DIR}/aggregated.json)
set(OUTPUT_FILE ${CONFIG_DIR}/${SUBDIR}/aggregated.json)

# Find number of available files
list(LENGTH HEADERS FILES_NUM)
Expand Down
2 changes: 1 addition & 1 deletion bm-generator/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ echo "STEP#5: Generating ..."
echo "STEP#6: Build and test ..."
cd ../build
# We only want to build related targets not everything.
find ../bench/targets/ -name "min_ls_*.h" | grep -v syz | sed 's/.*\/\(min_ls_.*\)\.h/\1/' | xargs make
find ../bench/targets/gen-ws -name "min_ls_*.h" | grep -v syz | sed 's/.*\/\(min_ls_.*\)\.h/gen-ws_\1/' | xargs make
# We run only related tests
ctest -R min_ls_* --output-on-failure
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
},
"applications": [
{
"name": "min_mysql_close_dup_0_0",
"name": "mysql_min_mysql_close_dup_0_0",
"operations": [
1024
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
},
"applications": [
{
"name": "min_mysql_getdents64_close_0_0",
"name": "mysql_min_mysql_getdents64_close_0_0",
"operations": [
1024
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
},
"applications": [
{
"name": "min_mysql_lseek_read_1_0",
"name": "mysql_min_mysql_lseek_read_1_0",
"operations": [
1024
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
},
"applications": [
{
"name": "min_mysql_newfstatat_0_1",
"name": "mysql_min_mysql_newfstatat_0_1",
"operations": [
1024
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
},
"applications": [
{
"name": "min_mysql_newfstatat_openat_0_1",
"name": "mysql_min_mysql_newfstatat_openat_0_1",
"operations": [
1024
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
},
"applications": [
{
"name": "min_mysql_openat_fsync_0_2",
"name": "mysql_min_mysql_openat_fsync_0_2",
"operations": [
1024
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
},
"applications": [
{
"name": "min_mysql_pread64_faccessat2_0_5",
"name": "mysql_min_mysql_pread64_faccessat2_0_5",
"operations": [
1024
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
},
"applications": [
{
"name": "min_mysql_read_close_0_0",
"name": "mysql_min_mysql_read_close_0_0",
"operations": [
1024
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
},
"applications": [
{
"name": "min_mysql_read_write_0_1",
"name": "mysql_min_mysql_read_write_0_1",
"operations": [
1024
]
Expand Down
2 changes: 1 addition & 1 deletion helpers/clang-format.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ if [ "${STYLE}" != "" ]; then
STYLE=":${STYLE}"
fi

git ls-files '*.h' '*.c' | grep -v 'deps' | grep -v 'bench/targets/syz/' | xargs -I {} clang-format -style=file${STYLE} -i "$(pwd)/{}"
git ls-files '*.h' '*.c' | grep -v 'deps' | grep -v '/syz/' | xargs -I {} clang-format -style=file${STYLE} -i "$(pwd)/{}"


if [ "${SILENT}" != "true" ]; then
Expand Down
3 changes: 2 additions & 1 deletion run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ else
fi

# detect all available benchmark configurations
BENCHMARKS_CONFIGS=( config/*.json )
shopt -s globstar
BENCHMARKS_CONFIGS=( config/**/*.json )

echo "The following benchmarks are available, select one to run"

Expand Down
Loading