SH-3406 WIP convert fast timers to lltrace system

got new fast timer code to compile and run
master
Richard Linden 2012-11-16 23:02:53 -08:00
parent c136b43214
commit 6db6cb39f4
12 changed files with 52 additions and 49 deletions

View File

@ -336,7 +336,10 @@ void BlockTimer::accumulateTimings()
cur_data = &cur_timer->mLastTimerData;
cur_data->mChildTime += cumulative_time_delta;
accumulator = cur_data->mTimerData->getPrimaryAccumulator();
if (cur_data->mTimerData)
{
accumulator = cur_data->mTimerData->getPrimaryAccumulator();
}
cur_timer = cur_timer->mLastTimerData.mCurTimer;
}
@ -572,6 +575,14 @@ void Time::writeLog(std::ostream& os)
}
LLTrace::TimerAccumulator::TimerAccumulator() : mSelfTimeCounter(0),
mTotalTimeCounter(0),
mCalls(0),
mLastCaller(NULL),
mActiveCount(0),
mMoveUpTree(false)
{}
void LLTrace::TimerAccumulator::addSamples( const LLTrace::TimerAccumulator& other )
{
mSelfTimeCounter += other.mSelfTimeCounter;

View File

@ -30,6 +30,8 @@
#include "lltracethreadrecorder.h"
#include "llfasttimer.h"
static bool sInitialized;
namespace LLTrace
{
@ -38,15 +40,18 @@ static MasterThreadRecorder* gMasterThreadRecorder = NULL;
void init()
{
gMasterThreadRecorder = new MasterThreadRecorder();
BlockTimer::sCurTimerData = new CurTimerData();
sInitialized = true;
}
bool isInitialized()
{
return sInitialized;
}
void cleanup()
{
delete gMasterThreadRecorder;
gMasterThreadRecorder = NULL;
delete BlockTimer::sCurTimerData.get();
BlockTimer::sCurTimerData = NULL;
}
MasterThreadRecorder& getMasterThreadRecorder()
@ -62,3 +67,4 @@ LLThreadLocalPointer<ThreadRecorder>& get_thread_recorder()
}
}

View File

@ -67,6 +67,7 @@ namespace LLTrace
void init();
void cleanup();
bool isInitialized();
LLThreadLocalPointer<class ThreadRecorder>& get_thread_recorder();
@ -162,6 +163,10 @@ namespace LLTrace
// NOTE: this is not thread-safe. We assume that slots are reserved in the main thread before any child threads are spawned
size_t reserveSlot()
{
if (LLTrace::isInitialized())
{
llerrs << "Attempting to declare trace object after program initialization. Trace objects should be statically initialized." << llendl;
}
size_t next_slot = mNextStorageSlot++;
if (next_slot >= mStorageSize)
{
@ -383,6 +388,7 @@ namespace LLTrace
class TimerAccumulator
{
public:
TimerAccumulator();
void addSamples(const TimerAccumulator& other);
void reset(const TimerAccumulator* other);

View File

@ -40,6 +40,8 @@ ThreadRecorder::ThreadRecorder()
{
get_thread_recorder() = this;
mFullRecording.start();
BlockTimer::sCurTimerData = new CurTimerData();
}
ThreadRecorder::ThreadRecorder( const ThreadRecorder& other )
@ -52,6 +54,8 @@ ThreadRecorder::ThreadRecorder( const ThreadRecorder& other )
ThreadRecorder::~ThreadRecorder()
{
get_thread_recorder() = NULL;
delete BlockTimer::sCurTimerData.get();
BlockTimer::sCurTimerData = NULL;
}
void ThreadRecorder::activate( Recording* recording )

View File

@ -281,6 +281,8 @@ LLIOPipe::EStatus LLURLRequest::handleError(
static LLFastTimer::DeclareTimer FTM_PROCESS_URL_REQUEST("URL Request");
static LLFastTimer::DeclareTimer FTM_PROCESS_URL_REQUEST_GET_RESULT("Get Result");
static LLFastTimer::DeclareTimer FTM_URL_PERFORM("Perform");
static LLFastTimer::DeclareTimer FTM_PROCESS_URL_PUMP_RESPOND("Pump Respond");
static LLFastTimer::DeclareTimer FTM_URL_ADJUST_TIMEOUT("Adjust Timeout");
// virtual
LLIOPipe::EStatus LLURLRequest::process_impl(
@ -300,7 +302,6 @@ LLIOPipe::EStatus LLURLRequest::process_impl(
const S32 MIN_ACCUMULATION = 100000;
if(pump && (mDetail->mByteAccumulator > MIN_ACCUMULATION))
{
static LLFastTimer::DeclareTimer FTM_URL_ADJUST_TIMEOUT("Adjust Timeout");
LLFastTimer t(FTM_URL_ADJUST_TIMEOUT);
// This is a pretty sloppy calculation, but this
// tries to make the gross assumption that if data
@ -398,7 +399,6 @@ LLIOPipe::EStatus LLURLRequest::process_impl(
link.mChannels = LLBufferArray::makeChannelConsumer(
channels);
chain.push_back(link);
static LLFastTimer::DeclareTimer FTM_PROCESS_URL_PUMP_RESPOND("Pump Respond");
{
LLFastTimer t(FTM_PROCESS_URL_PUMP_RESPOND);
pump->respond(chain, buffer, context);

View File

@ -1137,13 +1137,14 @@ void LLAgentCamera::updateLookAt(const S32 mouse_x, const S32 mouse_y)
}
}
static LLFastTimer::DeclareTimer FTM_UPDATE_CAMERA("Camera");
//-----------------------------------------------------------------------------
// updateCamera()
//-----------------------------------------------------------------------------
void LLAgentCamera::updateCamera()
{
static LLFastTimer::DeclareTimer ftm("Camera");
LLFastTimer t(ftm);
LLFastTimer t(FTM_UPDATE_CAMERA);
// - changed camera_skyward to the new global "mCameraUpVector"
mCameraUpVector = LLVector3::z_axis;

View File

@ -4126,6 +4126,8 @@ static LLFastTimer::DeclareTimer FTM_WORLD_UPDATE("Update World");
static LLFastTimer::DeclareTimer FTM_NETWORK("Network");
static LLFastTimer::DeclareTimer FTM_AGENT_NETWORK("Agent Network");
static LLFastTimer::DeclareTimer FTM_VLMANAGER("VL Manager");
static LLFastTimer::DeclareTimer FTM_AGENT_POSITION("Agent Position");
static LLFastTimer::DeclareTimer FTM_HUD_EFFECTS("HUD Effects");
///////////////////////////////////////////////////////
// idle()
@ -4362,8 +4364,7 @@ void LLAppViewer::idle()
{
// Handle pending gesture processing
static LLFastTimer::DeclareTimer ftm("Agent Position");
LLFastTimer t(ftm);
LLFastTimer t(FTM_AGENT_POSITION);
LLGestureMgr::instance().update();
gAgent.updateAgentPosition(gFrameDTClamped, yaw, current_mouse.mX, current_mouse.mY);
@ -4410,8 +4411,7 @@ void LLAppViewer::idle()
//
{
static LLFastTimer::DeclareTimer ftm("HUD Effects");
LLFastTimer t(ftm);
LLFastTimer t(FTM_HUD_EFFECTS);
LLSelectMgr::getInstance()->updateEffects();
LLHUDManager::getInstance()->cleanupEffects();
LLHUDManager::getInstance()->sendEffects();

View File

@ -396,9 +396,10 @@ LLInventoryFilter::EFolderShow LLInventoryPanel::getShowFolderState()
return getFilter()->getShowFolderState();
}
static LLFastTimer::DeclareTimer FTM_REFRESH("Inventory Refresh");
void LLInventoryPanel::modelChanged(U32 mask)
{
static LLFastTimer::DeclareTimer FTM_REFRESH("Inventory Refresh");
LLFastTimer t2(FTM_REFRESH);
bool handled = false;

View File

@ -2184,7 +2184,7 @@ bool idle_startup()
LLAppViewer::instance()->handleLoginComplete();
// reset timers now that we are running "logged in" logic
LLFastTimer::reset();
LLTrace::BlockTimer::reset();
LLAgentPicksInfo::getInstance()->requestNumberOfPicks();

View File

@ -850,6 +850,8 @@ private:
LLSD mObjectIDs;
};
static LLFastTimer::DeclareTimer FTM_IDLE_COPY("Idle Copy");
void LLViewerObjectList::update(LLAgent &agent, LLWorld &world)
{
// Update globals
@ -900,10 +902,8 @@ void LLViewerObjectList::update(LLAgent &agent, LLWorld &world)
U32 idle_count = 0;
static LLFastTimer::DeclareTimer idle_copy("Idle Copy");
{
LLFastTimer t(idle_copy);
LLFastTimer t(FTM_IDLE_COPY);
for (std::vector<LLPointer<LLViewerObject> >::iterator active_iter = mActiveObjects.begin();
active_iter != mActiveObjects.end(); active_iter++)

View File

@ -2760,11 +2760,12 @@ void append_xui_tooltip(LLView* viewp, LLToolTip::Params& params)
}
}
static LLFastTimer::DeclareTimer ftm("Update UI");
// Update UI based on stored mouse position from mouse-move
// event processing.
void LLViewerWindow::updateUI()
{
static LLFastTimer::DeclareTimer ftm("Update UI");
LLFastTimer t(ftm);
static std::string last_handle_msg;

View File

@ -1886,6 +1886,8 @@ void LLPipeline::updateMovedList(LLDrawable::drawable_vector_t& moved_list)
static LLFastTimer::DeclareTimer FTM_OCTREE_BALANCE("Balance Octree");
static LLFastTimer::DeclareTimer FTM_UPDATE_MOVE("Update Move");
static LLFastTimer::DeclareTimer FTM_RETEXTURE("Retexture");
static LLFastTimer::DeclareTimer FTM_MOVED_LIST("Moved List");
void LLPipeline::updateMove()
{
@ -1899,8 +1901,7 @@ void LLPipeline::updateMove()
assertInitialized();
{
static LLFastTimer::DeclareTimer ftm("Retexture");
LLFastTimer t(ftm);
LLFastTimer t(FTM_RETEXTURE);
for (LLDrawable::drawable_set_t::iterator iter = mRetexturedList.begin();
iter != mRetexturedList.end(); ++iter)
@ -1915,8 +1916,7 @@ void LLPipeline::updateMove()
}
{
static LLFastTimer::DeclareTimer ftm("Moved List");
LLFastTimer t(ftm);
LLFastTimer t(FTM_MOVED_LIST);
updateMovedList(mMovedList);
}
@ -3688,33 +3688,6 @@ void LLPipeline::postSort(LLCamera& camera)
}
}
/*static LLFastTimer::DeclareTimer FTM_TRANSFORM_WAIT("Transform Fence");
static LLFastTimer::DeclareTimer FTM_TRANSFORM_DO_WORK("Transform Work");
if (use_transform_feedback)
{ //using transform feedback, wait for transform feedback to complete
LLFastTimer t(FTM_TRANSFORM_WAIT);
S32 done = 0;
//glGetQueryivARB(GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN, GL_CURRENT_QUERY, &count);
glGetQueryObjectivARB(mMeshDirtyQueryObject, GL_QUERY_RESULT_AVAILABLE, &done);
while (!done)
{
{
LLFastTimer t(FTM_TRANSFORM_DO_WORK);
F32 max_time = llmin(gFrameIntervalSeconds*10.f, 1.f);
//do some useful work while we wait
LLAppViewer::getTextureCache()->update(max_time); // unpauses the texture cache thread
LLAppViewer::getImageDecodeThread()->update(max_time); // unpauses the image thread
LLAppViewer::getTextureFetch()->update(max_time); // unpauses the texture fetch thread
}
glGetQueryObjectivARB(mMeshDirtyQueryObject, GL_QUERY_RESULT_AVAILABLE, &done);
}
mTransformFeedbackPrimitives = 0;
}*/
//LLSpatialGroup::sNoDelete = FALSE;
llpushcallstacks ;
}