diff options
Diffstat (limited to 'indra/llcommon')
-rw-r--r-- | indra/llcommon/llcallstack.h | 7 | ||||
-rw-r--r-- | indra/llcommon/llerror.cpp | 19 | ||||
-rw-r--r-- | indra/llcommon/llmemory.h | 6 | ||||
-rw-r--r-- | indra/llcommon/llstring.cpp | 19 | ||||
-rw-r--r-- | indra/llcommon/llstring.h | 3 |
5 files changed, 44 insertions, 10 deletions
diff --git a/indra/llcommon/llcallstack.h b/indra/llcommon/llcallstack.h index 1f7a7689d7..5acf04a49f 100644 --- a/indra/llcommon/llcallstack.h +++ b/indra/llcommon/llcallstack.h @@ -78,3 +78,10 @@ struct LLContextStatus }; LL_COMMON_API std::ostream& operator<<(std::ostream& s, const LLContextStatus& context_status); + +#define dumpStack(tag) \ + if (debugLoggingEnabled(tag)) \ + { \ + LLCallStack cs; \ + LL_DEBUGS(tag) << "STACK:\n" << "====================\n" << cs << "====================" << LL_ENDL; \ + } diff --git a/indra/llcommon/llerror.cpp b/indra/llcommon/llerror.cpp index 29de79dc64..ba71f4ddfb 100644 --- a/indra/llcommon/llerror.cpp +++ b/indra/llcommon/llerror.cpp @@ -29,6 +29,7 @@ #include "llerror.h" #include "llerrorcontrol.h" +#include "llsdutil.h" #include <cctype> #ifdef __GNUC__ @@ -393,7 +394,7 @@ namespace i != callSites.end(); ++i) { - (*i)->invalidate(); + (*i)->invalidate(); } callSites.clear(); @@ -1508,18 +1509,16 @@ namespace LLError bool debugLoggingEnabled(const std::string& tag) { - const char* tags[] = {tag.c_str()}; - ::size_t tag_count = 1; - LLError::CallSite _site(LLError::LEVEL_DEBUG, __FILE__, __LINE__, - typeid(_LL_CLASS_TO_LOG), __FUNCTION__, false, tags, tag_count); - if (LL_UNLIKELY(_site.shouldLog())) - { - return true; - } - else + LogLock lock; + if (!lock.ok()) { return false; } + + LLError::SettingsConfigPtr s = LLError::Settings::getInstance()->getSettingsConfig(); + LLError::ELevel level = LLError::LEVEL_DEBUG; + bool res = checkLevelMap(s->mTagLevelMap, tag, level); + return res; } diff --git a/indra/llcommon/llmemory.h b/indra/llcommon/llmemory.h index 5b17d9e3a4..f04ae5f5cb 100644 --- a/indra/llcommon/llmemory.h +++ b/indra/llcommon/llmemory.h @@ -60,6 +60,12 @@ class LLMutex ; LL_COMMON_API void ll_assert_aligned_func(uintptr_t ptr,U32 alignment); #ifdef SHOW_ASSERT +// This is incredibly expensive - in profiling Windows RWD builds, 30% +// of CPU time was in aligment checks. +//#define ASSERT_ALIGNMENT +#endif + +#ifdef ASSERT_ALIGNMENT #define ll_assert_aligned(ptr,alignment) ll_assert_aligned_func(uintptr_t(ptr),((U32)alignment)) #else #define ll_assert_aligned(ptr,alignment) diff --git a/indra/llcommon/llstring.cpp b/indra/llcommon/llstring.cpp index c45db3b185..9a02fecd72 100644 --- a/indra/llcommon/llstring.cpp +++ b/indra/llcommon/llstring.cpp @@ -869,6 +869,25 @@ std::string LLStringOps::getDatetimeCode (std::string key) } } +std::string LLStringOps::getReadableNumber(F64 num) +{ + if (fabs(num)>=1e9) + { + return llformat("%.2lfB", num / 1e9); + } + else if (fabs(num)>=1e6) + { + return llformat("%.2lfM", num / 1e6); + } + else if (fabs(num)>=1e3) + { + return llformat("%.2lfK", num / 1e3); + } + else + { + return llformat("%.2lf", num); + } +} namespace LLStringFn { diff --git a/indra/llcommon/llstring.h b/indra/llcommon/llstring.h index a4a5b393cb..68ee9db46b 100644 --- a/indra/llcommon/llstring.h +++ b/indra/llcommon/llstring.h @@ -211,6 +211,9 @@ public: static bool getPacificDaylightTime(void) { return sPacificDaylightTime;} static std::string getDatetimeCode (std::string key); + + // Express a value like 1234567 as "1.23M" + static std::string getReadableNumber(F64 num); }; /** |