From b1636ec1e7c2a0582b28891d173698a70236deda Mon Sep 17 00:00:00 2001 From: idotalk Date: Sun, 21 Jun 2026 12:37:43 +0300 Subject: [PATCH] add branch name to benchmark output --- .github/workflows/parallel_benchmark.yml | 2 ++ tests/parallel_execution_bench_test.go | 10 ++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/parallel_benchmark.yml b/.github/workflows/parallel_benchmark.yml index b92c2d1dc4..4846ffff2e 100644 --- a/.github/workflows/parallel_benchmark.yml +++ b/.github/workflows/parallel_benchmark.yml @@ -24,6 +24,8 @@ jobs: cache: true - name: Run benchmark + env: + BRANCH_NAME: ${{ github.head_ref }} run: | # The benchmark outputs results to BENCHMARK_OUTPUT_FILE export BENCHMARK_OUTPUT_FILE=$GITHUB_WORKSPACE/tests/benchmarks/parallel_results.txt diff --git a/tests/parallel_execution_bench_test.go b/tests/parallel_execution_bench_test.go index e9d3e4f86b..2ffa45180e 100644 --- a/tests/parallel_execution_bench_test.go +++ b/tests/parallel_execution_bench_test.go @@ -18,6 +18,12 @@ import ( ) func TestParallelBenchmarkOutput(t *testing.T) { + branchName := os.Getenv("BRANCH_NAME") + if branchName == "" { + branchName = "unknown-branch" + } + + fmt.Printf("--- Running benchmarks for branch: %s ---\n", branchName) outPath := os.Getenv("BENCHMARK_OUTPUT_FILE") if outPath == "" { t.Skip("BENCHMARK_OUTPUT_FILE not set, skipping benchmark tracking output") @@ -55,8 +61,8 @@ func TestParallelBenchmarkOutput(t *testing.T) { speedup := float64(seqTime) / float64(parTime) seqAvgMs := (seqTime.Seconds() / float64(n)) * 1000 parAvgMs := (parTime.Seconds() / float64(n)) * 1000 - resLine := fmt.Sprintf("[%s][%d][%s] - Sequential: %.3fs (%.2fms/tx), Parallel: %.3fs (%.2fms/tx), Speedup: %.2fx", - dateStr, n, dep, seqTime.Seconds(), seqAvgMs, parTime.Seconds(), parAvgMs, speedup) + resLine := fmt.Sprintf("[%s][%s][%d][%s] - Sequential: %.3fs (%.2fms/tx), Parallel: %.3fs (%.2fms/tx), Speedup: %.2fx", + dateStr, branchName, n, dep, seqTime.Seconds(), seqAvgMs, parTime.Seconds(), parAvgMs, speedup) t.Log(resLine) results = append(results, resLine) }