summaryrefslogtreecommitdiff
path: root/indra/llcommon/llcallstack.cpp
diff options
context:
space:
mode:
authorBrad Payne (Vir Linden) <vir@lindenlab.com>2016-02-03 08:59:25 -0500
committerBrad Payne (Vir Linden) <vir@lindenlab.com>2016-02-03 08:59:25 -0500
commitef02c9ea694a1f0ddc830a66f23555c6316afdc7 (patch)
tree4ff8417ce189bf6b2f285822daa36f4cc2f4689d /indra/llcommon/llcallstack.cpp
parent19de8f3993da24d906a886b58125c4954ce4c79e (diff)
SL-315 - context strings, comments, debugging. joint_test temporarily disabled.
Diffstat (limited to 'indra/llcommon/llcallstack.cpp')
-rw-r--r--indra/llcommon/llcallstack.cpp55
1 files changed, 55 insertions, 0 deletions
diff --git a/indra/llcommon/llcallstack.cpp b/indra/llcommon/llcallstack.cpp
index cb77591c7c..2409f7a876 100644
--- a/indra/llcommon/llcallstack.cpp
+++ b/indra/llcommon/llcallstack.cpp
@@ -24,6 +24,8 @@
* $/LicenseInfo$
*/
+#include "linden_common.h"
+
#include "llcommon.h"
#include "llcallstack.h"
#include "StackWalker.h"
@@ -95,3 +97,56 @@ std::ostream& operator<<(std::ostream& s, const LLCallStack& call_stack)
}
return s;
}
+
+#include "llthreadlocalstorage.h"
+
+LLContextStrings::LLContextStrings()
+{
+}
+
+// static
+LLContextStrings* LLContextStrings::getThreadLocalInstance()
+{
+ LLContextStrings *cons = LLThreadLocalSingletonPointer<LLContextStrings>::getInstance();
+ if (!cons)
+ {
+ LLThreadLocalSingletonPointer<LLContextStrings>::setInstance(new LLContextStrings);
+ }
+ return LLThreadLocalSingletonPointer<LLContextStrings>::getInstance();
+}
+
+// static
+void LLContextStrings::addContextString(const std::string& str)
+{
+ LLContextStrings *cons = getThreadLocalInstance();
+ //LL_INFOS() << "CTX " << (S32)cons << " ADD " << str << " CNT " << cons->m_contextStrings[str] << LL_ENDL;
+ cons->m_contextStrings[str]++;
+}
+
+// static
+void LLContextStrings::removeContextString(const std::string& str)
+{
+ LLContextStrings *cons = getThreadLocalInstance();
+ cons->m_contextStrings[str]--;
+ //LL_INFOS() << "CTX " << (S32)cons << " REMOVE " << str << " CNT " << cons->m_contextStrings[str] << LL_ENDL;
+ if (cons->m_contextStrings[str] == 0)
+ {
+ cons->m_contextStrings.erase(str);
+ }
+}
+
+// static
+void LLContextStrings::output(std::ostream& os)
+{
+ const std::map<std::string,S32>& strings = LLThreadLocalSingletonPointer<LLContextStrings>::getInstance()->m_contextStrings;
+ for (std::map<std::string,S32>::const_iterator it = strings.begin(); it!=strings.end(); ++it)
+ {
+ os << it->first << "[" << it->second << "]" << "\n";
+ }
+}
+
+std::ostream& operator<<(std::ostream& s, const LLContextStatus& context_status)
+{
+ LLThreadLocalSingletonPointer<LLContextStrings>::getInstance()->output(s);
+ return s;
+}