diff --git a/CMakeLists.txt b/CMakeLists.txt index a96ccaf81..0c1187509 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -149,9 +149,9 @@ add_subdirectory (scripts) if (EXISTS ${CMAKE_SOURCE_DIR}/test) add_subdirectory (test EXCLUDE_FROM_ALL) endif (EXISTS ${CMAKE_SOURCE_DIR}/test) -if (EXISTS performance) +if (EXISTS ${CMAKE_SOURCE_DIR}/performance) add_subdirectory (performance EXCLUDE_FROM_ALL) -endif (EXISTS performance) +endif (EXISTS ${CMAKE_SOURCE_DIR}/performance) set (doc_FILES ChangeLog README.md INSTALL AUTHORS COPYING LICENSE) foreach (doc_FILE ${doc_FILES}) diff --git a/performance/.gitignore b/performance/.gitignore deleted file mode 100644 index e82c8156a..000000000 --- a/performance/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -*.data -*.rc -export.json diff --git a/performance/CMakeLists.txt b/performance/CMakeLists.txt index adc77d414..293c5b942 100644 --- a/performance/CMakeLists.txt +++ b/performance/CMakeLists.txt @@ -1,6 +1,11 @@ cmake_minimum_required (VERSION 3.22) -add_custom_target (performance ./run_perf +configure_file(compare_runs.py compare_runs.py COPYONLY) +configure_file(load load) +configure_file(run_perf run_perf) + +add_custom_target (performance ${CMAKE_BINARY_DIR}/performance/run_perf DEPENDS task_executable - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/performance) + WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/performance) + diff --git a/performance/load b/performance/load index 7f6dded6d..56df91f35 100755 --- a/performance/load +++ b/performance/load @@ -14,7 +14,7 @@ if (open my $fh, '>', 'perf.rc') close $fh; } -my $filename = 'sample-text.txt'; +my $filename = '${CMAKE_SOURCE_DIR}/performance/sample-text.txt'; open(my $fh, '<:encoding(UTF-8)', $filename) or die "Could not open file '$filename' $!"; @@ -31,18 +31,18 @@ while (my $line = <$fh>) if ($. % 20 == 19) { my $anno_id = $id - 1; - qx{../build/src/task rc:perf.rc rc.gc=off $anno_id annotate $line}; + qx{${CMAKE_BINARY_DIR}/src/task rc:perf.rc rc.gc=off $anno_id annotate $line}; print "[$.] task rc:perf.rc rc.gc=off $anno_id annotate $line\n" if $?; } elsif ($. % 4 == 1) { - qx{../build/src/task rc:perf.rc rc.gc=off add $line}; + qx{${CMAKE_BINARY_DIR}/src/task rc:perf.rc rc.gc=off add $line}; print "[$.] task rc:perf.rc rc.gc=off add $line\n" if $?; ++$id; } else { - qx{../build/src/task rc:perf.rc rc.gc=off log $line}; + qx{${CMAKE_BINARY_DIR}/src/task rc:perf.rc rc.gc=off log $line}; print "[$.] task rc:perf.rc rc.gc=off log $line\n" if $?; } } diff --git a/performance/run_perf b/performance/run_perf index 869640b63..8d925efb9 100755 --- a/performance/run_perf +++ b/performance/run_perf @@ -1,22 +1,22 @@ #! /bin/bash echo 'Performance: setup' -rm -f ./pending.data ./completed.data ./undo.data ./backlog.data perf.rc -if [[ -e data/pending.data && -e data/completed.data ]] +rm -f ./taskchampion.sqlite3 +if [[ -e ./data/taskchampion.sqlite3 ]] then - echo ' - Using existing data' + echo ' - Using existing data.' cp data/* . else - echo ' - This step will take several minutes' + echo ' - Loading data. This step will take several minutes.' ./load mkdir -p data - cp *.data perf.rc data + cp taskchampion.sqlite3 perf.rc data fi # Allow override. if [[ -z $TASK ]] then - TASK=../build/src/task + TASK=${CMAKE_BINARY_DIR}/src/task fi # Run benchmarks. @@ -45,8 +45,8 @@ $TASK rc.debug:1 rc:perf.rc export >/dev/null 2>&1 $TASK rc.debug:1 rc:perf.rc export 2>&1 >export.json | grep "Perf task" echo ' - task import...' -rm -f ./pending.data ./completed.data ./undo.data ./backlog.data -$TASK rc.debug:1 rc:perf.rc import export.json 2>&1 | grep "Perf task" +rm -f ./taskchampion.sqlite3 +$TASK rc.debug:1 rc:perf.rc import ${CMAKE_SOURCE_DIR}/performance/export.json 2>&1 | grep "Perf task" echo 'End' exit 0