summaryrefslogtreecommitdiff
path: root/indra/llcommon
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llcommon')
-rwxr-xr-xindra/llcommon/llerror.cpp25
-rwxr-xr-xindra/llcommon/llerror.h12
-rwxr-xr-xindra/llcommon/lltimer.cpp11
-rwxr-xr-xindra/llcommon/lltimer.h13
-rw-r--r--indra/llcommon/lltraceaccumulators.h1
-rw-r--r--indra/llcommon/tests/llunits_test.cpp6
6 files changed, 46 insertions, 22 deletions
diff --git a/indra/llcommon/llerror.cpp b/indra/llcommon/llerror.cpp
index d2af004cde..5b4be1ac80 100755
--- a/indra/llcommon/llerror.cpp
+++ b/indra/llcommon/llerror.cpp
@@ -158,14 +158,20 @@ namespace {
}
private:
- bool mTimestamp;
- enum ANSIState {ANSI_PROBE, ANSI_YES, ANSI_NO};
- ANSIState mUseANSI;
+ bool mTimestamp;
+ enum ANSIState
+ {
+ ANSI_PROBE,
+ ANSI_YES,
+ ANSI_NO
+ } mUseANSI;
+
void colorANSI(const std::string color)
{
// ANSI color code escape sequence
fprintf(stderr, "\033[%sm", color.c_str() );
};
+
bool checkANSI(void)
{
#if LL_LINUX || LL_DARWIN
@@ -727,13 +733,13 @@ namespace LLError
namespace LLError
{
Recorder::~Recorder()
- { }
+ {}
// virtual
bool Recorder::wantsTime()
- { return false; }
-
-
+ {
+ return false;
+ }
void addRecorder(Recorder* recorder)
{
@@ -752,9 +758,8 @@ namespace LLError
return;
}
Settings& s = Settings::get();
- s.recorders.erase(
- std::remove(s.recorders.begin(), s.recorders.end(), recorder),
- s.recorders.end());
+ s.recorders.erase(std::remove(s.recorders.begin(), s.recorders.end(), recorder),
+ s.recorders.end());
}
}
diff --git a/indra/llcommon/llerror.h b/indra/llcommon/llerror.h
index 0b723aeb5d..ceff40e900 100755
--- a/indra/llcommon/llerror.h
+++ b/indra/llcommon/llerror.h
@@ -155,12 +155,12 @@ namespace LLError
// these describe the call site and never change
const ELevel mLevel;
const char* const mFile;
- const int mLine;
- const std::type_info& mClassInfo;
+ const int mLine;
+ const std::type_info& mClassInfo;
const char* const mFunction;
const char* const mBroadTag;
const char* const mNarrowTag;
- const bool mPrintOnce;
+ const bool mPrintOnce;
// these implement a cache of the call to shouldLog()
bool mCached;
@@ -213,7 +213,7 @@ namespace LLError
#endif
//this is cheaper than llcallstacks if no need to output other variables to call stacks.
-#define llpushcallstacks LLError::LLCallStacks::push(__FUNCTION__, __LINE__)
+#define LL_PUSH_CALLSTACKS() LLError::LLCallStacks::push(__FUNCTION__, __LINE__)
#define llcallstacks \
{\
std::ostringstream* _out = LLError::LLCallStacks::insert(__FUNCTION__, __LINE__) ; \
@@ -222,8 +222,8 @@ namespace LLError
LLError::End(); \
LLError::LLCallStacks::end(_out) ; \
}
-#define llclearcallstacks LLError::LLCallStacks::clear()
-#define llprintcallstacks LLError::LLCallStacks::print()
+#define LL_CLEAR_CALLSTACKS() LLError::LLCallStacks::clear()
+#define LL_PRINT_CALLSTACKS() LLError::LLCallStacks::print()
/*
Class type information for logging
diff --git a/indra/llcommon/lltimer.cpp b/indra/llcommon/lltimer.cpp
index 693809b622..25383fc4d8 100755
--- a/indra/llcommon/lltimer.cpp
+++ b/indra/llcommon/lltimer.cpp
@@ -281,7 +281,18 @@ LLTimer::LLTimer()
}
LLTimer::~LLTimer()
+{}
+
+// static
+void LLTimer::initClass()
+{
+ if (!sTimer) sTimer = new LLTimer;
+}
+
+// static
+void LLTimer::cleanupClass()
{
+ delete sTimer; sTimer = NULL;
}
// static
diff --git a/indra/llcommon/lltimer.h b/indra/llcommon/lltimer.h
index 9e464c4b1a..f2dc59e405 100755
--- a/indra/llcommon/lltimer.h
+++ b/indra/llcommon/lltimer.h
@@ -62,14 +62,21 @@ public:
LLTimer();
~LLTimer();
- static void initClass() { if (!sTimer) sTimer = new LLTimer; }
- static void cleanupClass() { delete sTimer; sTimer = NULL; }
+ static void initClass();
+ static void cleanupClass();
// Return a high precision number of seconds since the start of
// this application instance.
static LLUnitImplicit<F64, LLUnits::Seconds> getElapsedSeconds()
{
- return sTimer->getElapsedTimeF64();
+ if (sTimer)
+ {
+ return sTimer->getElapsedTimeF64();
+ }
+ else
+ {
+ return 0;
+ }
}
// Return a high precision usec since epoch
diff --git a/indra/llcommon/lltraceaccumulators.h b/indra/llcommon/lltraceaccumulators.h
index b1aa078f9a..9ea787188c 100644
--- a/indra/llcommon/lltraceaccumulators.h
+++ b/indra/llcommon/lltraceaccumulators.h
@@ -453,6 +453,7 @@ namespace LLTrace
F64 getMean() const { return mMean; }
F64 getStandardDeviation() const { return sqrtf(mSumOfSquares / mTotalSamplingTime); }
U32 getSampleCount() const { return mNumSamples; }
+ bool hasValue() const { return mHasValue; }
private:
F64 mSum,
diff --git a/indra/llcommon/tests/llunits_test.cpp b/indra/llcommon/tests/llunits_test.cpp
index a5df51f6de..e631f18ad4 100644
--- a/indra/llcommon/tests/llunits_test.cpp
+++ b/indra/llcommon/tests/llunits_test.cpp
@@ -34,8 +34,8 @@ namespace LLUnits
{
// using powers of 2 to allow strict floating point equality
LL_DECLARE_BASE_UNIT(Quatloos, "Quat");
- LL_DECLARE_DERIVED_UNIT(Latinum, "Lat", Quatloos, * 4);
- LL_DECLARE_DERIVED_UNIT(Solari, "Sol", Latinum, / 16);
+ LL_DECLARE_DERIVED_UNIT(Quatloos, * 4, Latinum, "Lat");
+ LL_DECLARE_DERIVED_UNIT(Latinum, / 16, Solari, "Sol");
}
namespace tut
@@ -164,7 +164,7 @@ namespace tut
void units_object_t::test<5>()
{
// 0-initialized
- LLUnit<F32, Quatloos> quatloos(0);
+ LLUnit<F32, Quatloos> quatloos;
// initialize implicit unit from explicit
LLUnitImplicit<F32, Quatloos> quatloos_implicit = quatloos + 1;
ensure(quatloos_implicit == 1);