Skip to content

Commit db7f47f

Browse files
committed
Basic PMR performance tests working
1 parent ee1602f commit db7f47f

18 files changed

+983
-0
lines changed

.clang-format

+98
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
AccessModifierOffset: -2
2+
AlignAfterOpenBracket: DontAlign
3+
AlignConsecutiveAssignments: false
4+
AlignConsecutiveDeclarations: false
5+
AlignEscapedNewlines: Left
6+
AlignOperands: true
7+
AlignTrailingComments: false
8+
AllowAllParametersOfDeclarationOnNextLine: false
9+
AllowShortBlocksOnASingleLine: true
10+
AllowShortCaseLabelsOnASingleLine: false
11+
AllowShortFunctionsOnASingleLine: All
12+
AllowShortIfStatementsOnASingleLine: true
13+
AllowShortLoopsOnASingleLine: true
14+
AlwaysBreakAfterDefinitionReturnType: None
15+
AlwaysBreakAfterReturnType: None
16+
AlwaysBreakBeforeMultilineStrings: true
17+
AlwaysBreakTemplateDeclarations: false
18+
BinPackArguments: false
19+
BinPackParameters: false
20+
BraceWrapping:
21+
AfterClass: true
22+
AfterControlStatement: false
23+
AfterEnum: false
24+
AfterFunction: true
25+
AfterNamespace: false
26+
AfterObjCDeclaration: false
27+
AfterStruct: true
28+
AfterUnion: false
29+
BeforeCatch: false
30+
BeforeElse: false
31+
IndentBraces: false
32+
SplitEmptyFunction: false
33+
SplitEmptyNamespace: true
34+
SplitEmptyRecord: true
35+
BreakAfterJavaFieldAnnotations: true
36+
BreakBeforeBinaryOperators: NonAssignment
37+
BreakBeforeBraces: Custom
38+
BreakBeforeInheritanceComma: true
39+
BreakBeforeTernaryOperators: true
40+
BreakConstructorInitializers: BeforeColon
41+
BreakConstructorInitializersBeforeComma: false
42+
BreakStringLiterals: true
43+
ColumnLimit: 0
44+
CommentPragmas: '^ IWYU pragma:'
45+
CompactNamespaces: false
46+
ConstructorInitializerAllOnOneLineOrOnePerLine: false
47+
ConstructorInitializerIndentWidth: 2
48+
ContinuationIndentWidth: 2
49+
Cpp11BracedListStyle: false
50+
DerivePointerAlignment: false
51+
DisableFormat: false
52+
ExperimentalAutoDetectBinPacking: true
53+
FixNamespaceComments: true
54+
ForEachMacros:
55+
- foreach
56+
- Q_FOREACH
57+
- BOOST_FOREACH
58+
IncludeCategories:
59+
- Priority: 2
60+
Regex: ^"(llvm|llvm-c|clang|clang-c)/
61+
- Priority: 3
62+
Regex: ^(<|"(gtest|gmock|isl|json)/)
63+
- Priority: 1
64+
Regex: .*
65+
IncludeIsMainRegex: (Test)?$
66+
IndentCaseLabels: false
67+
IndentWidth: 2
68+
IndentWrappedFunctionNames: true
69+
JavaScriptQuotes: Leave
70+
JavaScriptWrapImports: true
71+
KeepEmptyLinesAtTheStartOfBlocks: true
72+
Language: Cpp
73+
MacroBlockBegin: ''
74+
MacroBlockEnd: ''
75+
MaxEmptyLinesToKeep: 2
76+
NamespaceIndentation: Inner
77+
ObjCBlockIndentWidth: 7
78+
ObjCSpaceAfterProperty: true
79+
ObjCSpaceBeforeProtocolList: false
80+
PointerAlignment: Right
81+
ReflowComments: true
82+
SortIncludes: false
83+
SortUsingDeclarations: false
84+
SpaceAfterCStyleCast: false
85+
SpaceAfterTemplateKeyword: false
86+
SpaceBeforeAssignmentOperators: true
87+
SpaceBeforeParens: ControlStatements
88+
SpaceInEmptyParentheses: false
89+
SpacesBeforeTrailingComments: 0
90+
SpacesInAngles: false
91+
SpacesInCStyleCastParentheses: false
92+
SpacesInContainerLiterals: true
93+
SpacesInParentheses: false
94+
SpacesInSquareBrackets: false
95+
Standard: Cpp11
96+
TabWidth: 8
97+
UseTab: Never
98+

.clang-tidy

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
Checks: '*,-fuchsia-*,-google-*,-zircon-*,-abseil-*,-modernize-use-trailing-return-type,-llvm-*'
3+
WarningsAsErrors: '*'
4+
HeaderFilterRegex: ''
5+
FormatStyle: none
6+
7+

.cmake-format.yaml

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
additional_commands:
2+
foo:
3+
flags:
4+
- BAR
5+
- BAZ
6+
kwargs:
7+
DEPENDS: '*'
8+
HEADERS: '*'
9+
SOURCES: '*'
10+
bullet_char: '*'
11+
dangle_parens: false
12+
enum_char: .
13+
line_ending: unix
14+
line_width: 120
15+
max_pargs_hwrap: 3
16+
separate_ctrl_name_with_space: false
17+
separate_fn_name_with_space: false
18+
tab_size: 2
19+

.github/workflows/build_cmake.yml

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: CMake
2+
3+
on: [push]
4+
5+
env:
6+
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
7+
BUILD_TYPE: RelWithDebInfo
8+
9+
jobs:
10+
build:
11+
12+
runs-on: ${{ matrix.os }}
13+
strategy:
14+
matrix:
15+
os: [ubuntu-latest]
16+
17+
steps:
18+
- uses: actions/checkout@v2
19+
20+
- name: Create Build Environment
21+
# Some projects don't allow in-source building, so create a separate build directory
22+
# We'll use this as our working directory for all subsequent commands
23+
run: cmake -E make_directory ${{runner.workspace}}/build
24+
25+
- name: Install conan
26+
shell: bash
27+
run: |
28+
python3 -m pip install --upgrade pip setuptools
29+
python3 -m pip install conan
30+
source ~/.profile
31+
32+
- name: Configure CMake
33+
# Use a bash shell so we can use the same syntax for environment variable
34+
# access regardless of the host operating system
35+
shell: bash
36+
working-directory: ${{runner.workspace}}/build
37+
# Note the current convention is to use the -S and -B options here to specify source
38+
# and build directories, but this is only available with CMake 3.13 and higher.
39+
# The CMake binaries on the Github Actions machines are (as of this writing) 3.12
40+
#
41+
# We need to source the profile file to make sure conan is in PATH
42+
run: |
43+
source ~/.profile
44+
cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE
45+
46+
- name: Build
47+
working-directory: ${{runner.workspace}}/build
48+
shell: bash
49+
# Execute the build. You can specify a specific target with "--target <NAME>"
50+
run: cmake --build . --config $BUILD_TYPE
51+
52+
- name: Test
53+
working-directory: ${{runner.workspace}}/build
54+
shell: bash
55+
# Execute tests defined by the CMake configuration.
56+
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
57+
run: ctest -C $BUILD_TYPE

.travis.yml

+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
language: cpp
2+
3+
install:
4+
# Pip cannot install Conan without these upgrades
5+
- python3 -m pip install --upgrade pip setuptools
6+
# Install Conan and CMake >= 3.15
7+
- python3 -m pip install conan cmake
8+
9+
# Fail if we can't run Conan.
10+
- conan --version
11+
12+
jobs:
13+
include:
14+
- os: osx
15+
compiler: gcc
16+
osx_image: xcode11.2 # includes gcc-9 by default
17+
env:
18+
- GCC_VER="9"
19+
- MATRIX_EVAL="CC=gcc-${GCC_VER} && CXX=g++-${GCC_VER}"
20+
- os: osx
21+
compiler: clang
22+
osx_image: xcode11.2
23+
env:
24+
- MATRIX_EVAL=""
25+
- os: linux
26+
dist: bionic
27+
compiler: gcc
28+
env:
29+
- GCC_VER="9"
30+
- MATRIX_EVAL="CC=gcc-${GCC_VER} && CXX=g++-${GCC_VER}"
31+
32+
addons:
33+
apt:
34+
sources:
35+
- ubuntu-toolchain-r-test
36+
packages:
37+
# I couldn't get ${GCC_VER} in here successfully
38+
- gcc-9
39+
- g++-9
40+
- doxygen
41+
- python3-pip
42+
after_script:
43+
- bash <(curl -s https://codecov.io/bash) -x /usr/bin/gcov-${GCC_VER}
44+
- os: linux
45+
dist: bionic
46+
compiler: clang
47+
env:
48+
- MATRIX_EVAL="CC=clang && CXX=clang++"
49+
addons: { apt: { packages: ['doxygen', 'python3-pip'] } }
50+
51+
52+
before_script:
53+
- eval "${MATRIX_EVAL}"
54+
55+
script:
56+
- mkdir build
57+
- cd build
58+
- cmake -D ENABLE_COVERAGE:BOOL=TRUE ../
59+
- cmake --build . -- -j2
60+
- ctest -j2
61+
62+
63+

CMakeLists.txt

+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
cmake_minimum_required(VERSION 3.15)
2+
3+
# Set the project name to your project name, my project isn't very descriptive
4+
project(myproject CXX)
5+
include(cmake/StandardProjectSettings.cmake)
6+
include(cmake/PreventInSourceBuilds.cmake)
7+
8+
# Link this 'library' to set the c++ standard / compile-time options requested
9+
add_library(project_options INTERFACE)
10+
target_compile_features(project_options INTERFACE cxx_std_20)
11+
12+
if(CMAKE_CXX_COMPILER_ID MATCHES ".*Clang")
13+
option(ENABLE_BUILD_WITH_TIME_TRACE "Enable -ftime-trace to generate time tracing .json files on clang" OFF)
14+
if(ENABLE_BUILD_WITH_TIME_TRACE)
15+
add_compile_definitions(project_options INTERFACE -ftime-trace)
16+
endif()
17+
endif()
18+
19+
# Link this 'library' to use the warnings specified in CompilerWarnings.cmake
20+
add_library(project_warnings INTERFACE)
21+
22+
# enable cache system
23+
include(cmake/Cache.cmake)
24+
25+
# standard compiler warnings
26+
include(cmake/CompilerWarnings.cmake)
27+
set_project_warnings(project_warnings)
28+
29+
# sanitizer options if supported by compiler
30+
include(cmake/Sanitizers.cmake)
31+
enable_sanitizers(project_options)
32+
33+
# enable doxygen
34+
include(cmake/Doxygen.cmake)
35+
enable_doxygen()
36+
37+
# allow for static analysis options
38+
include(cmake/StaticAnalyzers.cmake)
39+
40+
option(BUILD_SHARED_LIBS "Enable compilation of shared libraries" OFF)
41+
42+
# Very basic PCH example
43+
option(ENABLE_PCH "Enable Precompiled Headers" OFF)
44+
if(ENABLE_PCH)
45+
# This sets a global PCH parameter, each project will build its own PCH, which is a good idea if any #define's change
46+
#
47+
# consider breaking this out per project as necessary
48+
target_precompile_headers(
49+
project_options
50+
INTERFACE
51+
<vector>
52+
<string>
53+
<map>
54+
<utility>)
55+
endif()
56+
57+
# Set up some extra Conan dependencies based on our needs before loading Conan
58+
set(CONAN_EXTRA_REQUIRES "benchmark/1.5.2")
59+
set(CONAN_EXTRA_OPTIONS "")
60+
61+
62+
include(cmake/Conan.cmake)
63+
run_conan()
64+
65+
add_subdirectory(PMR)
66+

LICENSE

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
This is free and unencumbered software released into the public domain.
2+
3+
Anyone is free to copy, modify, publish, use, compile, sell, or
4+
distribute this software, either in source code form or as a compiled
5+
binary, for any purpose, commercial or non-commercial, and by any
6+
means.
7+
8+
In jurisdictions that recognize copyright laws, the author or authors
9+
of this software dedicate any and all copyright interest in the
10+
software to the public domain. We make this dedication for the benefit
11+
of the public at large and to the detriment of our heirs and
12+
successors. We intend this dedication to be an overt act of
13+
relinquishment in perpetuity of all present and future rights to this
14+
software under copyright law.
15+
16+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19+
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
20+
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21+
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22+
OTHER DEALINGS IN THE SOFTWARE.
23+
24+
For more information, please refer to <https://unlicense.org>

PMR/CMakeLists.txt

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
add_executable(pmr_performance_tests performance_tests.cpp)
2+
target_link_libraries(pmr_performance_tests PRIVATE CONAN_PKG::benchmark project_options project_warnings)
3+
4+

PMR/performance_tests.cpp

+319
Large diffs are not rendered by default.

appveyor.yml

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
image:
2+
- Visual Studio 2019
3+
clone_folder: c:\projects\source
4+
5+
environment:
6+
PYTHON: "C:\\Python38-x64\\python.exe"
7+
8+
build_script:
9+
- cmd: >-
10+
mkdir build
11+
12+
cd build
13+
14+
set PATH=%PATH%;C:\Users\appveyor\AppData\Roaming\Python\Python38\Scripts
15+
16+
"%PYTHON%" -m pip install --user conan
17+
18+
cmake c:\projects\source -G "Visual Studio 16 2019" -DCMAKE_BUILD_TYPE:STRING=Release
19+
20+
cmake --build . --config "Release"
21+
22+
test_script:
23+
- cmd: ctest -C Debug
24+

0 commit comments

Comments
 (0)