From be8f9900f7428f8d7b952847b98b56c81a0eaa64 Mon Sep 17 00:00:00 2001 From: Hans Johnson Date: Tue, 28 Jan 2025 08:47:57 -0600 Subject: [PATCH] COMP: Remove compiler warnings --- src/PerformanceBenchmarkingInformation.cxx.in | 2 +- test/itkHighPriorityRealTimeProbeTest.cxx | 8 ++++++-- test/itkHighPriorityRealTimeProbesCollectorTest.cxx | 6 ++++-- test/itkTimeProbeTest2.cxx | 9 ++++++--- test/itkTimeProbesTest2.cxx | 6 ++++-- 5 files changed, 21 insertions(+), 10 deletions(-) diff --git a/src/PerformanceBenchmarkingInformation.cxx.in b/src/PerformanceBenchmarkingInformation.cxx.in index 80aa30e..2bee785 100644 --- a/src/PerformanceBenchmarkingInformation.cxx.in +++ b/src/PerformanceBenchmarkingInformation.cxx.in @@ -111,7 +111,7 @@ PerformanceBenchmarkingInformation ::PerformanceBenchmarkingInformation() m_InformationInstance = this; // threads need this m_InformationInstance->UnRegister(); // Remove extra reference - @MAPPING_VALUES@ + @MAPPING_VALUES @ } } // end namespace itk 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; + } } } //-------------------------