diff --git a/.gitea/workflows/Merge-Checker.yaml b/.gitea/workflows/Merge-Checker.yaml index 969eb70..b50c2a0 100644 --- a/.gitea/workflows/Merge-Checker.yaml +++ b/.gitea/workflows/Merge-Checker.yaml @@ -3,6 +3,8 @@ name: Merge-Checker on: pull_request: branches: ["**"] + paths-ignore: + - 'unit-tests/timing-results/**' jobs: build_and_test: @@ -11,11 +13,14 @@ jobs: steps: - name: Checkout source code uses: actions/checkout@v3 + with: + persist-credentials: true + fetch-depth: 0 - name: Install dependencies (CMake + Ninja + build tools) run: | sudo apt-get update - sudo apt-get install -y cmake ninja-build build-essential time + sudo apt-get install -y cmake ninja-build build-essential time git - name: Configure project with CMake run: cmake -G Ninja -S . -B build/ @@ -34,15 +39,45 @@ jobs: fi done - - name: Run matrix-timing-tests with per-test timing output + - name: Run matrix-timing-tests with per-test timing output and save results run: | + mkdir -p unit-tests/timing-results if [ -x build/unit-tests/matrix-timing-tests ]; then echo "Running matrix-timing-tests with timing" - # Run the test executable and capture timing info - # Assuming the executable prints timings per test internally - # If not, you might want to wrap each subtest with 'time' or - # run the entire executable with time: - /usr/bin/time -v build/unit-tests/matrix-timing-tests + /usr/bin/time -v build/unit-tests/matrix-timing-tests -d yes &> unit-tests/timing-results/matrix-timing-tests.txt else echo "matrix-timing-tests executable not found or not executable" - fi \ No newline at end of file + exit 1 + fi + - name: Commit and push timing results + if: github.event.pull_request.head.repo.full_name == github.repository + run: | + git config --global user.name "ci-bot" + git config --global user.email "ci-bot@local" + + BRANCH_NAME="${{ github.event.pull_request.head.ref }}" + git stash + echo "Checking out source branch $BRANCH_NAME" + git fetch origin "$BRANCH_NAME" + git checkout "$BRANCH_NAME" + git pull + + echo "Checking if last commit was a timing update" + LAST_COMMIT_MSG=$(git log -1 --pretty=%B) + + if echo "$LAST_COMMIT_MSG" | grep -q "Update matrix-timing-tests timings"; then + echo "Last commit was a timing update, skipping commit." + exit 0 + else + echo "Last commit name was: $LAST_COMMIT_MSG" + git stash pop + fi + + git add unit-tests/timing-results/matrix-timing-tests.txt + + if git diff --quiet --cached; then + echo "No changes to commit" + else + git commit -m "Update matrix-timing-tests timings [skip ci]" + git push origin "$BRANCH_NAME" + fi diff --git a/README.md b/README.md index 34751ed..301144b 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,3 @@ # Introduction This matrix math library is focused on embedded development and avoids any heap memory allocation unless you explicitly ask for it. +It uses templates to pre-allocate matrices on the stack. \ No newline at end of file diff --git a/unit-tests/timing-results/matrix-timing-tests.txt b/unit-tests/timing-results/matrix-timing-tests.txt new file mode 100644 index 0000000..6d51887 --- /dev/null +++ b/unit-tests/timing-results/matrix-timing-tests.txt @@ -0,0 +1,56 @@ +Randomness seeded to: 942964370 +0.184 s: Addition +0.185 s: Timing Tests +0.189 s: Subtraction +0.189 s: Timing Tests +1.911 s: Multiplication +1.911 s: Timing Tests +0.127 s: Scalar Multiplication +0.127 s: Timing Tests +0.179 s: Element Multiply +0.179 s: Timing Tests +0.178 s: Element Divide +0.178 s: Timing Tests +0.156 s: Minor Matrix +0.156 s: Timing Tests +0.103 s: Determinant +0.103 s: Timing Tests +0.416 s: Matrix of Minors +0.416 s: Timing Tests +0.109 s: Invert +0.109 s: Timing Tests +0.127 s: Transpose +0.127 s: Timing Tests +0.207 s: Normalize +0.207 s: Timing Tests +0.006 s: GET ROW +0.007 s: Timing Tests +0.290 s: GET COLUMN +0.290 s: Timing Tests +=============================================================================== +test cases: 1 | 1 passed +assertions: - none - + + Command being timed: "build/unit-tests/matrix-timing-tests -d yes" + User time (seconds): 4.17 + System time (seconds): 0.00 + Percent of CPU this job got: 99% + Elapsed (wall clock) time (h:mm:ss or m:ss): 0:04.18 + Average shared text size (kbytes): 0 + Average unshared data size (kbytes): 0 + Average stack size (kbytes): 0 + Average total size (kbytes): 0 + Maximum resident set size (kbytes): 3072 + Average resident set size (kbytes): 0 + Major (requiring I/O) page faults: 184 + Minor (reclaiming a frame) page faults: 175 + Voluntary context switches: 1 + Involuntary context switches: 130 + Swaps: 0 + File system inputs: 12 + File system outputs: 1 + Socket messages sent: 0 + Socket messages received: 0 + Signals delivered: 0 + Page size (bytes): 4096 + Exit status: 0