summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Linden <none@none>2012-11-16 23:02:53 -0800
committerRichard Linden <none@none>2012-11-16 23:02:53 -0800
commit6db6cb39f41e921e75970d1570a74cf35d353a35 (patch)
tree141e276bfb93ba8b3b7f3ff12d730f3f3cbf5f22
parentc136b432140f892a56d4996d5ed77e903ff0b32d (diff)
SH-3406 WIP convert fast timers to lltrace system
got new fast timer code to compile and run
-rw-r--r--indra/llcommon/llfasttimer.cpp13
-rw-r--r--indra/llcommon/lltrace.cpp12
-rw-r--r--indra/llcommon/lltrace.h6
-rw-r--r--indra/llcommon/lltracethreadrecorder.cpp4
-rw-r--r--indra/llmessage/llurlrequest.cpp4
-rw-r--r--indra/newview/llagentcamera.cpp5
-rw-r--r--indra/newview/llappviewer.cpp8
-rw-r--r--indra/newview/llinventorypanel.cpp3
-rwxr-xr-xindra/newview/llstartup.cpp2
-rw-r--r--indra/newview/llviewerobjectlist.cpp6
-rwxr-xr-xindra/newview/llviewerwindow.cpp3
-rw-r--r--indra/newview/pipeline.cpp35
12 files changed, 52 insertions, 49 deletions
diff --git a/indra/llcommon/llfasttimer.cpp b/indra/llcommon/llfasttimer.cpp
index 4ecca12832..e1549b4bff 100644
--- a/indra/llcommon/llfasttimer.cpp
+++ b/indra/llcommon/llfasttimer.cpp
@@ -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;
diff --git a/indra/llcommon/lltrace.cpp b/indra/llcommon/lltrace.cpp
index 9bf9ae6c8e..e11e39a1a2 100644
--- a/indra/llcommon/lltrace.cpp
+++ b/indra/llcommon/lltrace.cpp
@@ -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()
}
}
+
diff --git a/indra/llcommon/lltrace.h b/indra/llcommon/lltrace.h
index 61fed6e7b8..61d14569cd 100644
--- a/indra/llcommon/lltrace.h
+++ b/indra/llcommon/lltrace.h
@@ -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);
diff --git a/indra/llcommon/lltracethreadrecorder.cpp b/indra/llcommon/lltracethreadrecorder.cpp
index 0f111aab59..c2fefe2957 100644
--- a/indra/llcommon/lltracethreadrecorder.cpp
+++ b/indra/llcommon/lltracethreadrecorder.cpp
@@ -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 )
diff --git a/indra/llmessage/llurlrequest.cpp b/indra/llmessage/llurlrequest.cpp
index 982f4804f0..0e5fe1de08 100644
--- a/indra/llmessage/llurlrequest.cpp
+++ b/indra/llmessage/llurlrequest.cpp
@@ -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);
diff --git a/indra/newview/llagentcamera.cpp b/indra/newview/llagentcamera.cpp
index 8d80e3aa0a..4e6079e3f2 100644
--- a/indra/newview/llagentcamera.cpp
+++ b/indra/newview/llagentcamera.cpp
@@ -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;
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index 9d4ed833b8..547eb2fefe 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -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();
diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp
index f7567baa2b..4c10717ce8 100644
--- a/indra/newview/llinventorypanel.cpp
+++ b/indra/newview/llinventorypanel.cpp
@@ -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;
diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp
index bf47bd44c3..5f6772bf0b 100755
--- a/indra/newview/llstartup.cpp
+++ b/indra/newview/llstartup.cpp
@@ -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();
diff --git a/indra/newview/llviewerobjectlist.cpp b/indra/newview/llviewerobjectlist.cpp
index 9c6045943f..1bd028688a 100644
--- a/indra/newview/llviewerobjectlist.cpp
+++ b/indra/newview/llviewerobjectlist.cpp
@@ -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++)
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp
index 8e72ca1d74..dea55fd0b0 100755
--- a/indra/newview/llviewerwindow.cpp
+++ b/indra/newview/llviewerwindow.cpp
@@ -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;
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index 5ac5ae892a..acf3a4e74c 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -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 ;
}