diff --git a/.clang-format b/.clang-format
index 411b009..45b9502 100644
--- a/.clang-format
+++ b/.clang-format
@@ -1,4 +1,4 @@
-## This config file is only relevant for clang-format version 8.0.0
+## This config file is only relevant for clang-format version 19.1.4
##
## Examples of each format style can be found on the in the clang-format documentation
## See: https://clang.llvm.org/docs/ClangFormatStyleOptions.html for details of each option
@@ -10,142 +10,309 @@
## maintaining a consistent code style.
##
## EXAMPLE apply code style enforcement before commit:
-# Utilities/Maintenance/clang-format.bash --clang ${PATH_TO_CLANG_FORMAT_8.0.0} --modified
+# Utilities/Maintenance/clang-format.bash --clang ${PATH_TO_CLANG_FORMAT_19.1.4} --modified
## EXAMPLE apply code style enforcement after commit:
-# Utilities/Maintenance/clang-format.bash --clang ${PATH_TO_CLANG_FORMAT_8.0.0} --last
+# Utilities/Maintenance/clang-format.bash --clang ${PATH_TO_CLANG_FORMAT_19.1.4} --last
---
-# This configuration requires clang-format version 8.0.0 exactly.
-BasedOnStyle: Mozilla
+# This configuration requires clang-format version 19.1.4 exactly.
Language: Cpp
AccessModifierOffset: -2
AlignAfterOpenBracket: Align
-AlignConsecutiveAssignments: false
-AlignConsecutiveDeclarations: true
-AlignEscapedNewlines: Right
-AlignOperands: true
-AlignTrailingComments: true
-# clang 9.0 AllowAllArgumentsOnNextLine: true
-# clang 9.0 AllowAllConstructorInitializersOnNextLine: true
+AlignArrayOfStructures: None
+AlignConsecutiveAssignments:
+ Enabled: false
+ AcrossEmptyLines: false
+ AcrossComments: false
+ AlignCompound: false
+ AlignFunctionPointers: false
+ PadOperators: true
+AlignConsecutiveBitFields:
+ Enabled: false
+ AcrossEmptyLines: false
+ AcrossComments: false
+ AlignCompound: false
+ AlignFunctionPointers: false
+ PadOperators: false
+AlignConsecutiveDeclarations:
+ Enabled: true
+ AcrossEmptyLines: false
+ AcrossComments: false
+ AlignCompound: false
+ AlignFunctionPointers: false
+ PadOperators: true
+AlignConsecutiveMacros:
+ Enabled: false
+ AcrossEmptyLines: false
+ AcrossComments: false
+ AlignCompound: false
+ AlignFunctionPointers: false
+ PadOperators: false
+AlignConsecutiveShortCaseStatements:
+ Enabled: false
+ AcrossEmptyLines: false
+ AcrossComments: false
+ AlignCaseArrows: false
+ AlignCaseColons: false
+AlignConsecutiveTableGenBreakingDAGArgColons:
+ Enabled: false
+ AcrossEmptyLines: false
+ AcrossComments: false
+ AlignCompound: false
+ AlignFunctionPointers: false
+ PadOperators: false
+AlignConsecutiveTableGenCondOperatorColons:
+ Enabled: false
+ AcrossEmptyLines: false
+ AcrossComments: false
+ AlignCompound: false
+ AlignFunctionPointers: false
+ PadOperators: false
+AlignConsecutiveTableGenDefinitionColons:
+ Enabled: false
+ AcrossEmptyLines: false
+ AcrossComments: false
+ AlignCompound: false
+ AlignFunctionPointers: false
+ PadOperators: false
+AlignEscapedNewlines: Left
+AlignOperands: Align
+AlignTrailingComments:
+ Kind: Always
+ OverEmptyLines: 0
+AllowAllArgumentsOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: false
-AllowShortBlocksOnASingleLine: false
+AllowBreakBeforeNoexceptSpecifier: Never
+AllowShortBlocksOnASingleLine: Never
+AllowShortCaseExpressionOnASingleLine: true
AllowShortCaseLabelsOnASingleLine: false
-AllowShortFunctionsOnASingleLine: Inline
-# clang 9.0 AllowShortLambdasOnASingleLine: All
-# clang 9.0 features AllowShortIfStatementsOnASingleLine: Never
-AllowShortIfStatementsOnASingleLine: false
+AllowShortCompoundRequirementOnASingleLine: true
+AllowShortEnumsOnASingleLine: true
+#AllowShortFunctionsOnASingleLine: Inline Only merge functions defined inside a class. Implies empty.
+#AllowShortFunctionsOnASingleLine: None (in configuration: None) Never merge functions into a single line.
+AllowShortFunctionsOnASingleLine: All
+AllowShortIfStatementsOnASingleLine: Never
+AllowShortLambdasOnASingleLine: All
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
-AlwaysBreakAfterReturnType: All
AlwaysBreakBeforeMultilineStrings: false
-AlwaysBreakTemplateDeclarations: Yes
+AttributeMacros:
+ - __capability
BinPackArguments: false
BinPackParameters: false
-BreakBeforeBraces: Custom
+BitFieldColonSpacing: Both
BraceWrapping:
- # clang 9.0 feature AfterCaseLabel: false
+ AfterCaseLabel: true
AfterClass: true
- AfterControlStatement: true
+ AfterControlStatement: Always
AfterEnum: true
+ AfterExternBlock: true
AfterFunction: true
AfterNamespace: true
AfterObjCDeclaration: true
AfterStruct: true
AfterUnion: true
- AfterExternBlock: true
BeforeCatch: true
BeforeElse: true
-## This is the big change from historical ITK formatting!
-# Historically ITK used a style similar to https://en.wikipedia.org/wiki/Indentation_style#Whitesmiths_style
-# with indented braces, and not indented code. This style is very difficult to automatically
-# maintain with code beautification tools. Not indenting braces is more common among
-# formatting tools.
+ BeforeLambdaBody: false
+ BeforeWhile: false
IndentBraces: false
SplitEmptyFunction: false
SplitEmptyRecord: false
SplitEmptyNamespace: false
+BreakAdjacentStringLiterals: true
+BreakAfterAttributes: Leave
+BreakAfterJavaFieldAnnotations: false
+BreakAfterReturnType: All
+BreakArrays: true
BreakBeforeBinaryOperators: None
-#clang 6.0 BreakBeforeInheritanceComma: true
-BreakInheritanceList: BeforeComma
+BreakBeforeConceptDeclarations: Always
+BreakBeforeBraces: Custom
+BreakBeforeInlineASMColon: OnlyMultiline
BreakBeforeTernaryOperators: true
-#clang 6.0 BreakConstructorInitializersBeforeComma: true
BreakConstructorInitializers: BeforeComma
-BreakAfterJavaFieldAnnotations: false
+BreakFunctionDefinitionParameters: false
+BreakInheritanceList: BeforeComma
BreakStringLiterals: true
+BreakTemplateDeclarations: Yes
## The following line allows larger lines in non-documentation code
ColumnLimit: 120
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
-ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 2
ContinuationIndentWidth: 2
Cpp11BracedListStyle: false
DerivePointerAlignment: false
DisableFormat: false
+EmptyLineAfterAccessModifier: Never
+EmptyLineBeforeAccessModifier: LogicalBlock
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
+IfMacros:
+ - KJ_IF_MAYBE
IncludeBlocks: Preserve
IncludeCategories:
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
Priority: 2
+ SortPriority: 0
+ CaseSensitive: false
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
Priority: 3
+ SortPriority: 0
+ CaseSensitive: false
- Regex: '.*'
Priority: 1
+ SortPriority: 0
+ CaseSensitive: false
IncludeIsMainRegex: '(Test)?$'
+IncludeIsMainSourceRegex: ''
+IndentAccessModifiers: false
+IndentCaseBlocks: false
IndentCaseLabels: true
+IndentExternBlock: AfterExternBlock
+IndentGotoLabels: true
IndentPPDirectives: AfterHash
+IndentRequiresClause: true
IndentWidth: 2
IndentWrappedFunctionNames: false
+InsertBraces: false
+InsertNewlineAtEOF: false
+InsertTrailingCommas: None
+IntegerLiteralSeparator:
+ Binary: 0
+ BinaryMinDigits: 0
+ Decimal: 0
+ DecimalMinDigits: 0
+ Hex: 0
+ HexMinDigits: 0
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
-KeepEmptyLinesAtTheStartOfBlocks: true
+KeepEmptyLines:
+ AtEndOfFile: false
+ AtStartOfBlock: true
+ AtStartOfFile: true
+LambdaBodyIndentation: Signature
+LineEnding: DeriveLF
MacroBlockBegin: ''
MacroBlockEnd: ''
+MainIncludeChar: Quote
MaxEmptyLinesToKeep: 2
NamespaceIndentation: None
ObjCBinPackProtocolList: Auto
ObjCBlockIndentWidth: 2
+ObjCBreakBeforeNestedBlockParam: true
ObjCSpaceAfterProperty: true
ObjCSpaceBeforeProtocolList: false
+PackConstructorInitializers: BinPack
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
## The following line allows larger lines in non-documentation code
PenaltyBreakFirstLessLess: 120
+PenaltyBreakOpenParenthesis: 0
+PenaltyBreakScopeResolution: 500
PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
+PenaltyIndentedWhitespace: 0
PenaltyReturnTypeOnItsOwnLine: 200
PointerAlignment: Middle
+PPIndentWidth: -1
+QualifierAlignment: Custom
+QualifierOrder:
+ - friend
+ - static
+ - inline
+ - constexpr
+ - const
+ - type
+ReferenceAlignment: Pointer
ReflowComments: true
+RemoveBracesLLVM: false
+RemoveParentheses: Leave
+RemoveSemicolon: false
+RequiresClausePosition: OwnLine
+RequiresExpressionIndentation: OuterScope
+SeparateDefinitionBlocks: Leave
+ShortNamespaceLines: 1
+SkipMacroDefinitionBody: false
# We may want to sort the includes as a separate pass
-SortIncludes: false
+SortIncludes: Never
+SortJavaStaticImport: Before
# We may want to revisit this later
-SortUsingDeclarations: false
+SortUsingDeclarations: Never
SpaceAfterCStyleCast: false
-# SpaceAfterLogicalNot: false
+SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: true
+SpaceAroundPointerQualifiers: Default
SpaceBeforeAssignmentOperators: true
+SpaceBeforeCaseColon: false
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
+SpaceBeforeJsonColon: false
SpaceBeforeParens: ControlStatements
+SpaceBeforeParensOptions:
+ AfterControlStatements: true
+ AfterForeachMacros: true
+ AfterFunctionDefinitionName: false
+ AfterFunctionDeclarationName: false
+ AfterIfMacros: true
+ AfterOverloadedOperator: false
+ AfterPlacementOperator: true
+ AfterRequiresInClause: false
+ AfterRequiresInExpression: false
+ BeforeNonEmptyParentheses: false
SpaceBeforeRangeBasedForLoopColon: true
-SpaceInEmptyParentheses: false
+SpaceBeforeSquareBrackets: false
+SpaceInEmptyBlock: false
SpacesBeforeTrailingComments: 1
-SpacesInAngles: false
+SpacesInAngles: Never
SpacesInContainerLiterals: false
-SpacesInCStyleCastParentheses: false
-SpacesInParentheses: false
+SpacesInLineCommentPrefix:
+ Minimum: 1
+ Maximum: -1
+SpacesInParens: Never
+SpacesInParensOptions:
+ ExceptDoubleParentheses: false
+ InCStyleCasts: false
+ InConditionalStatements: false
+ InEmptyParentheses: false
+ Other: false
SpacesInSquareBrackets: false
-Standard: Cpp11
+Standard: Latest
+StatementAttributeLikeMacros:
+ - Q_EMIT
StatementMacros:
- Q_UNUSED
- QT_REQUIRE_VERSION
+ - ITK_GCC_PRAGMA_PUSH
+ - ITK_GCC_PRAGMA_POP
+ - ITK_GCC_SUPPRESS_Wfloat_equal
+ - ITK_GCC_SUPPRESS_Wformat_nonliteral
+ - ITK_GCC_SUPPRESS_Warray_bounds
+ - ITK_CLANG_PRAGMA_PUSH
+ - ITK_CLANG_PRAGMA_POP
+ - ITK_CLANG_SUPPRESS_Wzero_as_null_pointer_constant
+ - CLANG_PRAGMA_PUSH
+ - CLANG_PRAGMA_POP
+ - CLANG_SUPPRESS_Wfloat_equal
+ - INTEL_PRAGMA_WARN_PUSH
+ - INTEL_PRAGMA_WARN_POP
+ - INTEL_SUPPRESS_warning_1292
+ - itkTemplateFloatingToIntegerMacro
+ - itkLegacyMacro
+TableGenBreakInsideDAGArg: DontBreak
TabWidth: 2
UseTab: Never
+VerilogBreakBetweenInstancePorts: true
+WhitespaceSensitiveMacros:
+ - BOOST_PP_STRINGIZE
+ - CF_SWIFT_NAME
+ - NS_SWIFT_NAME
+ - PP_STRINGIZE
+ - STRINGIZE
...
diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test-package.yml
similarity index 81%
rename from .github/workflows/build-test.yml
rename to .github/workflows/build-test-package.yml
index e6db193..9f846aa 100644
--- a/.github/workflows/build-test.yml
+++ b/.github/workflows/build-test-package.yml
@@ -1,38 +1,46 @@
name: Build, test, package
-on: [push,pull_request]
+on:
+ push:
+ branches:
+ - main
+ tags:
+ - 'v*'
+ pull_request:
+ branches:
+ - main
jobs:
- build-test-cxx:
+ cxx-build-workflow:
runs-on: ${{ matrix.os }}
strategy:
max-parallel: 3
matrix:
- os: [ubuntu-18.04, windows-2019, macos-10.15]
+ os: [ubuntu-24.04, windows-2022, macos-10.15]
include:
- - os: ubuntu-18.04
+ - os: ubuntu-24.04
c-compiler: "gcc"
cxx-compiler: "g++"
- itk-git-tag: "d6acfd26bfcdec606d605beb1301bddfb17c05a6"
+ itk-git-tag: "v6.0a02"
cmake-build-type: "MinSizeRel"
- - os: windows-2019
+ - os: windows-2022
c-compiler: "cl.exe"
cxx-compiler: "cl.exe"
- itk-git-tag: "d6acfd26bfcdec606d605beb1301bddfb17c05a6"
+ itk-git-tag: "v6.0a02"
cmake-build-type: "Release"
- os: macos-10.15
c-compiler: "clang"
cxx-compiler: "clang++"
- itk-git-tag: "d6acfd26bfcdec606d605beb1301bddfb17c05a6"
+ itk-git-tag: "v6.0a02"
cmake-build-type: "MinSizeRel"
steps:
- - uses: actions/checkout@v1
+ - uses: actions/checkout@v4
- - name: Set up Python 3.7
- uses: actions/setup-python@v1
+ - name: Set up Python 3.12
+ uses: actions/setup-python@v5
with:
- python-version: 3.7
+ python-version: 3.12
- name: Install build dependencies
run: |
@@ -40,7 +48,7 @@ jobs:
python -m pip install ninja
- name: Get specific version of CMake, Ninja
- uses: lukka/get-cmake@v3.18.3
+ uses: lukka/get-cmake@3.31.5
- name: Download ITK
run: |
@@ -50,7 +58,7 @@ jobs:
git checkout ${{ matrix.itk-git-tag }}
- name: Build ITK
- if: matrix.os != 'windows-2019'
+ if: matrix.os != 'windows-2022'
run: |
cd ..
mkdir ITK-build
@@ -59,12 +67,12 @@ jobs:
ninja
- name: Build ITK
- if: matrix.os == 'windows-2019'
+ if: matrix.os == 'windows-2022'
run: |
cd ..
mkdir ITK-build
cd ITK-build
- call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
+ call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
cmake -DCMAKE_C_COMPILER:FILEPATH="${{ matrix.c-compiler }}" -DBUILD_SHARED_LIBS:BOOL=OFF -DCMAKE_CXX_COMPILER="${{ matrix.cxx-compiler }}" -DCMAKE_BUILD_TYPE:STRING=${{ matrix.cmake-build-type }} -DBUILD_TESTING:BOOL=OFF -GNinja ../ITK
ninja
shell: cmd
@@ -118,13 +126,13 @@ jobs:
cat dashboard.cmake
- name: Build and test
- if: matrix.os != 'windows-2019'
+ if: matrix.os != 'windows-2022'
run: |
ctest --output-on-failure -j 2 -V -S dashboard.cmake
- name: Build and test
- if: matrix.os == 'windows-2019'
+ if: matrix.os == 'windows-2022'
run: |
- call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
+ call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
ctest --output-on-failure -j 2 -VV -S dashboard.cmake
shell: cmd
diff --git a/.github/workflows/clang-format-linter.yml b/.github/workflows/clang-format-linter.yml
index 69166d9..c8e1681 100644
--- a/.github/workflows/clang-format-linter.yml
+++ b/.github/workflows/clang-format-linter.yml
@@ -7,7 +7,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v1
+ - uses: actions/checkout@v4
with:
fetch-depth: 1
- uses: InsightSoftwareConsortium/ITKClangFormatLinterAction@master
+ with:
+ itk-branch: master
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5bf84c4..3ee999f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,7 +1,9 @@
-cmake_minimum_required(VERSION 3.16.3)
+cmake_minimum_required(VERSION 3.22.1)
+# Need to set CMAKE_CXX_STANDARD, CMAKE_CXX_STANDARD_REQUIRED, CMAKE_CXX_EXTENSIONS
+# before calling project to ensure that it is available globally within your CMake project.
if(NOT CMAKE_CXX_STANDARD)
- set(CMAKE_CXX_STANDARD 14) # Supported values are ``14``, ``17`` and ``20``.
+ set(CMAKE_CXX_STANDARD 17) # Supported values are ``14``, ``17`` and ``20``.
endif()
if(NOT CMAKE_CXX_STANDARD_REQUIRED)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
@@ -10,9 +12,17 @@ if(NOT CMAKE_CXX_EXTENSIONS)
set(CMAKE_CXX_EXTENSIONS OFF)
endif()
-## If building external to ITK, we need to capture
-## required build setting from ITK prior to calling
-## project()
+
+project(PerformanceBenchmarking
+ VERSION 0.9.0
+ DESCRIPTION
+ "Real-world tests to benchmark ITK performance."
+ HOMEPAGE_URL "https://github.com/InsightSoftwareConsortium/ITKPerformanceBenchmarking"
+ LANGUAGES CXX C
+)
+
+set(PerformanceBenchmarking_LIBRARIES PerformanceBenchmarking)
+
if(NOT ITK_SOURCE_DIR)
find_package(ITK REQUIRED)
list(APPEND CMAKE_MODULE_PATH ${ITK_CMAKE_DIR})
@@ -27,7 +37,6 @@ if(NOT ITK_SOURCE_DIR)
endif()
endforeach()
-
# Set a default build type if none was specified
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "Setting build type to 'Release' as none was specified.")
@@ -35,19 +44,12 @@ if(NOT ITK_SOURCE_DIR)
# Set the possible values of build type for cmake-gui
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
endif()
- enable_language(C)
- enable_language(CXX)
-endif()
-project(PerformanceBenchmarking)
-
-set(PerformanceBenchmarking_LIBRARIES PerformanceBenchmarking)
-
-include_directories(${CMAKE_BINARY_DIR})
-if(NOT ITK_SOURCE_DIR)
include(ITKModuleExternal)
else()
set(ITK_DIR ${CMAKE_BINARY_DIR})
itk_module_impl()
endif()
-add_subdirectory(examples)
+
+itk_module_examples() # This builds the src directory
+add_subdirectory(examples) # this builds each of the itk benchmark domains
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..7dbb467
--- /dev/null
+++ b/README.md
@@ -0,0 +1,90 @@
+# PerformanceBenchmarking
+
+image:: https://github.com/InsightSoftwareConsortium/ITKPerformanceBenchmarking/workflows/Build,%20test,%20package/badge.svg
+
+[](https://github.com/InsightSoftwareConsortium/PerformanceBenchmarking/actions/workflows/build-test-package.yml)
+
+[](https://pypi.python.org/pypi/itk-PerformanceBenchmarking)
+
+[](https://github.com/InsightSoftwareConsortium/PerformanceBenchmarking/blob/main/LICENSE)
+
+## Overview
+
+Real-world tests to benchmark ITK performance.
+
+New classes increase operating system process priority to
+minimize the impact of other processes running on the system.
+
+These classes are used by a suite of example ITK benchmarks to quantify toolkit
+performance.
+
+For more information, see::
+
+```txt
+ McCormick M., Kang H.J., Barre S.
+ Performance Benchmarking the Insight Toolkit
+ The Insight Journal. January-December. 2016.
+ https://hdl.handle.net/10380/3557
+ https://insight-journal.org/browse/publication/972
+```
+
+Since ITK 4.11.0, this module is available in the ITK source tree as a Remote
+module. To enable it, set::
+
+ Module_PerformanceBenchmarking:BOOL=ON
+
+in ITK's CMake build configuration.
+
+Requirements
+------------
+- `CMake `_
+- `Ninja `_
+- `Python `_
+
+Notes for running the benchmarks
+--------------------------------
+
+An example to call the benchmarking script is::
+
+ $ python ./evaluate-itk-performance.py run -g {ITK-version} {ITK-source} {ITK-build} {ITKPerformanceBenchmarking-build}
+
+where ``{ITK-version}`` is the ITK version that the user wishes to evaluate.
+
+Also, note that the ITK source folder ``(ITK-source}``, where the specific
+version is fetched, needs to exist.
+
+The generated/result ``JSON`` files are placed in::
+
+ ./{ITKPerformanceBenchmarking-build}/BenchmarkResults/{machine-name}
+
+
+Notes for benchmarking in Windows
+---------------------------------
+
+**CMake** and **Ninja** need to be in the ``PATH``. Also, the **C++ compiler**
+has to be in the ``PATH`` so that Ninja can find it.
+
+For the Microsoft Visual Studio compiler, the C++ compiler is a file that is
+usually under::
+
+ C:/Program Files/Microsoft Visual Studio {version}/VC/bin/cl.exe
+
+The user will need to change the path to the *vcvars\*.bat* command file in the
+`RunWithVisualStudio.cmd `_ command line script to the specific location of their
+*vcvars* file, e.g.::
+
+ C:/Program Files/Microsoft Visual Studio {version}/VC/vcvarsall.bat
+
+Finally, the user will need to start the Git bash by double-clicking on the
+``RunWithVisualStudio.cmd`` script.
+
+Note that the module is built with static libraries to allow for ITK
+benchmarking in Windows: the ``BUILD_SHARED_LIBS`` flag in the
+`evaluate-itk-performance.py `_ script is set to `OFF`.
+
+
+License
+-------
+
+This software is distributed under the Apache 2.0 license. Please see
+the *LICENSE* file for details.
diff --git a/README.rst b/README.rst
index e9c41de..79d9034 100644
--- a/README.rst
+++ b/README.rst
@@ -1,7 +1,6 @@
ITKPerformanceBenchmarking
-==========================
-.. image:: https://github.com/InsightSoftwareConsortium/ITKPerformanceBenchmarking/workflows/Build,%20test,%20package/badge.svg
+image:: https://github.com/InsightSoftwareConsortium/ITKPerformanceBenchmarking/workflows/Build,%20test,%20package/badge.svg
Real-world tests to benchmark ITK performance.
@@ -11,13 +10,15 @@ minimize the impact of other processes running on the system.
These classes are used by a suite of example ITK benchmarks to quantify toolkit
performance.
-For more information, see the `Insight Journal article `_::
+For more information, see::
+```txt
McCormick M., Kang H.J., Barre S.
Performance Benchmarking the Insight Toolkit
The Insight Journal. January-December. 2016.
https://hdl.handle.net/10380/3557
https://insight-journal.org/browse/publication/972
+```
Since ITK 4.11.0, this module is available in the ITK source tree as a Remote
module. To enable it, set::
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
index fb45bad..7cbed82 100644
--- a/examples/CMakeLists.txt
+++ b/examples/CMakeLists.txt
@@ -1,5 +1,11 @@
-cmake_minimum_required(VERSION 3.10.2)
-project(ITKBenchmarks NONE)
+cmake_minimum_required(VERSION 3.22.1)
+project(ITKBenchmarks
+ VERSION 0.9.0
+ DESCRIPTION
+ "Benchmarks performance."
+ HOMEPAGE_URL "https://github.com/InsightSoftwareConsortium/ITKPerformanceBenchmarking"
+ LANGUAGES CXX C
+)
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/CMake ${CMAKE_MODULE_PATH})
include(ITKBenchmarksExternalData)
diff --git a/examples/Filtering/ResampleBenchmark.cxx b/examples/Filtering/ResampleBenchmark.cxx
index ef99084..5e8961b 100644
--- a/examples/Filtering/ResampleBenchmark.cxx
+++ b/examples/Filtering/ResampleBenchmark.cxx
@@ -372,13 +372,13 @@ DefineInterpolator(typename InterpolatorType::Pointer & interpolator,
{
// Interpolator typedefs
using InputImageType = typename InterpolatorType::InputImageType;
- using CoordRepType = typename InterpolatorType::CoordRepType;
- using CoefficientType = CoordRepType;
+ using CoordinateType = typename InterpolatorType::CoordinateType;
+ using CoefficientType = CoordinateType;
// Typedefs for all interpolators
- using NearestNeighborInterpolatorType = itk::NearestNeighborInterpolateImageFunction;
- using LinearInterpolatorType = itk::LinearInterpolateImageFunction;
- using BSplineInterpolatorType = itk::BSplineInterpolateImageFunction;
+ using NearestNeighborInterpolatorType = itk::NearestNeighborInterpolateImageFunction;
+ using LinearInterpolatorType = itk::LinearInterpolateImageFunction;
+ using BSplineInterpolatorType = itk::BSplineInterpolateImageFunction;
if (interpolatorName == "Nearest")
{
@@ -402,10 +402,10 @@ DefineExtrapolator(typename ExtrapolatorType::Pointer & extrapolator, const std:
{
// Extrapolator typedefs
using InputImageType = typename ExtrapolatorType::InputImageType;
- using CoordRepType = typename ExtrapolatorType::CoordRepType;
+ using CoordinateType = typename ExtrapolatorType::CoordinateType;
// Typedefs for all extrapolators
- using NearestNeighborExtrapolatorType = itk::NearestNeighborExtrapolateImageFunction;
+ using NearestNeighborExtrapolatorType = itk::NearestNeighborExtrapolateImageFunction;
if (extrapolatorName == "Nearest")
{
diff --git a/include/PerformanceBenchmarkingUtilities.h b/include/PerformanceBenchmarkingUtilities.h
index e3f8e40..480a870 100644
--- a/include/PerformanceBenchmarkingUtilities.h
+++ b/include/PerformanceBenchmarkingUtilities.h
@@ -25,7 +25,7 @@ PerformanceBenchmarking_EXPORT std::string
PerfDateStamp();
PerformanceBenchmarking_EXPORT std::string
- ReplaceOccurrence(std::string str, const std::string && findvalue, const std::string && replacevalue);
+ReplaceOccurrence(std::string str, const std::string && findvalue, const std::string && replacevalue);
PerformanceBenchmarking_EXPORT std::string
DecorateWithBuildInformation(std::string inputJson);
diff --git a/include/itkHighPriorityRealTimeClock.h b/include/itkHighPriorityRealTimeClock.h
index 9ede344..62d62e5 100644
--- a/include/itkHighPriorityRealTimeClock.h
+++ b/include/itkHighPriorityRealTimeClock.h
@@ -46,7 +46,7 @@ class PerformanceBenchmarking_EXPORT HighPriorityRealTimeClock : public RealTime
using ConstPointer = SmartPointer;
/** Method for defining the name of the class */
- itkTypeMacro(HighPriorityRealTimeClock, RealTimeClock);
+ itkOverrideGetNameOfClassMacro(HighPriorityRealTimeClock);
/** Method for creation through the object factory */
itkNewMacro(Self);
diff --git a/include/jsonxx.h b/include/jsonxx.h
index 4b5a8ca..f70e369 100644
--- a/include/jsonxx.h
+++ b/include/jsonxx.h
@@ -35,19 +35,19 @@
#ifdef _MSC_VER
// disable the C4127 warning if using VC, see https://stackoverflow.com/a/12042515
-# define JSONXX_ASSERT(...) \
- do \
- { \
- __pragma(warning(push)) __pragma(warning(disable : 4127)) if (jsonxx::Assertions) __pragma(warning(pop)) \
- jsonxx::assertion(__FILE__, __LINE__, #__VA_ARGS__, bool(__VA_ARGS__)); \
- __pragma(warning(push)) __pragma(warning(disable : 4127)) \
+# define JSONXX_ASSERT(...) \
+ do \
+ { \
+ __pragma(warning(push)) __pragma(warning(disable : 4127)) if (jsonxx::Assertions) __pragma(warning(pop)) \
+ jsonxx::assertion(__FILE__, __LINE__, #__VA_ARGS__, bool(__VA_ARGS__)); \
+ __pragma(warning(push)) __pragma(warning(disable : 4127)) \
} while (0) __pragma(warning(pop))
#else
-# define JSONXX_ASSERT(...) \
- do \
- { \
- if (jsonxx::Assertions) \
- jsonxx::assertion(__FILE__, __LINE__, #__VA_ARGS__, bool(__VA_ARGS__)); \
+# define JSONXX_ASSERT(...) \
+ do \
+ { \
+ if (jsonxx::Assertions) \
+ jsonxx::assertion(__FILE__, __LINE__, #__VA_ARGS__, bool(__VA_ARGS__)); \
} while (0)
#endif
@@ -316,12 +316,12 @@ class Value
type_ = BOOL_;
bool_value_ = b;
}
-#define local_number(TYPE) \
- void import(const TYPE & n) \
- { \
- reset(); \
- type_ = NUMBER_; \
- number_value_ = static_cast(n); \
+#define local_number(TYPE) \
+ void import(const TYPE & n) \
+ { \
+ reset(); \
+ type_ = NUMBER_; \
+ number_value_ = static_cast(n); \
}
local_number(char) local_number(int) local_number(long) local_number(long long) local_number(unsigned char)
local_number(unsigned int) local_number(unsigned long) local_number(unsigned long long) local_number(float)
diff --git a/itk-module.cmake b/itk-module.cmake
index fce496c..c250701 100644
--- a/itk-module.cmake
+++ b/itk-module.cmake
@@ -1,4 +1,10 @@
-set(DOCUMENTATION "New classes increase operating system process priority to
+# the top-level README is used for describing this module, just
+# re-used it for documentation here
+get_filename_component(MY_CURRENT_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
+file(READ "${MY_CURRENT_DIR}/README.md" DOCUMENTATION)
+
+set(DOCUMENTATION
+ "New classes increase operating system process priority to
minimize the impact of other processes running on the system.
These classes are used by a used by a suite of example ITK benchmarks to
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 42f1005..aee7ed4 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -53,7 +53,7 @@ set(MAPPING_VALUES "
")
configure_file(PerformanceBenchmarkingInformation.cxx.in ${CMAKE_BINARY_DIR}/PerformanceBenchmarkingInformation.cxx)
-configure_file(PerformanceBenchmarkingInformation.h.in ${CMAKE_BINARY_DIR}/PerformanceBenchmarkingInformation.h)
+configure_file(PerformanceBenchmarkingInformation.h.in ${CMAKE_BINARY_DIR}/include/PerformanceBenchmarkingInformation.h)
set( PerformanceBenchmarking_SRCS
jsonxx.cc ## MIT License https://github.com/hjiang/jsonxx
@@ -62,7 +62,7 @@ set( PerformanceBenchmarking_SRCS
itkHighPriorityRealTimeProbe.cxx
itkHighPriorityRealTimeProbesCollector.cxx
PerformanceBenchmarkingUtilities.cxx
- ${CMAKE_BINARY_DIR}/PerformanceBenchmarkingInformation.h)
+ ${CMAKE_BINARY_DIR}/include/PerformanceBenchmarkingInformation.h)
if(MSVC)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
diff --git a/src/PerformanceBenchmarkingInformation.cxx.in b/src/PerformanceBenchmarkingInformation.cxx.in
index 78ea883..80aa30e 100644
--- a/src/PerformanceBenchmarkingInformation.cxx.in
+++ b/src/PerformanceBenchmarkingInformation.cxx.in
@@ -31,37 +31,32 @@
// Construct const versions via the emplace method. This macro simplifies the text
// written in ITK/Modules/Core/Common/src/CMakeLists.txt.
-#define MAKE_MAP_ENTRY(KEY, VALUE, DESCRIPTION ) \
-m_Map.emplace( \
- std::pair< MapKeyType, InformationValueType>( \
- MapKeyType{ KEY }, \
- InformationValueType{ MapValueType{ VALUE }, MapValueDescriptionType{ DESCRIPTION } } \
- ) \
-)
+#define MAKE_MAP_ENTRY(KEY, VALUE, DESCRIPTION) \
+ m_Map.emplace(std::pair( \
+ MapKeyType{ KEY }, InformationValueType{ MapValueType{ VALUE }, MapValueDescriptionType{ DESCRIPTION } }))
-namespace itk {
+namespace itk
+{
-std::mutex PerformanceBenchmarkingInformation::m_Mutex;
+std::mutex PerformanceBenchmarkingInformation::m_Mutex;
PerformanceBenchmarkingInformation::Pointer PerformanceBenchmarkingInformation::m_InformationInstance;
PerformanceBenchmarkingInformation::MapType PerformanceBenchmarkingInformation::m_Map;
PerformanceBenchmarkingInformation::Pointer
-PerformanceBenchmarkingInformation
-::New()
+PerformanceBenchmarkingInformation ::New()
{
return Self::GetInstance();
}
PerformanceBenchmarkingInformation::Pointer
-PerformanceBenchmarkingInformation
-::GetInstance()
+PerformanceBenchmarkingInformation ::GetInstance()
{
std::lock_guard mutexHolder(m_Mutex);
if (m_InformationInstance.IsNull())
{
m_InformationInstance = ObjectFactory::Create();
{
- new PerformanceBenchmarkingInformation(); //constructor sets m_InformationInstance
+ new PerformanceBenchmarkingInformation(); // constructor sets m_InformationInstance
}
}
return m_InformationInstance;
@@ -74,50 +69,49 @@ PerformanceBenchmarkingInformation::GetMap()
}
const PerformanceBenchmarkingInformation::MapValueType
-PerformanceBenchmarkingInformation::GetValue(const MapKeyType &&key)
+PerformanceBenchmarkingInformation::GetValue(const MapKeyType && key)
{
- const MapType &localMap = PerformanceBenchmarkingInformation::GetInstance()->GetMap();
+ const MapType & localMap = PerformanceBenchmarkingInformation::GetInstance()->GetMap();
auto it = localMap.find(key);
if (it != localMap.end())
{
return it->second.m_Value;
}
- return {""};
+ return { "" };
}
const PerformanceBenchmarkingInformation::MapValueDescriptionType
PerformanceBenchmarkingInformation::GetDescription(const MapKeyType && key)
{
- const MapType &localMap = PerformanceBenchmarkingInformation::GetInstance()->GetMap();
+ const MapType & localMap = PerformanceBenchmarkingInformation::GetInstance()->GetMap();
auto it = localMap.find(key);
if (it != localMap.end())
{
return it->second.m_Description;
}
- return {""};
+ return { "" };
}
-const std::vector< PerformanceBenchmarkingInformation::MapKeyType >
+const std::vector
PerformanceBenchmarkingInformation::GetAllKeys()
{
- std::vector< PerformanceBenchmarkingInformation::MapKeyType > keyVector;
+ std::vector keyVector;
keyVector.reserve(30);
- for( auto elem : PerformanceBenchmarkingInformation::GetInstance()->m_Map )
+ for (auto elem : PerformanceBenchmarkingInformation::GetInstance()->m_Map)
{
- keyVector.emplace_back( elem.first );
+ keyVector.emplace_back(elem.first);
}
return keyVector;
}
-PerformanceBenchmarkingInformation
-::PerformanceBenchmarkingInformation()
+PerformanceBenchmarkingInformation ::PerformanceBenchmarkingInformation()
{
- m_InformationInstance = this; //threads need this
+ m_InformationInstance = this; // threads need this
m_InformationInstance->UnRegister(); // Remove extra reference
@MAPPING_VALUES@
}
-} //end namespace itk
+} // end namespace itk
diff --git a/src/PerformanceBenchmarkingInformation.h.in b/src/PerformanceBenchmarkingInformation.h.in
index ccd473e..af6f167 100644
--- a/src/PerformanceBenchmarkingInformation.h.in
+++ b/src/PerformanceBenchmarkingInformation.h.in
@@ -82,7 +82,7 @@ public:
using MapType = std::map;
/** Run-time type information (and related methods). */
- itkTypeMacro(PerformanceBenchmarkingInformation, Object);
+ itkOverrideGetNameOfClassMacro(PerformanceBenchmarkingInformation);
/** Returns the global instance */
static Pointer New();
diff --git a/src/itkHighPriorityRealTimeClock.cxx b/src/itkHighPriorityRealTimeClock.cxx
index 53df7c4..ec4f406 100644
--- a/src/itkHighPriorityRealTimeClock.cxx
+++ b/src/itkHighPriorityRealTimeClock.cxx
@@ -49,16 +49,10 @@ HighPriorityRealTimeClock ::DisplayErrorMessage()
}
-HighPriorityRealTimeClock ::HighPriorityRealTimeClock()
-{
- this->RaisePriority();
-}
+HighPriorityRealTimeClock ::HighPriorityRealTimeClock() { this->RaisePriority(); }
-HighPriorityRealTimeClock ::~HighPriorityRealTimeClock()
-{
- this->RestorePriority();
-}
+HighPriorityRealTimeClock ::~HighPriorityRealTimeClock() { this->RestorePriority(); }
void
diff --git a/test/itkHighPriorityRealTimeProbeTest.cxx b/test/itkHighPriorityRealTimeProbeTest.cxx
index 87fb428..f01df7a 100644
--- a/test/itkHighPriorityRealTimeProbeTest.cxx
+++ b/test/itkHighPriorityRealTimeProbeTest.cxx
@@ -67,13 +67,17 @@ itkHighPriorityRealTimeProbeTest(int, char *[])
// time a task
localTimer.Start();
- double sum = 0.0;
- for (unsigned int i = 0; i < 1e6; ++i)
+ double sum = 0.0;
+ constexpr unsigned int big_stopping_criteria = 1e6;
+ for (unsigned int i = 0; i < big_stopping_criteria; ++i)
{
sum += i;
}
localTimer.Stop();
+ // Need to use the variable sum to ensure that it is not optimized away.
+ std::cout << " Time for simple addition summing loop with " << big_stopping_criteria
+ << " iterations: " << localTimer.GetMean() << " sum = (" << sum << ")\n";
}
if (!CheckTimeProbe(localTimer))
diff --git a/test/itkHighPriorityRealTimeProbesCollectorTest.cxx b/test/itkHighPriorityRealTimeProbesCollectorTest.cxx
index 4ebe345..a01390f 100644
--- a/test/itkHighPriorityRealTimeProbesCollectorTest.cxx
+++ b/test/itkHighPriorityRealTimeProbesCollectorTest.cxx
@@ -63,11 +63,13 @@ TestTransformPhysicalPointToIndex(T * image)
for (int i = 0; i < 1000; i++)
{
point3D[0] = static_cast::ValueType>(i);
- image->TransformPhysicalPointToIndex(point3D, index3D);
+ index3D = image->TransformPhysicalPointToIndex(point3D);
}
}
if (k == 5)
- std::cout << point3D << std::endl;
+ {
+ std::cout << point3D << " at " << index3D << std::endl;
+ }
}
}
//-------------------------
diff --git a/test/itkTimeProbeTest2.cxx b/test/itkTimeProbeTest2.cxx
index 104a8ea..fac368b 100644
--- a/test/itkTimeProbeTest2.cxx
+++ b/test/itkTimeProbeTest2.cxx
@@ -69,13 +69,16 @@ itkTimeProbeTest2(int, char *[])
// time a task
localTimer.Start();
- double sum = 0.0;
- for (unsigned int i = 0; i < 1e6; ++i)
+ double sum = 0.0;
+ constexpr unsigned int big_stopping_criteria = 1e6;
+ for (unsigned int i = 0; i < big_stopping_criteria; ++i)
{
sum += i;
}
-
localTimer.Stop();
+ // Need to use the variable sum to ensure that it is not optimized away.
+ std::cout << " Time for simple addition summing loop with " << big_stopping_criteria
+ << " iterations: " << localTimer.GetMean() << " sum = (" << sum << ")\n";
}
if (!CheckTimeProbe(localTimer))
diff --git a/test/itkTimeProbesTest2.cxx b/test/itkTimeProbesTest2.cxx
index 43068a1..847031d 100644
--- a/test/itkTimeProbesTest2.cxx
+++ b/test/itkTimeProbesTest2.cxx
@@ -62,11 +62,13 @@ TestTransformPhysicalPointToIndex(T * image)
for (int i = 0; i < 1000; i++)
{
point3D[0] = static_cast::ValueType>(i);
- image->TransformPhysicalPointToIndex(point3D, index3D);
+ index3D = image->TransformPhysicalPointToIndex(point3D);
}
}
if (k == 5)
- std::cout << point3D << std::endl;
+ {
+ std::cout << point3D << " at " << index3D << std::endl;
+ }
}
}
//-------------------------