summaryrefslogtreecommitdiff
path: root/indra/llcommon
diff options
context:
space:
mode:
authorMaksymS ProductEngine <msavchenko@productengine.com>2012-08-31 00:38:16 +0300
committerMaksymS ProductEngine <msavchenko@productengine.com>2012-08-31 00:38:16 +0300
commitd1481a599fa8bd65f505e0bd9dec33370a3c68c8 (patch)
tree9813d3eaee5ea8c1b59dc5fb8bb4cfca99a2d888 /indra/llcommon
parent5a03b8282da64433c2525f0950e8fb86995f66dc (diff)
MAINT-1486 FIXED Crash on login (Unhandled exception)
Diffstat (limited to 'indra/llcommon')
-rw-r--r--indra/llcommon/llfasttimer.cpp39
-rw-r--r--indra/llcommon/llfasttimer.h1
2 files changed, 32 insertions, 8 deletions
diff --git a/indra/llcommon/llfasttimer.cpp b/indra/llcommon/llfasttimer.cpp
index ff6806082c..670c90351e 100644
--- a/indra/llcommon/llfasttimer.cpp
+++ b/indra/llcommon/llfasttimer.cpp
@@ -128,13 +128,6 @@ public:
LLFastTimer::NamedTimer& createNamedTimer(const std::string& name, LLFastTimer::FrameState* state)
{
- timer_map_t::iterator found_it = mTimers.find(name);
- if (found_it != mTimers.end())
- {
- llerrs << "Duplicate timer declaration for: " << name << llendl;
- return *found_it->second;
- }
-
LLFastTimer::NamedTimer* timer = new LLFastTimer::NamedTimer(name);
timer->setFrameState(state);
timer->setParent(mTimerRoot);
@@ -155,7 +148,7 @@ public:
LLFastTimer::NamedTimer* getRootTimer() { return mTimerRoot; }
- typedef std::map<std::string, LLFastTimer::NamedTimer*> timer_map_t;
+ typedef std::multimap<std::string, LLFastTimer::NamedTimer*> timer_map_t;
timer_map_t::iterator beginTimers() { return mTimers.begin(); }
timer_map_t::iterator endTimers() { return mTimers.end(); }
S32 timerCount() { return mTimers.size(); }
@@ -646,6 +639,36 @@ const LLFastTimer::NamedTimer* LLFastTimer::getTimerByName(const std::string& na
return NamedTimerFactory::instance().getTimerByName(name);
}
+//static
+bool LLFastTimer::checkForDuplicates(std::string& duplicates)
+{
+ typedef NamedTimerFactory::timer_map_t::iterator timer_iterator;
+
+ bool duplicateFound = false;
+ NamedTimerFactory& namedFactory = NamedTimerFactory::instance();
+
+ if (namedFactory.timerCount() > 1)
+ {
+ timer_iterator endPosition = namedFactory.endTimers();
+ timer_iterator ti = namedFactory.beginTimers();
+ std::string prevKey = ti->first;
+
+ for (ti++; ti != endPosition; ti++)
+ {
+ const std::string& curKey = ti->first;
+ if (0 == curKey.compare(prevKey))
+ {
+ if (duplicateFound) duplicates += ", ";
+ duplicates += curKey;
+ duplicateFound = true;
+ }
+ prevKey = curKey;
+ }
+ }
+
+ return duplicateFound;
+}
+
LLFastTimer::LLFastTimer(LLFastTimer::FrameState* state)
: mFrameState(state)
{
diff --git a/indra/llcommon/llfasttimer.h b/indra/llcommon/llfasttimer.h
index e42e549df5..b0d3ea5d60 100644
--- a/indra/llcommon/llfasttimer.h
+++ b/indra/llcommon/llfasttimer.h
@@ -224,6 +224,7 @@ public:
static void writeLog(std::ostream& os);
static const NamedTimer* getTimerByName(const std::string& name);
+ static bool checkForDuplicates(std::string& duplicates);
struct CurTimerData
{