-
Notifications
You must be signed in to change notification settings - Fork 115
build: add benchmark build scaffolding #825
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| # Licensed to the Apache Software Foundation (ASF) under one | ||
| # or more contributor license agreements. See the NOTICE file | ||
| # distributed with this work for additional information | ||
| # regarding copyright ownership. The ASF licenses this file | ||
| # to you under the Apache License, Version 2.0 (the | ||
| # "License"); you may not use this file except in compliance | ||
| # with the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, | ||
| # software distributed under the License is distributed on an | ||
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| # KIND, either express or implied. See the License for the | ||
| # specific language governing permissions and limitations | ||
| # under the License. | ||
|
|
||
| set(BENCHMARK_ENABLE_GTEST_TESTS | ||
| OFF | ||
| CACHE BOOL "" FORCE) | ||
| set(BENCHMARK_ENABLE_INSTALL | ||
| OFF | ||
| CACHE BOOL "" FORCE) | ||
| set(BENCHMARK_ENABLE_TESTING | ||
| OFF | ||
| CACHE BOOL "" FORCE) | ||
|
|
||
| fetchcontent_declare(google_benchmark | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we move this to
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this PR follows the gtest way ;) Maybe we can change that together, I have the same feeling at the first look. |
||
| GIT_REPOSITORY https://github.com/google/benchmark.git | ||
| GIT_TAG a4cf155615c63e019ae549e31703bf367df5b471 # v1.8.4 | ||
| FIND_PACKAGE_ARGS | ||
| NAMES | ||
| benchmark | ||
| CONFIG) | ||
| fetchcontent_makeavailable(google_benchmark) | ||
|
|
||
| add_executable(metrics_evaluator_benchmark metrics_evaluator_benchmark.cc) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we add |
||
| target_link_libraries(metrics_evaluator_benchmark | ||
| PRIVATE "$<IF:$<TARGET_EXISTS:iceberg_static>,iceberg_static,iceberg_shared>" | ||
| "$<IF:$<TARGET_EXISTS:benchmark::benchmark>,benchmark::benchmark,benchmark>" | ||
| ) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| # Licensed to the Apache Software Foundation (ASF) under one | ||
| # or more contributor license agreements. See the NOTICE file | ||
| # distributed with this work for additional information | ||
| # regarding copyright ownership. The ASF licenses this file | ||
| # to you under the Apache License, Version 2.0 (the | ||
| # "License"); you may not use this file except in compliance | ||
| # with the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, | ||
| # software distributed under the License is distributed on an | ||
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| # KIND, either express or implied. See the License for the | ||
| # specific language governing permissions and limitations | ||
| # under the License. | ||
|
|
||
| benchmark_dep = dependency('benchmark', required: true) | ||
|
|
||
| metrics_evaluator_benchmark = executable( | ||
| 'metrics_evaluator_benchmark', | ||
| sources: files('metrics_evaluator_benchmark.cc'), | ||
| dependencies: [iceberg_dep, benchmark_dep], | ||
| ) | ||
|
|
||
| benchmark('metrics_evaluator_benchmark', metrics_evaluator_benchmark) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
|
|
||
| #include <benchmark/benchmark.h> | ||
|
|
||
| namespace iceberg { | ||
| namespace { | ||
|
|
||
| void BM_BenchmarkSmoke(benchmark::State& state) { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: the file name looks odd since it's unrelated to metrics evaluator. |
||
| while (state.KeepRunning()) { | ||
| benchmark::DoNotOptimize(state.iterations()); | ||
| } | ||
|
|
||
| state.SetItemsProcessed(state.iterations()); | ||
| } | ||
|
|
||
| BENCHMARK(BM_BenchmarkSmoke); | ||
|
|
||
| } // namespace | ||
| } // namespace iceberg | ||
|
|
||
| int main(int argc, char** argv) { | ||
| benchmark::Initialize(&argc, argv); | ||
| if (benchmark::ReportUnrecognizedArguments(argc, argv)) { | ||
| return 1; | ||
| } | ||
| benchmark::RunSpecifiedBenchmarks(); | ||
| benchmark::Shutdown(); | ||
| return 0; | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| # Licensed to the Apache Software Foundation (ASF) under one | ||
| # or more contributor license agreements. See the NOTICE file | ||
| # distributed with this work for additional information | ||
| # regarding copyright ownership. The ASF licenses this file | ||
| # to you under the Apache License, Version 2.0 (the | ||
| # "License"); you may not use this file except in compliance | ||
| # with the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, | ||
| # software distributed under the License is distributed on an | ||
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| # KIND, either express or implied. See the License for the | ||
| # specific language governing permissions and limitations | ||
| # under the License. | ||
|
|
||
| [wrap-file] | ||
| directory = benchmark-1.8.4 | ||
| source_url = https://github.com/google/benchmark/archive/refs/tags/v1.8.4.tar.gz | ||
| source_filename = benchmark-1.8.4.tar.gz | ||
| source_hash = 3e7059b6b11fb1bbe28e33e02519398ca94c1818874ebed18e504dc6f709be45 | ||
| source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/google-benchmark_1.8.4-5/benchmark-1.8.4.tar.gz | ||
| patch_filename = google-benchmark_1.8.4-5_patch.zip | ||
| patch_url = https://wrapdb.mesonbuild.com/v2/google-benchmark_1.8.4-5/get_patch | ||
| patch_hash = 671ffed65f1e95e8c20edb7a06eb54476797e58169160b255f52dc71f4b83957 | ||
| wrapdb_version = 1.8.4-5 | ||
|
|
||
| [provide] | ||
| dependency_names = benchmark, benchmark_main |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need this but do not change other workflows?