-
Notifications
You must be signed in to change notification settings - Fork 1.6k
[benchmark] add gbenchmark #2780
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
Merged
Stephan T. Lavavej (StephanTLavavej)
merged 25 commits into
microsoft:main
from
strega-nil:benchmarkin
Jul 1, 2022
Merged
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
9093861
[benchmark] add gbenchmark
strega-nil ecb07e6
[wip] (doesn't link rn) start working on comments
strega-nil 8dd601a
fix linking
strega-nil 3bb30f0
fix CR comments
strega-nil 056aceb
fix azp
strega-nil d4e416d
stop removing /EHsc
strega-nil 9bd8744
fix tests
strega-nil 677f467
don't format cmake
strega-nil d5895aa
fix all the things
strega-nil f825bc6
check flags
strega-nil e3487bc
hopefully fix CI
strega-nil 89e5979
Merge remote-tracking branch 'upstream/main' into strega-nil/benchmarkin
strega-nil 3e830fe
bugfix
strega-nil e86dca4
Casey CRs
strega-nil 6a2d30d
Stephan CRs
strega-nil 8c903dd
codecvt_ids needs `${gl_flag_${REL_OR_DBG}} /EHsc`.
StephanTLavavej 25d2a89
Modify README, change how benchmarks work
strega-nil b09eeb7
Merge remote-tracking branch 'upstream/main' into strega-nil/benchmarkin
strega-nil d77f88b
Casey CRs
strega-nil 756f6c6
more CRs
strega-nil b80c5d8
Add SPDX-License-Identifier to xoshiro.hpp
CaseyCarter 36798a7
Fix Casey's damage
CaseyCarter dd79099
Merge remote-tracking branch 'upstream/main' into strega-nil/benchmarkin
strega-nil f13531d
add xoshiro notice
strega-nil db7ff94
Code review feedback.
StephanTLavavej File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -10,3 +10,4 @@ __pycache__/ | |
| /out/ | ||
| /tools/out/ | ||
| /CMakeLists.txt.user | ||
| /*.log | ||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,77 @@ | ||
| # Copyright (c) Microsoft Corporation. | ||
| # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
|
|
||
|
strega-nil-ms marked this conversation as resolved.
|
||
| set(STL_BENCHMARK_MSVC_RUNTIME_LIBRARY | ||
| MultiThreaded | ||
| CACHE STRING "The flavor of the standard library to use; see https://cmake.org/cmake/help/latest/variable/CMAKE_MSVC_RUNTIME_LIBRARY.html for more information.") | ||
| set_property(CACHE STL_BENCHMARK_MSVC_RUNTIME_LIBRARY | ||
| PROPERTY STRINGS | ||
| "MultiThreaded;MultiThreadedDLL;MultiThreadedDebug;MultiThreadedDebugDLL" | ||
| ) | ||
| set(CMAKE_MSVC_RUNTIME_LIBRARY "${STL_BENCHMARK_MSVC_RUNTIME_LIBRARY}") | ||
|
|
||
| set(STL_BENCHMARK_ITERATOR_DEBUG_LEVEL | ||
| default | ||
| CACHE STRING "What level of iterator debugging to use." | ||
| ) | ||
| set_property(CACHE STL_BENCHMARK_ITERATOR_DEBUG_LEVEL | ||
| PROPERTY STRINGS | ||
| "default;0;1;2" | ||
| ) | ||
|
|
||
| if(NOT STL_BENCHMARK_ITERATOR_DEBUG_LEVEL STREQUAL "default") | ||
| add_compile_definitions("_ITERATOR_DEBUG_LEVEL=${STL_BENCHMARK_ITERATOR_DEBUG_LEVEL}") | ||
| endif() | ||
|
|
||
| set(CMAKE_BUILD_TYPE RelWithDebInfo) | ||
|
|
||
| if(NOT EXISTS "${CMAKE_CURRENT_LIST_DIR}/google-benchmark/.git") | ||
| message(FATAL_ERROR "google-benchmark is not checked out; make sure to run\n git submodule update --init benchmarks/google-benchmark") | ||
| endif() | ||
|
|
||
| set(BENCHMARK_ENABLE_DOXYGEN OFF) | ||
| set(BENCHMARK_ENABLE_INSTALL OFF) | ||
| set(BENCHMARK_ENABLE_TESTING OFF) | ||
| set(BUILD_SHARED_LIBS OFF) | ||
|
|
||
| # TRANSITION, GH-2816: on some machines, librt is found, despite it being a unix-only library | ||
| set(HAVE_LIB_RT OFF) | ||
|
|
||
| include_directories(BEFORE "${CMAKE_BINARY_DIR}/out/inc") | ||
| link_directories(BEFORE "${STL_LIBRARY_OUTPUT_DIRECTORY}") | ||
|
|
||
| add_subdirectory(google-benchmark EXCLUDE_FROM_ALL) | ||
|
|
||
| set(benchmark_headers | ||
| "inc/udt.hpp" | ||
| "inc/utility.hpp" | ||
| "inc/xoshiro.hpp" | ||
| ) | ||
|
|
||
| function(add_benchmark name) | ||
| cmake_parse_arguments(PARSE_ARGV 1 "arg" "" "CXX_STANDARD" "") | ||
|
|
||
| if(NOT DEFINED arg_CXX_STANDARD) | ||
| set(arg_CXX_STANDARD 23) | ||
| elseif(NOT arg_CXX_STANDARD MATCHES "^[0-9][0-9]$") | ||
|
strega-nil-ms marked this conversation as resolved.
|
||
| message(FATAL_ERROR "Unexpected value for CXX_STANDARD: ${arg_CXX_STANDARD}") | ||
| endif() | ||
|
|
||
| if(NOT DEFINED arg_UNPARSED_ARGUMENTS) | ||
| message(FATAL_ERROR "benchmark ${name} does not have any source files") | ||
| endif() | ||
|
|
||
| add_executable(benchmark-${name} | ||
| ${benchmark_headers} | ||
| ${arg_UNPARSED_ARGUMENTS} | ||
| ) | ||
|
|
||
| target_compile_features(benchmark-${name} PRIVATE cxx_std_${arg_CXX_STANDARD}) | ||
| target_include_directories(benchmark-${name} PRIVATE inc) | ||
| target_link_libraries(benchmark-${name} PRIVATE benchmark::benchmark) | ||
| endfunction() | ||
|
|
||
| add_benchmark(std_copy | ||
| src/std_copy.cpp | ||
| CXX_STANDARD 23 | ||
| ) | ||
Submodule google-benchmark
added at
0d98db
This file contains hidden or 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,26 @@ | ||
| // Copyright (c) Microsoft Corporation. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
|
|
||
| #pragma once | ||
|
strega-nil-ms marked this conversation as resolved.
|
||
|
|
||
| template <typename Contained> | ||
| struct aggregate { | ||
| Contained c; | ||
|
|
||
| friend bool operator==(const aggregate&, const aggregate&) = default; | ||
| }; | ||
|
|
||
| template <typename Contained> | ||
| struct non_trivial { | ||
| Contained c; | ||
| non_trivial() : c() {} | ||
| non_trivial(const Contained& src) : c(src) {} | ||
|
CaseyCarter marked this conversation as resolved.
|
||
| non_trivial(const non_trivial& other) : c(other.c) {} | ||
| non_trivial& operator=(const non_trivial& other) { | ||
| c = other.c; | ||
| return *this; | ||
| } | ||
| ~non_trivial() {} | ||
|
|
||
| friend bool operator==(const non_trivial&, const non_trivial&) = default; | ||
| }; | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.