Skip to content

Commit

Permalink
clang-format
Browse files Browse the repository at this point in the history
  • Loading branch information
abeaucha committed Oct 3, 2024
1 parent 9f5579d commit 32c3912
Showing 1 changed file with 23 additions and 18 deletions.
41 changes: 23 additions & 18 deletions six/modules/c++/six/include/six/Utilities.h
Original file line number Diff line number Diff line change
Expand Up @@ -389,17 +389,13 @@ namespace testing
struct SIX_SIX_API BaseEnvProfiler
{
BaseEnvProfiler(const char* envVar,
const std::string& testName,
std::ostream &stream)
: mEnvVar(envVar),
mTestName(testName),
mStream(stream)
const std::string& testName,
std::ostream& stream) :
mEnvVar(envVar), mTestName(testName), mStream(stream)
{
sys::OS os;
mEnabled = os.isEnvSet(mEnvVar);
mNumIters = mEnabled
? str::toType<int>(os.getEnv(mEnvVar))
: 1;
mNumIters = mEnabled ? str::toType<int>(os.getEnv(mEnvVar)) : 1;
}
~BaseEnvProfiler() = default;

Expand Down Expand Up @@ -427,9 +423,11 @@ namespace testing
struct SIX_SIX_API EnvProfiler : BaseEnvProfiler<EnvProfiler>
{
EnvProfiler(const char* envVar,
const std::string& testName,
std::ostream &stream) : BaseEnvProfiler(envVar, testName, stream)
{}
const std::string& testName,
std::ostream& stream) :
BaseEnvProfiler(envVar, testName, stream)
{
}
~EnvProfiler() = default;

template <typename TFunc>
Expand All @@ -453,20 +451,25 @@ namespace testing
}

mean /= mNumIters;
mStream << mTestName << " runtime (mean/min/max)ms: "
<< mean << "/" << mn << "/" << mx << std::endl;
mStream << mTestName << " runtime (mean/min/max)ms: " << mean << "/"
<< mn << "/" << mx << std::endl;
}
};

/// @brief Toggle profiling of exception sizes based on env var
/// @tparam TExcept
template <typename TExcept>
struct SIX_SIX_API StackTraceSizeEnvProfiler : BaseEnvProfiler<StackTraceSizeEnvProfiler<TExcept>>
struct SIX_SIX_API StackTraceSizeEnvProfiler
: BaseEnvProfiler<StackTraceSizeEnvProfiler<TExcept>>
{
StackTraceSizeEnvProfiler(const char* envVar,
const std::string& testName,
std::ostream &stream) : BaseEnvProfiler<StackTraceSizeEnvProfiler<TExcept>>(envVar, testName, stream)
{}
const std::string& testName,
std::ostream& stream) :
BaseEnvProfiler<StackTraceSizeEnvProfiler<TExcept>>(envVar,
testName,
stream)
{
}
~StackTraceSizeEnvProfiler() = default;

template <typename TFunc>
Expand All @@ -479,7 +482,9 @@ namespace testing
catch (const TExcept& ex)
{
// log size of the exception message
this->mStream << this->mTestName << ": exception size (bytes): " << strlen(ex.what()) << std::endl;
this->mStream << this->mTestName
<< ": exception size (bytes): " << strlen(ex.what())
<< std::endl;

throw;
}
Expand Down

0 comments on commit 32c3912

Please sign in to comment.