]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Performance tests: refactor collect_measurements to create csv file
authorMatthias Maier <tamiko@43-1.org>
Fri, 11 Feb 2022 09:09:50 +0000 (03:09 -0600)
committerMatthias Maier <tamiko@43-1.org>
Fri, 11 Feb 2022 10:11:00 +0000 (04:11 -0600)
 - output performance test results as csv file
 - add metadata to csv file

tests/performance/collect_measurements
tests/run_testsuite.cmake

index aecaec5d41f0acfd84fb2f255c63dc4bfc5a5d4e..ca80ce5bf159b63f82aada962e6f0ff58612c11a 100755 (executable)
 # 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
index 098da5e03768760bf0cc0531d2a6e87757f0ec37..df5340cff0e798fc78cc856e2a88432cb8f2a5b1 100644 (file)
@@ -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()
 

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.