Skip to content

Commit

Permalink
Merge branch 'release/v2.8.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
DigitalInBlue committed Mar 20, 2021
2 parents b9bbe63 + 38a3495 commit 2249c91
Show file tree
Hide file tree
Showing 10 changed files with 207 additions and 120 deletions.
21 changes: 18 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ addons:
- g++-6
- g++-7
- g++-8
- g++-9

sources: &sources
- ubuntu-toolchain-r-test
Expand All @@ -37,6 +38,7 @@ cache:
- ${TRAVIS_BUILD_DIR}/deps/llvm-5.0.1
- ${TRAVIS_BUILD_DIR}/deps/llvm-7.0.0
- ${TRAVIS_BUILD_DIR}/deps/llvm-8.0.0
- ${TRAVIS_BUILD_DIR}/deps/llvm-9.0.0

matrix:
exclude:
Expand Down Expand Up @@ -67,7 +69,12 @@ matrix:

# Clang 8.0.0
- os: linux
env: LLVM_VERSION=7.0.0 CMAKE_OPTIONS=""
env: LLVM_VERSION=8.0.0 CMAKE_OPTIONS=""
compiler: clang

# Clang 9.0.0
- os: linux
env: LLVM_VERSION=9.0.0 CMAKE_OPTIONS=""
compiler: clang

# GCC 6
Expand All @@ -85,10 +92,15 @@ matrix:
env: COMPILER=g++-8 CMAKE_OPTIONS=""
compiler: gcc

# GCC 8
# GCC 9
- os: linux
env: COMPILER=g++-9 CMAKE_OPTIONS=""
compiler: gcc

# GCC 9
- os: linux
name: Complete Build
env: COMPILER=g++-8 CMAKE_OPTIONS="-DCELERO_ENABLE_EXPERIMENTS=1"
env: COMPILER=g++-9 CMAKE_OPTIONS="-DCELERO_ENABLE_EXPERIMENTS=1"
compiler: gcc

##########################################################################
Expand All @@ -110,6 +122,9 @@ matrix:
- os: osx
osx_image: xcode11

- os: osx
osx_image: xcode12

before_install:
- git submodule update --init --recursive

Expand Down
7 changes: 6 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,15 @@ macro(CeleroSetDefaultCompilerOptions)
target_compile_options(${PROJECT_NAME} PRIVATE /MP)
target_compile_options(${PROJECT_NAME} PRIVATE /D_SCL_SECURE_NO_WARNINGS)
target_compile_options(${PROJECT_NAME} PRIVATE /permissive-)
if (NOT CELERO_COMPILE_DYNAMIC_LIBRARIES)
target_compile_options(${PROJECT_NAME} PRIVATE /MT$<$<CONFIG:Debug>:d>)
endif()

if(CELERO_TREAT_WARNINGS_AS_ERRORS)
target_compile_options(${PROJECT_NAME} PRIVATE /WX)
endif()
set_target_properties(${PROJECT_NAME} PROPERTIES
ARCHIVE_OUTPUT_NAME "${PROJECT_NAME}.dll")
ARCHIVE_OUTPUT_NAME "${PROJECT_NAME}$<$<CONFIG:Debug>:d>$<$<BOOL:${CELERO_COMPILE_DYNAMIC_LIBRARIES}>:.dll>")

elseif(${CMAKE_CXX_COMPILER_ID} STREQUAL GNU)
target_compile_options(${PROJECT_NAME} PRIVATE -Wall)
Expand Down Expand Up @@ -89,8 +92,10 @@ option(CELERO_TREAT_WARNINGS_AS_ERRORS "Treat compile warnings as errors." ON)

if(CELERO_COMPILE_DYNAMIC_LIBRARIES)
SET(CELERO_USER_DEFINED_SHARED_OR_STATIC "SHARED")
message(STATUS "Celero: Shared lib build")
else()
SET(CELERO_USER_DEFINED_SHARED_OR_STATIC "STATIC")
message(STATUS "Celero: Static lib build")
endif()

set_property(GLOBAL PROPERTY USE_FOLDERS ON)
Expand Down
187 changes: 101 additions & 86 deletions README.md

Large diffs are not rendered by default.

17 changes: 16 additions & 1 deletion include/celero/ExperimentResult.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,18 +70,33 @@ namespace celero
///
///
///
Statistics<int64_t>* getTimeStatistics();
const Statistics<int64_t>& getTimeStatistics() const;

///
///
///
const Statistics<int64_t>& getRAMStatistics() const;

///
/// Adds a run time sample during experiment execution.
///
void addRunTimeSample(const uint64_t x);

///
/// Adds a memory sample during experiment execution.
///
void addMemorySample(const int64_t x);

///
/// Returns the best run time sample observed.
///
uint64_t getRunTime() const;

///
/// Returns the best RAM usage sample observed.
///
int64_t getRAM() const;

///
/// \brief Get the number of computed microseconds per iteration (i.e. a single call to the code under test.)
///
Expand Down
4 changes: 3 additions & 1 deletion include/celero/Memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
///

#include <celero/Export.h>

#include <cstdint>
#include <string>

Expand All @@ -30,8 +31,9 @@ namespace celero
///
/// Contans all Memory measurements (in bytes)
///
struct RAMReport
class CELERO_EXPORT RAMReport
{
public:
int64_t RamSystemTotal{0};
int64_t RamSystemAvailable{0};
int64_t RamSystemUsed{0};
Expand Down
8 changes: 4 additions & 4 deletions src/Archive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ void Archive::add(std::shared_ptr<celero::ExperimentResult> x)

found->CurrentBaseline = x->getBaselineMeasurement();
found->CurrentBaseline_TimeSinceEpoch = this->pimpl->now();
found->CurrentStats = *x->getTimeStatistics();
found->CurrentStats = x->getTimeStatistics();

if(found->Failure || found->CurrentBaseline <= found->MinBaseline)
{
Expand Down Expand Up @@ -357,15 +357,15 @@ void Archive::add(std::shared_ptr<celero::ExperimentResult> x)

r.CurrentBaseline = x->getBaselineMeasurement();
r.CurrentBaseline_TimeSinceEpoch = r.FirstRanDate;
r.CurrentStats = *x->getTimeStatistics();
r.CurrentStats = x->getTimeStatistics();

r.MaxBaseline = x->getBaselineMeasurement();
r.MaxBaseline_TimeSinceEpoch = r.FirstRanDate;
r.MaxStats = *x->getTimeStatistics();
r.MaxStats = x->getTimeStatistics();

r.MinBaseline = x->getBaselineMeasurement();
r.MinBaseline_TimeSinceEpoch = r.FirstRanDate;
r.MinStats = *x->getTimeStatistics();
r.MinStats = x->getTimeStatistics();

this->pimpl->results.push_back(r);
}
Expand Down
4 changes: 3 additions & 1 deletion src/Executor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include <celero/Console.h>
#include <celero/Exceptions.h>
#include <celero/Executor.h>
#include <celero/Memory.h>
#include <celero/Print.h>
#include <celero/TestVector.h>
#include <celero/UserDefinedMeasurementCollector.h>
Expand Down Expand Up @@ -107,7 +108,8 @@ bool ExecuteProblemSpace(std::shared_ptr<celero::ExperimentResult> r)
// Save test results
if(record == true)
{
r->getTimeStatistics()->addSample(testTime);
r->addRunTimeSample(testTime);
r->addMemorySample(celero::GetRAMVirtualUsedByCurrentProcess());
r->getExperiment()->incrementTotalRunTime(testTime);

if(udmCollector != nullptr)
Expand Down
23 changes: 19 additions & 4 deletions src/ExperimentResult.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,21 +100,36 @@ uint64_t ExperimentResult::getProblemSpaceIterations() const
return this->pimpl->problemSpaceIterations;
}

Statistics<int64_t>* ExperimentResult::getTimeStatistics()
const Statistics<int64_t>& ExperimentResult::getTimeStatistics() const
{
return &this->pimpl->statsTime;
return this->pimpl->statsTime;
}

void ExperimentResult::addRunTimeSample(const uint64_t runTime)
const Statistics<int64_t>& ExperimentResult::getRAMStatistics() const
{
this->pimpl->statsTime.addSample(static_cast<int64_t>(runTime));
return this->pimpl->statsRAM;
}

void ExperimentResult::addRunTimeSample(const uint64_t x)
{
this->pimpl->statsTime.addSample(static_cast<int64_t>(x));
}

void ExperimentResult::addMemorySample(const int64_t x)
{
this->pimpl->statsRAM.addSample(static_cast<int64_t>(x));
}

uint64_t ExperimentResult::getRunTime() const
{
return static_cast<uint64_t>(this->pimpl->statsTime.getMin());
}

int64_t ExperimentResult::getRAM() const
{
return static_cast<uint64_t>(this->pimpl->statsRAM.getMin());
}

double ExperimentResult::getUsPerCall() const
{
if(this->pimpl->failure == false)
Expand Down
33 changes: 22 additions & 11 deletions src/Print.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ enum PrintConstants : size_t
{
ColumnSeperatorWidth = 3,
DoubleDecimals = 5,
NumberOfColumns = 8,
NumberOfColumns = 9,
ColumnWidth = 15
};

Expand Down Expand Up @@ -67,6 +67,7 @@ std::string PrintCenter(const std::string& s, const size_t w = PrintConstants::C
ss << " ";
}

celero::console::SetConsoleColor(celero::console::ConsoleColor::Default);
ss << " | ";
return ss.str();
}
Expand All @@ -90,6 +91,8 @@ std::string PrintColumn(const double x, const size_t decDigits = PrintConstants:
ss.precision(decDigits);
ss << x;

celero::console::SetConsoleColor(celero::console::ConsoleColor::Default);
ss << " | ";
return ss.str();
}

Expand All @@ -107,8 +110,10 @@ std::string PrintColumn(const int64_t x, const size_t width = PrintConstants::Co

// set width around displayed #
ss.width(width);
ss << x;

ss << x << " | ";
celero::console::SetConsoleColor(celero::console::ConsoleColor::Default);
ss << " | ";
return ss.str();
}

Expand All @@ -126,8 +131,10 @@ std::string PrintColumn(const uint64_t x, const size_t width = PrintConstants::C

// set width around displayed #
ss.width(width);
ss << x;

ss << x << " | ";
celero::console::SetConsoleColor(celero::console::ConsoleColor::Default);
ss << " | ";
return ss.str();
}

Expand All @@ -151,13 +158,15 @@ std::string PrintStrColumnAligned(const std::string& x, const size_t width = Pri
// Truncate
std::string xTrunc = x;
xTrunc = xTrunc.substr(0, width);
ss << xTrunc << " | ";
ss << xTrunc;
}
else
{
ss << x << " | ";
ss << x;
}

celero::console::SetConsoleColor(celero::console::ConsoleColor::Default);
ss << " | ";
return ss.str();
}

