mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-21 20:26:41 +00:00
add branch name to benchmark output
This commit is contained in:
parent
4ed8da87df
commit
b1636ec1e7
2 changed files with 10 additions and 2 deletions
2
.github/workflows/parallel_benchmark.yml
vendored
2
.github/workflows/parallel_benchmark.yml
vendored
|
|
@ -24,6 +24,8 @@ jobs:
|
||||||
cache: true
|
cache: true
|
||||||
|
|
||||||
- name: Run benchmark
|
- name: Run benchmark
|
||||||
|
env:
|
||||||
|
BRANCH_NAME: ${{ github.head_ref }}
|
||||||
run: |
|
run: |
|
||||||
# The benchmark outputs results to BENCHMARK_OUTPUT_FILE
|
# The benchmark outputs results to BENCHMARK_OUTPUT_FILE
|
||||||
export BENCHMARK_OUTPUT_FILE=$GITHUB_WORKSPACE/tests/benchmarks/parallel_results.txt
|
export BENCHMARK_OUTPUT_FILE=$GITHUB_WORKSPACE/tests/benchmarks/parallel_results.txt
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,12 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestParallelBenchmarkOutput(t *testing.T) {
|
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")
|
outPath := os.Getenv("BENCHMARK_OUTPUT_FILE")
|
||||||
if outPath == "" {
|
if outPath == "" {
|
||||||
t.Skip("BENCHMARK_OUTPUT_FILE not set, skipping benchmark tracking output")
|
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)
|
speedup := float64(seqTime) / float64(parTime)
|
||||||
seqAvgMs := (seqTime.Seconds() / float64(n)) * 1000
|
seqAvgMs := (seqTime.Seconds() / float64(n)) * 1000
|
||||||
parAvgMs := (parTime.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",
|
resLine := fmt.Sprintf("[%s][%s][%d][%s] - Sequential: %.3fs (%.2fms/tx), Parallel: %.3fs (%.2fms/tx), Speedup: %.2fx",
|
||||||
dateStr, n, dep, seqTime.Seconds(), seqAvgMs, parTime.Seconds(), parAvgMs, speedup)
|
dateStr, branchName, n, dep, seqTime.Seconds(), seqAvgMs, parTime.Seconds(), parAvgMs, speedup)
|
||||||
t.Log(resLine)
|
t.Log(resLine)
|
||||||
results = append(results, resLine)
|
results = append(results, resLine)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue