MAINT-8686 Viewer should report active coroutines at the end of the session

master
andreykproductengine 2018-05-30 16:44:14 +03:00
parent a902b360f2
commit 8348e50c7f
3 changed files with 24 additions and 1 deletions

View File

@ -35,6 +35,7 @@
// external library headers
#include <boost/bind.hpp>
// other Linden headers
#include "lltimer.h"
#include "llevents.h"
#include "llerror.h"
#include "stringize.h"
@ -280,6 +281,21 @@ void LLCoros::setStackSize(S32 stacksize)
mStackSize = stacksize;
}
void LLCoros::printActiveCoroutines()
{
LL_INFOS("LLCoros") << "-------------- List of active coroutines ------------";
CoroMap::iterator iter;
CoroMap::iterator end = mCoros.end();
F64 time = LLTimer::getTotalSeconds();
for (iter = mCoros.begin(); iter != end; iter++)
{
F64 life_time = time - iter->second->mCreationTime;
LL_CONT << LL_NEWLINE << "Name: " << iter->first << " life: " << life_time;
}
LL_CONT << LL_ENDL;
LL_INFOS("LLCoros") << "-----------------------------------------------------" << LL_ENDL;
}
#if LL_WINDOWS
static const U32 STATUS_MSC_EXCEPTION = 0xE06D7363; // compiler specific
@ -375,7 +391,8 @@ LLCoros::CoroData::CoroData(CoroData* prev, const std::string& name,
mCoro(boost::bind(toplevel, _1, this, callable), stacksize),
// don't consume events unless specifically directed
mConsuming(false),
mSelf(0)
mSelf(0),
mCreationTime(LLTimer::getTotalSeconds())
{
}

View File

@ -151,6 +151,9 @@ public:
/// for delayed initialization
void setStackSize(S32 stacksize);
/// for delayed initialization
void printActiveCoroutines();
/// get the current coro::self& for those who really really care
static coro::self& get_self();
@ -223,6 +226,7 @@ private:
// function signature down to that point -- and of course through every
// other caller of every such function.
LLCoros::coro::self* mSelf;
F64 mCreationTime; // since epoch
};
typedef boost::ptr_map<std::string, CoroData> CoroMap;
CoroMap mCoros;

View File

@ -1794,6 +1794,8 @@ bool LLAppViewer::cleanup()
// (Deleted observers should have already removed themselves)
gInventory.cleanupInventory();
LLCoros::getInstance()->printActiveCoroutines();
LL_INFOS() << "Cleaning up Selections" << LL_ENDL;
// Clean up selection managers after UI is destroyed, as UI may be observing them.