From d1481a599fa8bd65f505e0bd9dec33370a3c68c8 Mon Sep 17 00:00:00 2001 From: MaksymS ProductEngine Date: Fri, 31 Aug 2012 00:38:16 +0300 Subject: MAINT-1486 FIXED Crash on login (Unhandled exception) --- indra/llcommon/llfasttimer.cpp | 39 ++++++++++++++++++++++++++++-------- indra/llcommon/llfasttimer.h | 1 + indra/newview/llappviewer.cpp | 8 ++++++++ indra/newview/llflexibleobject.cpp | 2 +- indra/newview/llspatialpartition.cpp | 2 +- indra/newview/llviewerdisplay.cpp | 2 +- indra/newview/llvowlsky.cpp | 2 +- 7 files changed, 44 insertions(+), 12 deletions(-) (limited to 'indra') 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 timer_map_t; + typedef std::multimap 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 { diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index bf01627bad..78151510d5 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -703,6 +703,14 @@ bool LLAppViewer::init() LL_INFOS("InitInfo") << "Configuration initialized." << LL_ENDL ; + std::string duplicates; + if(LLFastTimer::checkForDuplicates(duplicates)) + { + LL_WARNS("InitInfo") << "There are duplicates created by LLFastTimer::DeclareTimer with names: '" + << duplicates << "'" << LL_ENDL; + return false; + } + //set the max heap size. initMaxHeapSize() ; diff --git a/indra/newview/llflexibleobject.cpp b/indra/newview/llflexibleobject.cpp index 22c265cb8a..a37e27363f 100644 --- a/indra/newview/llflexibleobject.cpp +++ b/indra/newview/llflexibleobject.cpp @@ -48,7 +48,7 @@ std::vector LLVolumeImplFlexible::sInstanceList; std::vector LLVolumeImplFlexible::sUpdateDelay; static LLFastTimer::DeclareTimer FTM_FLEXIBLE_REBUILD("Rebuild"); -static LLFastTimer::DeclareTimer FTM_DO_FLEXIBLE_UPDATE("Update"); +static LLFastTimer::DeclareTimer FTM_DO_FLEXIBLE_UPDATE("Flexible Update"); // LLFlexibleObjectData::pack/unpack now in llprimitive.cpp diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp index 30f796a78e..5083478392 100644 --- a/indra/newview/llspatialpartition.cpp +++ b/indra/newview/llspatialpartition.cpp @@ -55,7 +55,7 @@ #include "llviewershadermgr.h" static LLFastTimer::DeclareTimer FTM_FRUSTUM_CULL("Frustum Culling"); -static LLFastTimer::DeclareTimer FTM_CULL_REBOUND("Cull Rebound"); +static LLFastTimer::DeclareTimer FTM_CULL_REBOUND("Cull Rebound Partition"); const F32 SG_OCCLUSION_FUDGE = 0.25f; #define SG_DISCARD_TOLERANCE 0.01f diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index 705edc27f6..ffeea2f4df 100644 --- a/indra/newview/llviewerdisplay.cpp +++ b/indra/newview/llviewerdisplay.cpp @@ -217,7 +217,7 @@ static LLFastTimer::DeclareTimer FTM_UPDATE_SKY("Update Sky"); static LLFastTimer::DeclareTimer FTM_UPDATE_TEXTURES("Update Textures"); static LLFastTimer::DeclareTimer FTM_IMAGE_UPDATE("Update Images"); static LLFastTimer::DeclareTimer FTM_IMAGE_UPDATE_CLASS("Class"); -static LLFastTimer::DeclareTimer FTM_IMAGE_UPDATE_BUMP("Bump"); +static LLFastTimer::DeclareTimer FTM_IMAGE_UPDATE_BUMP("Image Update Bump"); static LLFastTimer::DeclareTimer FTM_IMAGE_UPDATE_LIST("List"); static LLFastTimer::DeclareTimer FTM_IMAGE_UPDATE_DELETE("Delete"); static LLFastTimer::DeclareTimer FTM_RESIZE_WINDOW("Resize Window"); diff --git a/indra/newview/llvowlsky.cpp b/indra/newview/llvowlsky.cpp index a33f42cf84..7f17fd3e56 100644 --- a/indra/newview/llvowlsky.cpp +++ b/indra/newview/llvowlsky.cpp @@ -301,7 +301,7 @@ void LLVOWLSky::restoreGL() gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_ALL, TRUE); } -static LLFastTimer::DeclareTimer FTM_GEO_SKY("Sky Geometry"); +static LLFastTimer::DeclareTimer FTM_GEO_SKY("Windlight Sky Geometry"); BOOL LLVOWLSky::updateGeometry(LLDrawable * drawable) { -- cgit v1.2.3 From 64201b21b3d02f98969981723ef5426cdbfc16be Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Thu, 30 Aug 2012 16:46:37 -0700 Subject: MAINT-1486 FIX Crash on login (Unhandled exception) allow duplicate named fast timers again, refactored timer code --- indra/llcommon/llfasttimer.cpp | 34 +++++++++++++++++++--------------- indra/llcommon/llfasttimer.h | 10 +++++----- indra/newview/llfasttimerview.cpp | 4 ++-- 3 files changed, 26 insertions(+), 22 deletions(-) (limited to 'indra') diff --git a/indra/llcommon/llfasttimer.cpp b/indra/llcommon/llfasttimer.cpp index ff6806082c..b233b18f45 100644 --- a/indra/llcommon/llfasttimer.cpp +++ b/indra/llcommon/llfasttimer.cpp @@ -113,10 +113,9 @@ public: /*virtual */ void initSingleton() { mTimerRoot = new LLFastTimer::NamedTimer("root"); - mRootFrameState.setNamedTimer(mTimerRoot); - mTimerRoot->setFrameState(&mRootFrameState); + mRootFrameState = &mTimerRoot->getFrameState(); mTimerRoot->mParent = mTimerRoot; - mRootFrameState.mParent = &mRootFrameState; + mRootFrameState->mParent = mRootFrameState; } ~NamedTimerFactory() @@ -126,17 +125,15 @@ public: delete mTimerRoot; } - LLFastTimer::NamedTimer& createNamedTimer(const std::string& name, LLFastTimer::FrameState* state) + LLFastTimer::NamedTimer& createNamedTimer(const std::string& name) { 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); mTimers.insert(std::make_pair(name, timer)); @@ -163,19 +160,21 @@ public: private: timer_map_t mTimers; - LLFastTimer::NamedTimer* mTimerRoot; - LLFastTimer::FrameState mRootFrameState; + LLFastTimer::NamedTimer* mTimerRoot; + LLFastTimer::FrameState* mRootFrameState; }; LLFastTimer::DeclareTimer::DeclareTimer(const std::string& name, bool open ) -: mTimer(NamedTimerFactory::instance().createNamedTimer(name, &mFrameState)) +: mTimer(NamedTimerFactory::instance().createNamedTimer(name)) { + mFrameState = &mTimer.getFrameState(); mTimer.setCollapsed(!open); } LLFastTimer::DeclareTimer::DeclareTimer(const std::string& name) -: mTimer(NamedTimerFactory::instance().createNamedTimer(name, &mFrameState)) +: mTimer(NamedTimerFactory::instance().createNamedTimer(name)) { + mFrameState = &mTimer.getFrameState(); } //static @@ -225,13 +224,13 @@ LLFastTimer::NamedTimer::NamedTimer(const std::string& name) mTotalTimeCounter(0), mCountAverage(0), mCallAverage(0), - mNeedsSorting(false), - mFrameState(NULL) + mNeedsSorting(false) { mCountHistory = new U32[HISTORY_NUM]; memset(mCountHistory, 0, sizeof(U32) * HISTORY_NUM); mCallHistory = new U32[HISTORY_NUM]; memset(mCallHistory, 0, sizeof(U32) * HISTORY_NUM); + mFrameState.setNamedTimer(this); } LLFastTimer::NamedTimer::~NamedTimer() @@ -291,7 +290,7 @@ S32 LLFastTimer::NamedTimer::getDepth() { S32 depth = 0; NamedTimer* timerp = mParent; - while(timerp) + while(timerp && timerp->mParent != timerp) { depth++; timerp = timerp->mParent; @@ -546,9 +545,14 @@ U32 LLFastTimer::NamedTimer::getHistoricalCalls(S32 history_index ) const return mCallHistory[history_idx]; } -LLFastTimer::FrameState& LLFastTimer::NamedTimer::getFrameState() const +const LLFastTimer::FrameState& LLFastTimer::NamedTimer::getFrameState() const { - return *mFrameState; + return mFrameState; +} + +LLFastTimer::FrameState& LLFastTimer::NamedTimer::getFrameState() +{ + return mFrameState; } std::vector::const_iterator LLFastTimer::NamedTimer::beginChildren() diff --git a/indra/llcommon/llfasttimer.h b/indra/llcommon/llfasttimer.h index e42e549df5..07af0f1d4d 100644 --- a/indra/llcommon/llfasttimer.h +++ b/indra/llcommon/llfasttimer.h @@ -91,8 +91,8 @@ public: U32 getHistoricalCount(S32 history_index = 0) const; U32 getHistoricalCalls(S32 history_index = 0) const; - void setFrameState(FrameState* state) { mFrameState = state; state->setNamedTimer(this); } - FrameState& getFrameState() const; + const FrameState& getFrameState() const; + FrameState& getFrameState(); private: friend class LLFastTimer; @@ -116,7 +116,7 @@ public: // // members // - FrameState* mFrameState; + FrameState mFrameState; std::string mName; @@ -147,7 +147,7 @@ public: NamedTimer& getNamedTimer() { return mTimer; } private: - FrameState mFrameState; + FrameState* mFrameState; NamedTimer& mTimer; }; @@ -155,7 +155,7 @@ public: LLFastTimer(LLFastTimer::FrameState* state); LL_FORCE_INLINE LLFastTimer(LLFastTimer::DeclareTimer& timer) - : mFrameState(&timer.mFrameState) + : mFrameState(timer.mFrameState) { #if FAST_TIMER_ON LLFastTimer::FrameState* frame_state = mFrameState; diff --git a/indra/newview/llfasttimerview.cpp b/indra/newview/llfasttimerview.cpp index 59bf70f488..fd92f8ac18 100644 --- a/indra/newview/llfasttimerview.cpp +++ b/indra/newview/llfasttimerview.cpp @@ -511,7 +511,7 @@ void LLFastTimerView::draw() x += dx; BOOL is_child_of_hover_item = (idp == mHoverID); LLFastTimer::NamedTimer* next_parent = idp->getParent(); - while(!is_child_of_hover_item && next_parent) + while(!is_child_of_hover_item && next_parent && next_parent != next_parent->getParent()) { is_child_of_hover_item = (mHoverID == next_parent); next_parent = next_parent->getParent(); @@ -778,7 +778,7 @@ void LLFastTimerView::draw() BOOL is_child_of_hover_item = (idp == mHoverID); LLFastTimer::NamedTimer* next_parent = idp->getParent(); - while(!is_child_of_hover_item && next_parent) + while(!is_child_of_hover_item && next_parent && next_parent != next_parent->getParent()) { is_child_of_hover_item = (mHoverID == next_parent); next_parent = next_parent->getParent(); -- cgit v1.2.3 From 9e031934461c72fb97eecd4f074e1fe6d43fc1c0 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Thu, 30 Aug 2012 16:49:25 -0700 Subject: MAINT-1486 FIX Crash on login (Unhandled exception) removed checkforDuplicates since we support duplicates again --- indra/newview/llappviewer.cpp | 8 -------- 1 file changed, 8 deletions(-) (limited to 'indra') diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 78151510d5..bf01627bad 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -703,14 +703,6 @@ bool LLAppViewer::init() LL_INFOS("InitInfo") << "Configuration initialized." << LL_ENDL ; - std::string duplicates; - if(LLFastTimer::checkForDuplicates(duplicates)) - { - LL_WARNS("InitInfo") << "There are duplicates created by LLFastTimer::DeclareTimer with names: '" - << duplicates << "'" << LL_ENDL; - return false; - } - //set the max heap size. initMaxHeapSize() ; -- cgit v1.2.3