summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorDave Parks <davep@lindenlab.com>2011-07-21 13:10:28 -0500
committerDave Parks <davep@lindenlab.com>2011-07-21 13:10:28 -0500
commit65d82fe192bdb4eb27766cf02eadaf78012f2817 (patch)
tree6b466c2a84a551fb3fcfeffbd99bf6b20004bfdb /indra
parentaaecc4c53ccbb71628988b10159f403d51836514 (diff)
SH-2031 Fix for stall in "Cleanup"
Diffstat (limited to 'indra')
-rw-r--r--indra/llcommon/llfasttimer_class.cpp8
-rw-r--r--indra/newview/llappviewer.cpp12
-rw-r--r--indra/newview/llviewerobjectlist.cpp26
-rw-r--r--indra/newview/llvoicevivox.cpp4
4 files changed, 41 insertions, 9 deletions
diff --git a/indra/llcommon/llfasttimer_class.cpp b/indra/llcommon/llfasttimer_class.cpp
index bd594b06cf..675eda2fc5 100644
--- a/indra/llcommon/llfasttimer_class.cpp
+++ b/indra/llcommon/llfasttimer_class.cpp
@@ -228,6 +228,14 @@ void LLFastTimer::DeclareTimer::updateCachedPointers()
// update cached pointer
it->mFrameState = &it->mTimer.getFrameState();
}
+
+ // also update frame states of timers on stack
+ LLFastTimer* cur_timerp = LLFastTimer::sCurTimerData.mCurTimer;
+ while(cur_timerp->mLastTimerData.mCurTimer != cur_timerp)
+ {
+ cur_timerp->mFrameState = &cur_timerp->mFrameState->mTimer->getFrameState();
+ cur_timerp = cur_timerp->mLastTimerData.mCurTimer;
+ }
}
//static
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index 80ac385e3b..1fef8d005a 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -4015,6 +4015,8 @@ public:
static LLFastTimer::DeclareTimer FTM_AUDIO_UPDATE("Update Audio");
static LLFastTimer::DeclareTimer FTM_CLEANUP("Cleanup");
+static LLFastTimer::DeclareTimer FTM_CLEANUP_DRAWABLES("Drawables");
+static LLFastTimer::DeclareTimer FTM_CLEANUP_OBJECTS("Objects");
static LLFastTimer::DeclareTimer FTM_IDLE_CB("Idle Callbacks");
static LLFastTimer::DeclareTimer FTM_LOD_UPDATE("Update LOD");
static LLFastTimer::DeclareTimer FTM_OBJECTLIST_UPDATE("Update Objectlist");
@@ -4291,8 +4293,14 @@ void LLAppViewer::idle()
{
LLFastTimer t(FTM_CLEANUP);
- gObjectList.cleanDeadObjects();
- LLDrawable::cleanupDeadDrawables();
+ {
+ LLFastTimer t(FTM_CLEANUP_OBJECTS);
+ gObjectList.cleanDeadObjects();
+ }
+ {
+ LLFastTimer t(FTM_CLEANUP_DRAWABLES);
+ LLDrawable::cleanupDeadDrawables();
+ }
}
//
diff --git a/indra/newview/llviewerobjectlist.cpp b/indra/newview/llviewerobjectlist.cpp
index 9f882ee732..48ccc7d035 100644
--- a/indra/newview/llviewerobjectlist.cpp
+++ b/indra/newview/llviewerobjectlist.cpp
@@ -1339,18 +1339,29 @@ void LLViewerObjectList::cleanDeadObjects(BOOL use_timer)
S32 num_removed = 0;
LLViewerObject *objectp;
- for (vobj_list_t::iterator iter = mObjects.begin(); iter != mObjects.end(); )
+
+ vobj_list_t::reverse_iterator target = mObjects.rbegin();
+
+ vobj_list_t::iterator iter = mObjects.begin();
+ for ( ; iter != mObjects.end(); )
{
- // Scan for all of the dead objects and remove any "global" references to them.
+ // Scan for all of the dead objects and put them all on the end of the list with no ref count ops
objectp = *iter;
+ if (objectp == NULL)
+ { //we caught up to the dead tail
+ break;
+ }
+
if (objectp->isDead())
{
- iter = mObjects.erase(iter);
+ LLPointer<LLViewerObject>::swap(*iter, *target);
+ *target = NULL;
+ ++target;
num_removed++;
- if (num_removed == mNumDeadObjects)
+ if (num_removed == mNumDeadObjects || iter->isNull())
{
- // We've cleaned up all of the dead objects.
+ // We've cleaned up all of the dead objects or caught up to the dead tail
break;
}
}
@@ -1360,6 +1371,11 @@ void LLViewerObjectList::cleanDeadObjects(BOOL use_timer)
}
}
+ llassert(num_removed == mNumDeadObjects);
+
+ //erase as a block
+ mObjects.erase(mObjects.begin()+(mObjects.size()-mNumDeadObjects), mObjects.end());
+
// We've cleaned the global object list, now let's do some paranoia testing on objects
// before blowing away the dead list.
mDeadObjects.clear();
diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp
index 9dc6b5194e..0db0010688 100644
--- a/indra/newview/llvoicevivox.cpp
+++ b/indra/newview/llvoicevivox.cpp
@@ -7049,7 +7049,7 @@ LLVivoxProtocolParser::~LLVivoxProtocolParser()
XML_ParserFree(parser);
}
-//static LLFastTimer::DeclareTimer FTM_VIVOX_PROCESS("Vivox Process");
+static LLFastTimer::DeclareTimer FTM_VIVOX_PROCESS("Vivox Process");
// virtual
LLIOPipe::EStatus LLVivoxProtocolParser::process_impl(
@@ -7059,7 +7059,7 @@ LLIOPipe::EStatus LLVivoxProtocolParser::process_impl(
LLSD& context,
LLPumpIO* pump)
{
- //LLFastTimer t(FTM_VIVOX_PROCESS);
+ LLFastTimer t(FTM_VIVOX_PROCESS);
LLBufferStream istr(channels, buffer.get());
std::ostringstream ostr;
while (istr.good())