Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
GEODE-5188 - Adds benchmarking framework. (#293)
* Prevent optimization of bench. * Adds benchmark framework. * Refactor for shared integration framework. * Adds some get benchmarks. * Fixes Rat checking
- Loading branch information
1 parent
3882b00
commit e4b2577305e015f38249db70c23b49b2a0523df6
Showing
52 changed files
with
894 additions
and
123 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,39 @@ | ||
# text files | ||
.*\.clang-format$ | ||
.*\.clang-tidy$ | ||
.*\.cpackignore$ | ||
.*\.gitignore$ | ||
.*\.lcovrc$ | ||
.*\.ratignore$ | ||
.*\.lgtm.yml$ | ||
.*\.ratCheck.sh$ | ||
# rat -E only matches filename components | ||
# All matches are anchored automatically to who string | ||
|
||
.*md$ | ||
.*json$ | ||
.*deprecated_xml_instructions.txt$ | ||
# / | ||
\.clang-format | ||
\.clang-tidy | ||
\.gitignore | ||
\.ratignore | ||
\.lgtm.yml | ||
\.lcovrc | ||
\.cpackignore | ||
|
||
# generated files | ||
.*Resources.Designer.cs$ | ||
.*Settings.Designer.cs$ | ||
# dependencies/*/ | ||
patches | ||
|
||
# public domain | ||
.*CPPDictionary.hpp$ | ||
.*CPPSymbol.hpp$ | ||
.*CPP_parser.g$ | ||
.*DictEntry.hpp$ | ||
.*Dictionary.cpp$ | ||
.*Dictionary.hpp$ | ||
.*STDCTokenTypes.txt$ | ||
.*Support.cpp$ | ||
# packer/*/ | ||
.*\.cloud-init | ||
.*\.json | ||
|
||
# expect script | ||
.*changepasswd$ | ||
.*winrm.cloud-init$ | ||
# docs/ | ||
Gemfile.lock | ||
package-list | ||
.*\.md | ||
.*\.md.erb | ||
|
||
# doxygen | ||
.*package-list$ | ||
.*testframeworkdox.txt$ | ||
docs | ||
# contrib/pdxautoserializer | ||
# public domain sources | ||
CPPDictionary.hpp | ||
CPPSymbol.hpp | ||
CPP_parser.g | ||
DictEntry.hpp | ||
Dictionary.cpp | ||
Dictionary.hpp | ||
STDCTokenTypes.txt | ||
Support.cpp | ||
|
||
# patches | ||
.*patches$ | ||
.*ACE.config.h.in$ | ||
# well known build directories | ||
build | ||
cmake-build-.* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# 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. | ||
# | ||
|
||
execute_process( | ||
COMMAND ${Java_JAVA_EXECUTABLE} -jar ${Rat_JAR} -d . -E .ratignore > | ||
OUTPUT_VARIABLE ratOutput | ||
) | ||
|
||
set(pass FALSE) | ||
if (ratOutput MATCHES "([0-9]+) Unknown Licenses") | ||
set(unknownLicenses ${CMAKE_MATCH_1}) | ||
if (unknownLicenses GREATER 0) | ||
message(SEND_ERROR "${ratOutput}") | ||
message(FATAL_ERROR "${unknownLicenses} Unknown licenses detected.") | ||
endif() | ||
else() | ||
message(SEND_ERROR "${ratOutput}") | ||
message(FATAL_ERROR "Unknown failure") | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
Contents | ||
======== | ||
|
||
|
||
## Main sources | ||
|
||
# include/ | ||
Public include header files for C++ library. | ||
|
||
# src/ | ||
Sources for both static and shared C++ library. | ||
|
||
# shared/ | ||
Shared library definition only. Should not contain any sources. | ||
|
||
# static/ | ||
Static library definition only. Should not contain any sources. | ||
|
||
|
||
## Test and Benchmark sources | ||
|
||
# integration/ | ||
Integration syle tests, benchmarks, and common sources. These are all "modern" | ||
single process style and shoult not use any of the "legacy" multiple process | ||
framework. | ||
|
||
## integrtion-test/ | ||
Legacy integration tests written in the multiple process framework. No new tests | ||
should be added to this collections. Fixes and rewrites should be migrated to | ||
the new framework in the _integration/test_ directory metioned above. | ||
|
||
## test/ | ||
Unit style tests. | ||
|
||
## benchmark/ | ||
Unit style or micro benchmark tests. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# 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. | ||
|
||
add_executable(cpp-benchmark | ||
main.cpp | ||
GeodeHashBM.cpp | ||
) | ||
|
||
target_link_libraries(cpp-benchmark | ||
PUBLIC | ||
apache-geode-static | ||
benchmark::benchmark | ||
PRIVATE | ||
_WarningsAsError | ||
) | ||
|
||
target_include_directories(cpp-benchmark | ||
PRIVATE | ||
$<TARGET_PROPERTY:apache-geode-static,SOURCE_DIR>/../src | ||
) | ||
|
||
add_clangformat(cpp-benchmark) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
* 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> | ||
|
||
#include <geode/CacheableString.hpp> | ||
|
||
#include "util/string.hpp" | ||
|
||
using apache::geode::client::to_utf16; | ||
using apache::geode::client::internal::geode_hash; | ||
|
||
class GeodeHashBM : public benchmark::Fixture {}; | ||
|
||
BENCHMARK_DEFINE_F(GeodeHashBM, std_string)(benchmark::State& state) { | ||
std::string x(state.range(0), 'x'); | ||
for (auto _ : state) { | ||
int hashcode; | ||
benchmark::DoNotOptimize(hashcode = geode_hash<std::string>{}(x)); | ||
} | ||
} | ||
BENCHMARK_REGISTER_F(GeodeHashBM, std_string)->Range(8, 8 << 10); | ||
|
||
BENCHMARK_DEFINE_F(GeodeHashBM, std_u16string)(benchmark::State& state) { | ||
std::u16string x(state.range(0), u'x'); | ||
for (auto _ : state) { | ||
int hashcode; | ||
benchmark::DoNotOptimize(hashcode = geode_hash<std::u16string>{}(x)); | ||
} | ||
} | ||
BENCHMARK_REGISTER_F(GeodeHashBM, std_u16string)->Range(8, 8 << 10); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* | ||
* 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> | ||
|
||
BENCHMARK_MAIN(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# 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. | ||
|
||
add_subdirectory(framework) | ||
add_subdirectory(test) | ||
|
||
if (BUILD_BENCHMARKS) | ||
add_subdirectory(benchmark) | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. | ||
|
||
add_executable(cpp-integration-benchmark | ||
main.cpp | ||
RegionBM.cpp | ||
) | ||
|
||
target_link_libraries(cpp-integration-benchmark | ||
PUBLIC | ||
apache-geode | ||
benchmark::benchmark | ||
integration-framework | ||
PRIVATE | ||
_WarningsAsError | ||
) | ||
|
||
add_clangformat(cpp-integration-benchmark) |
Oops, something went wrong.