Skip to content

Commit cde0c58

Browse files
committed
Merge branch 'release/v2.8.1'
2 parents 2249c91 + 4a32c4f commit cde0c58

File tree

3 files changed

+45
-10
lines changed

3 files changed

+45
-10
lines changed

CMakeLists.txt

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,6 @@ macro(CeleroSetDefaultCompilerOptions)
4141
if(CELERO_TREAT_WARNINGS_AS_ERRORS)
4242
target_compile_options(${PROJECT_NAME} PRIVATE /WX)
4343
endif()
44-
set_target_properties(${PROJECT_NAME} PROPERTIES
45-
ARCHIVE_OUTPUT_NAME "${PROJECT_NAME}$<$<CONFIG:Debug>:d>$<$<BOOL:${CELERO_COMPILE_DYNAMIC_LIBRARIES}>:.dll>")
4644

4745
elseif(${CMAKE_CXX_COMPILER_ID} STREQUAL GNU)
4846
target_compile_options(${PROJECT_NAME} PRIVATE -Wall)
@@ -92,10 +90,8 @@ option(CELERO_TREAT_WARNINGS_AS_ERRORS "Treat compile warnings as errors." ON)
9290

9391
if(CELERO_COMPILE_DYNAMIC_LIBRARIES)
9492
SET(CELERO_USER_DEFINED_SHARED_OR_STATIC "SHARED")
95-
message(STATUS "Celero: Shared lib build")
9693
else()
9794
SET(CELERO_USER_DEFINED_SHARED_OR_STATIC "STATIC")
98-
message(STATUS "Celero: Static lib build")
9995
endif()
10096

10197
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
@@ -107,10 +103,10 @@ set_property(GLOBAL PROPERTY USE_FOLDERS ON)
107103
set(CMAKE_CXX_STANDARD 14)
108104
set(CMAKE_CXX_EXTENSIONS OFF)
109105

110-
set(CMAKE_DEBUG_POSTFIX "d" CACHE STRING "add a postfix, usually d on windows")
111-
set(CMAKE_RELEASE_POSTFIX "" CACHE STRING "add a postfix, usually empty on windows")
112-
set(CMAKE_RELWITHDEBINFO_POSTFIX "" CACHE STRING "add a postfix, usually empty on windows")
113-
set(CMAKE_MINSIZEREL_POSTFIX "" CACHE STRING "add a postfix, usually empty on windows")
106+
set(CMAKE_DEBUG_POSTFIX "-d" CACHE STRING "add a postfix, usually d on windows")
107+
set(CMAKE_RELEASE_POSTFIX "" CACHE STRING "add a postfix, usually empty on windows")
108+
set(CMAKE_RELWITHDEBINFO_POSTFIX "-rd" CACHE STRING "add a postfix, usually empty on windows")
109+
set(CMAKE_MINSIZEREL_POSTFIX "" CACHE STRING "add a postfix, usually empty on windows")
114110

115111
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
116112

experiments/ExperimentSortingRandomIntsUDM/ExperimentSortingRandomIntsUDM.cpp

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,36 @@ class SortFixture : public celero::TestFixture
126126
}
127127
};
128128

129+
/// Used for debugging multiple UDM's
130+
class RandomUDM : public celero::UserDefinedMeasurementTemplate<size_t>
131+
{
132+
std::string getName() const override
133+
{
134+
return "Random";
135+
}
136+
137+
// Turn off some of the output reporting.
138+
bool reportStandardDeviation() const override
139+
{
140+
return false;
141+
}
142+
143+
bool reportSkewness() const override
144+
{
145+
return false;
146+
}
147+
148+
bool reportKurtosis() const override
149+
{
150+
return false;
151+
}
152+
153+
bool reportZScore() const override
154+
{
155+
return false;
156+
}
157+
};
158+
129159
SortFixture()
130160
{
131161
}
@@ -173,17 +203,20 @@ class SortFixture : public celero::TestFixture
173203

174204
this->copyCountUDM->addValue(CopyCountingInt::getCount());
175205
CopyCountingInt::resetCount();
206+
207+
this->randomUDM->addValue(static_cast<size_t>(rand()));
176208
}
177209

178210
std::vector<std::shared_ptr<celero::UserDefinedMeasurement>> getUserDefinedMeasurements() const override
179211
{
180-
return {this->copyCountUDM};
212+
return {this->copyCountUDM, this->randomUDM};
181213
}
182214

183215
std::vector<CopyCountingInt> array;
184216
int64_t arraySize{0};
185217

186218
std::shared_ptr<CopyCountUDM> copyCountUDM{new CopyCountUDM};
219+
std::shared_ptr<RandomUDM> randomUDM{new RandomUDM};
187220
};
188221

189222
static const int SamplesCount = 2000;

src/Memory.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,19 @@
1717
///
1818

1919
#include <celero/Memory.h>
20+
2021
#include <sstream>
2122

2223
#ifdef _WIN32
2324
#include <windows.h>
24-
25+
//
2526
#include <psapi.h>
2627
#elif defined(__APPLE__)
2728
#include <sys/param.h>
2829
#include <sys/sysctl.h>
2930
#include <sys/types.h>
3031
#include <unistd.h>
32+
3133
#include <array>
3234
#include <cstring>
3335
#else
@@ -257,6 +259,8 @@ int64_t celero::GetRAMPhysicalUsedByCurrentProcess()
257259
PROCESS_MEMORY_COUNTERS_EX pmc;
258260
GetProcessMemoryInfo(GetCurrentProcess(), reinterpret_cast<PPROCESS_MEMORY_COUNTERS>(&pmc), sizeof(pmc));
259261
return static_cast<int64_t>(pmc.WorkingSetSize);
262+
#elif defined(__APPLE__)
263+
return -1;
260264
#else
261265
constexpr int BufferSize{128};
262266
int64_t result = 0;
@@ -353,6 +357,8 @@ int64_t celero::GetRAMVirtualUsedByCurrentProcess()
353357
PROCESS_MEMORY_COUNTERS_EX pmc;
354358
GetProcessMemoryInfo(GetCurrentProcess(), reinterpret_cast<PPROCESS_MEMORY_COUNTERS>(&pmc), sizeof(pmc));
355359
return pmc.PrivateUsage;
360+
#elif defined(__APPLE__)
361+
return -1;
356362
#else
357363
// Verified Correct.
358364
constexpr int BufferSize{128};

0 commit comments

Comments
 (0)