From: Matthias Maier Date: Fri, 11 Feb 2022 09:09:50 +0000 (-0600) Subject: Performance tests: refactor collect_measurements to create csv file X-Git-Tag: v9.4.0-rc1~508^2~5 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e5a44856feb174d9481f5e2b300c1a05dcc9217a;p=dealii.git Performance tests: refactor collect_measurements to create csv file - output performance test results as csv file - add metadata to csv file --- diff --git a/tests/performance/collect_measurements b/tests/performance/collect_measurements index aecaec5d41..ca80ce5bf1 100755 --- a/tests/performance/collect_measurements +++ b/tests/performance/collect_measurements @@ -22,7 +22,22 @@ # pretty prints a parsable table to stdout. # -for i in tests/performance/*/output tests/performance/*/mpirun*/output +# +# First, collect some metatadata: +# + +site="${1}" +shift + +branch="$(sed -n -e 's/.*Branch: \+\(.*\)/\1/p' revision.log)" +revision="$(sed -n -e 's/.*Revision: \+\(.*\)/\1/p' revision.log)" + +# +# Now collect all output files and postprocess them into a tab-separated +# list of values: +# + +output="$(for i in tests/performance/*/output tests/performance/*/mpirun*/output do # Skip output files that have fewer than 3 lines if [[ "$(wc -l $i 2> /dev/null | awk '{ print $1 }')" -le 2 ]]; then @@ -45,7 +60,30 @@ do echo -e "$test_name\t$test_type\t${line}" done } < "${i}" -done | sort | - column -s $'\t' -t \ - -N "test_name,test_type,sensor,min/value,max,mean,std_dev,samples" +done | sort | tr $'\t' ',')" + +# +# Output a test results as a comma separated list of values (CSV) to +# performance.csv for easier parsing: +# + +( + echo "# Date: $(date -u --rfc-3339=s)" + echo "# Site: ${site}" + echo "# Branch: $branch" + echo "# Revision: $revision" +) > performance.csv + +( + echo "test_name,test_type,sensor,min/value,max,mean,std_dev,samples" + echo "${output}" +) >> performance.csv + +# +# Also save and print a nicely formatted table of the test results in +# performance.log and to stdout: +# +echo "${output}" | column -s ',' -t \ + -N "test_name,test_type,sensor,min/value,max,mean,std_dev,samples" | + tee performance.log diff --git a/tests/run_testsuite.cmake b/tests/run_testsuite.cmake index 098da5e037..df5340cff0 100644 --- a/tests/run_testsuite.cmake +++ b/tests/run_testsuite.cmake @@ -581,11 +581,10 @@ ENDIF() # Create performance test report # IF(ENABLE_PERFORMANCE_TESTS) - MESSAGE("-- Collecting performance measurements") + MESSAGE("-- Collecting performance measurements\n") EXECUTE_PROCESS( - COMMAND bash "${CMAKE_CURRENT_LIST_DIR}/performance/collect_measurements" + COMMAND bash "${CMAKE_CURRENT_LIST_DIR}/performance/collect_measurements" "${CTEST_SITE}" WORKING_DIRECTORY ${CTEST_BINARY_DIRECTORY} - OUTPUT_FILE ${CTEST_BINARY_DIRECTORY}/performance.log ) ENDIF()