Expand All @@ -173,6 +182,8 @@ std::string PrintColumnRight(const std::string& x, const size_t width = PrintCon

std::string PrintHRule(const size_t additionalColumns = 0)
{
celero::console::SetConsoleColor(celero::console::ConsoleColor::Default);

std::stringstream ss;
std::string column{":"};

Expand Down Expand Up @@ -209,7 +220,8 @@ namespace celero
celero::console::SetConsoleColor(celero::console::ConsoleColor::Default);

std::cout << "|" << PrintCenter("Group") << PrintCenter("Experiment") << PrintCenter("Prob. Space") << PrintCenter("Samples")
<< PrintCenter("Iterations") << PrintCenter("Baseline") << PrintCenter("us/Iteration") << PrintCenter("Iterations/sec");
<< PrintCenter("Iterations") << PrintCenter("Baseline") << PrintCenter("us/Iteration") << PrintCenter("Iterations/sec")
<< PrintCenter("RAM (bytes)");

for(size_t i = PrintConstants::NumberOfColumns; i < this->columnWidths.size(); ++i)
{
Expand Down Expand Up @@ -285,17 +297,18 @@ namespace celero
celero::console::SetConsoleColor(temp_color);
std::cout << PrintColumn(x->getBaselineMeasurement());
celero::console::SetConsoleColor(celero::console::ConsoleColor::Default);
std::cout << " | ";

celero::console::SetConsoleColor(temp_color);
std::cout << PrintColumn(x->getUsPerCall());
celero::console::SetConsoleColor(celero::console::ConsoleColor::Default);
std::cout << " | ";

celero::console::SetConsoleColor(temp_color);
std::cout << PrintColumn(x->getCallsPerSecond(), 2);
celero::console::SetConsoleColor(celero::console::ConsoleColor::Default);
std::cout << " | ";

celero::console::SetConsoleColor(temp_color);
std::cout << PrintColumn(x->getRAM());
celero::console::SetConsoleColor(celero::console::ConsoleColor::Default);

std::unordered_map<std::string, double> udmValues;

Expand All @@ -316,8 +329,6 @@ namespace celero
else
{
std::cout << PrintColumn(udmValues.at(fieldName), 2, this->columnWidths[i + PrintConstants::NumberOfColumns]);
celero::console::SetConsoleColor(celero::console::ConsoleColor::Default);
std::cout << " | ";
}
}

Expand Down
23 changes: 15 additions & 8 deletions src/ResultTable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,12 @@ void ResultTable::add(std::shared_ptr<celero::ExperimentResult> x)
if(this->pimpl->hasWrittenHeader == false)
{
// Print the header for the table.
this->pimpl->ofs << "Group,Experiment,Problem "
"Space,Samples,Iterations,Failure,Baseline,";
this->pimpl->ofs << "Group,Experiment,Problem Space,Samples,Iterations,Failure,";

this->pimpl->ofs << "us/Iteration,Iterations/sec,Min (us),Mean (us),Max "
"(us),Variance,Standard Deviation,Skewness,Kurtosis,Z Score,";
this->pimpl->ofs << "Baseline,us/Iteration,Iterations/sec,";

this->pimpl->ofs << "T Min (us),T Mean (us),T Max (us),T Variance,T Standard Deviation,T Skewness,T Kurtosis,T Z Score,";
this->pimpl->ofs << "R Min (us),R Mean (us),R Max (us),R Variance,R Standard Deviation,R Skewness,R Kurtosis,R Z Score,";

// User Defined Metrics
const auto udmCollector = x->getUserDefinedMeasurements();
Expand All @@ -136,10 +137,16 @@ void ResultTable::add(std::shared_ptr<celero::ExperimentResult> x)
this->pimpl->ofs << x->getBaselineMeasurement() << "," << x->getUsPerCall() << "," << x->getCallsPerSecond() << ",";

// Statistics
this->pimpl->ofs << x->getTimeStatistics()->getMin() << "," << x->getTimeStatistics()->getMean() << "," << x->getTimeStatistics()->getMax()
<< "," << x->getTimeStatistics()->getVariance() << "," << x->getTimeStatistics()->getStandardDeviation() << ","
<< x->getTimeStatistics()->getSkewness() << "," << x->getTimeStatistics()->getKurtosis() << ","
<< x->getTimeStatistics()->getZScore() << ",";
this->pimpl->ofs << x->getTimeStatistics().getMin() << "," << x->getTimeStatistics().getMean() << "," << x->getTimeStatistics().getMax()
<< "," << x->getTimeStatistics().getVariance() << "," << x->getTimeStatistics().getStandardDeviation() << ","
<< x->getTimeStatistics().getSkewness() << "," << x->getTimeStatistics().getKurtosis() << ","
<< x->getTimeStatistics().getZScore() << ",";

// Statistics
this->pimpl->ofs << x->getRAMStatistics().getMin() << "," << x->getRAMStatistics().getMean() << "," << x->getRAMStatistics().getMax() << ","
<< x->getRAMStatistics().getVariance() << "," << x->getRAMStatistics().getStandardDeviation() << ","
<< x->getRAMStatistics().getSkewness() << "," << x->getRAMStatistics().getKurtosis() << ","
<< x->getRAMStatistics().getZScore() << ",";

// User Defined Metrics
const auto udmCollector = x->getUserDefinedMeasurements();
Expand Down

0 comments on commit 2249c91

Please sign in to comment.