Skip to content

Commit

Permalink
[CI] Benchmark, provide units with --benchmark_min_time (#2621)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcalff authored Apr 3, 2024
1 parent fabd8cc commit 13a4c45
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions bazel/otel_cc_benchmark.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def otel_cc_benchmark(name, srcs, deps, tags = [""]):
tools = [":" + name],
tags = tags + ["benchmark_result", "manual"],
testonly = True,
cmd = "$(location :" + name + (") --benchmark_format=json --benchmark_color=false --benchmark_min_time=.1 &> $@"),
cmd = "$(location :" + name + (") --benchmark_format=json --benchmark_color=false --benchmark_min_time=.1s &> $@"),
)

# This is run as part of "bazel test ..." to smoke-test benchmarks. It's
Expand All @@ -46,7 +46,7 @@ def otel_cc_benchmark(name, srcs, deps, tags = [""]):
name = name + "_smoketest",
srcs = srcs,
deps = deps + ["@com_github_google_benchmark//:benchmark"],
args = ["--benchmark_min_time=0"],
args = ["--benchmark_min_time=1x"],
tags = tags + ["benchmark"],
defines = ["BAZEL_BUILD"],
)
4 changes: 4 additions & 0 deletions ci/do_ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ function run_benchmarks
do
out=$component-benchmark_result.json
find ./$component -type f -name "*_result.json" -exec cat {} \; > $component_tmp_bench.json
# Print each result in CI logs, so it can be inspected.
echo "BENCHMARK result (begin)"
cat $component_tmp_bench.json
echo "BENCHMARK result (end)"
cat $component_tmp_bench.json | docker run -i --rm itchyny/gojq:0.12.6 -s \
'.[0].benchmarks = ([.[].benchmarks] | add) |
if .[0].benchmarks == null then null else .[0] end' > $BENCHMARK_DIR/$out
Expand Down

0 comments on commit 13a4c45

Please sign in to comment.