summaryrefslogtreecommitdiff
path: root/indra/newview/llappviewer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llappviewer.cpp')
-rw-r--r--indra/newview/llappviewer.cpp108
1 files changed, 43 insertions, 65 deletions
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index 30f82926f1..86a241fa58 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -60,7 +60,8 @@
#include "llcurl.h"
#include "llcalc.h"
#include "lltexturestats.h"
-#include "lltexturestats.h"
+#include "lltrace.h"
+#include "lltracethreadrecorder.h"
#include "llviewerwindow.h"
#include "llviewerdisplay.h"
#include "llviewermedia.h"
@@ -277,7 +278,7 @@ LLPumpIO* gServicePump = NULL;
U64 gFrameTime = 0;
F32 gFrameTimeSeconds = 0.f;
-F32 gFrameIntervalSeconds = 0.f;
+LLUnit<LLUnits::Seconds, F32> gFrameIntervalSeconds = 0.f;
F32 gFPSClamped = 10.f; // Pretend we start at target rate.
F32 gFrameDTClamped = 0.f; // Time between adjacent checks to network for packets
U64 gStartTime = 0; // gStartTime is "private", used only to calculate gFrameTimeSeconds
@@ -591,7 +592,7 @@ public:
while (!LLAppViewer::instance()->isQuitting())
{
- LLFastTimer::writeLog(os);
+ LLTrace::TimeBlock::writeLog(os);
os.flush();
ms_sleep(32);
}
@@ -679,7 +680,6 @@ bool LLAppViewer::init()
// into the log files during normal startup until AFTER
// we run the "program crashed last time" error handler below.
//
- LLFastTimer::reset();
// initialize SSE options
LLVector4a::initClass();
@@ -731,14 +731,14 @@ bool LLAppViewer::init()
mAlloc.setProfilingEnabled(gSavedSettings.getBOOL("MemProfiling"));
-#if LL_RECORD_VIEWER_STATS
- LLViewerStatsRecorder::initClass();
-#endif
-
// Initialize the non-LLCurl libcurl library. Should be called
// before consumers (LLTextureFetch).
mAppCoreHttp.init();
+#if LL_RECORD_VIEWER_STATS
+ LLViewerStatsRecorder::initClass();
+#endif
+
// *NOTE:Mani - LLCurl::initClass is not thread safe.
// Called before threads are created.
LLCurl::initClass(gSavedSettings.getF32("CurlRequestTimeOut"),
@@ -808,9 +808,6 @@ bool LLAppViewer::init()
//////////////////////////////////////////////////////////////////////////////
// *FIX: The following code isn't grouped into functions yet.
- // Statistics / debug timer initialization
- init_statistics();
-
//
// Various introspection concerning the libs we're using - particularly
// the libs involved in getting to a full login screen.
@@ -1196,9 +1193,10 @@ static LLFastTimer::DeclareTimer FTM_SERVICE_CALLBACK("Callback");
static LLFastTimer::DeclareTimer FTM_AGENT_AUTOPILOT("Autopilot");
static LLFastTimer::DeclareTimer FTM_AGENT_UPDATE("Update");
+LLFastTimer::DeclareTimer FTM_FRAME("Frame", true);
+
bool LLAppViewer::mainLoop()
{
- LLMemType mt1(LLMemType::MTYPE_MAIN);
mMainloopTimeout = new LLWatchdogTimeout();
//-------------------------------------------
@@ -1234,7 +1232,11 @@ bool LLAppViewer::mainLoop()
// Handle messages
while (!LLApp::isExiting())
{
- LLFastTimer::nextFrame(); // Should be outside of any timer instances
+ LLFastTimer _(FTM_FRAME);
+ LLTrace::get_frame_recording().nextPeriod();
+ LLTrace::TimeBlock::logStats();
+
+ LLTrace::getMasterThreadRecorder().pullFromSlaveThreads();
//clear call stack records
llclearcallstacks;
@@ -1298,7 +1300,6 @@ bool LLAppViewer::mainLoop()
&& (gHeadlessClient || !gViewerWindow->getShowProgress())
&& !gFocusMgr.focusLocked())
{
- LLMemType mjk(LLMemType::MTYPE_JOY_KEY);
joystick->scanJoystick();
gKeyboard->scanKeyboard();
}
@@ -1312,7 +1313,6 @@ bool LLAppViewer::mainLoop()
if (gAres != NULL && gAres->isInitialized())
{
- LLMemType mt_ip(LLMemType::MTYPE_IDLE_PUMP);
pingMainloopTimeout("Main:ServicePump");
LLFastTimer t4(FTM_PUMP);
{
@@ -1353,7 +1353,6 @@ bool LLAppViewer::mainLoop()
LLFloaterSnapshot::update(); // take snapshots
gGLActive = FALSE;
}
-
}
pingMainloopTimeout("Main:Sleep");
@@ -1362,7 +1361,6 @@ bool LLAppViewer::mainLoop()
// Sleep and run background threads
{
- LLMemType mt_sleep(LLMemType::MTYPE_SLEEP);
LLFastTimer t2(FTM_SLEEP);
// yield some time to the os based on command line option
@@ -1409,7 +1407,7 @@ bool LLAppViewer::mainLoop()
{
S32 work_pending = 0;
S32 io_pending = 0;
- F32 max_time = llmin(gFrameIntervalSeconds*10.f, 1.f);
+ F32 max_time = llmin(gFrameIntervalSeconds.value() *10.f, 1.f);
{
LLFastTimer ftm(FTM_TEXTURE_CACHE);
@@ -1566,9 +1564,9 @@ bool LLAppViewer::cleanup()
if (LLFastTimerView::sAnalyzePerformance)
{
llinfos << "Analyzing performance" << llendl;
- std::string baseline_name = LLFastTimer::sLogName + "_baseline.slp";
- std::string current_name = LLFastTimer::sLogName + ".slp";
- std::string report_name = LLFastTimer::sLogName + "_report.csv";
+ std::string baseline_name = LLTrace::TimeBlock::sLogName + "_baseline.slp";
+ std::string current_name = LLTrace::TimeBlock::sLogName + ".slp";
+ std::string report_name = LLTrace::TimeBlock::sLogName + "_report.csv";
LLFastTimerView::doAnalysis(
gDirUtilp->getExpandedFilename(LL_PATH_LOGS, baseline_name),
@@ -1927,9 +1925,9 @@ bool LLAppViewer::cleanup()
{
llinfos << "Analyzing performance" << llendl;
- std::string baseline_name = LLFastTimer::sLogName + "_baseline.slp";
- std::string current_name = LLFastTimer::sLogName + ".slp";
- std::string report_name = LLFastTimer::sLogName + "_report.csv";
+ std::string baseline_name = LLTrace::TimeBlock::sLogName + "_baseline.slp";
+ std::string current_name = LLTrace::TimeBlock::sLogName + ".slp";
+ std::string report_name = LLTrace::TimeBlock::sLogName + "_report.csv";
LLFastTimerView::doAnalysis(
gDirUtilp->getExpandedFilename(LL_PATH_LOGS, baseline_name),
@@ -1939,10 +1937,6 @@ bool LLAppViewer::cleanup()
LLMetricPerformanceTesterBasic::cleanClass() ;
-#if LL_RECORD_VIEWER_STATS
- LLViewerStatsRecorder::cleanupClass();
-#endif
-
llinfos << "Cleaning up Media and Textures" << llendflush;
//Note:
@@ -2056,10 +2050,10 @@ bool LLAppViewer::initThreads()
enable_threads && true,
app_metrics_qa_mode);
- if (LLFastTimer::sLog || LLFastTimer::sMetricLog)
+ if (LLTrace::TimeBlock::sLog || LLTrace::TimeBlock::sMetricLog)
{
- LLFastTimer::sLogLock = new LLMutex(NULL);
- mFastTimerLogThread = new LLFastTimerLogThread(LLFastTimer::sLogName);
+ LLTrace::TimeBlock::setLogLock(new LLMutex(NULL));
+ mFastTimerLogThread = new LLFastTimerLogThread(LLTrace::TimeBlock::sLogName);
mFastTimerLogThread->start();
}
@@ -2468,13 +2462,13 @@ bool LLAppViewer::initConfiguration()
if (clp.hasOption("logperformance"))
{
- LLFastTimer::sLog = TRUE;
- LLFastTimer::sLogName = std::string("performance");
+ LLTrace::TimeBlock::sLog = true;
+ LLTrace::TimeBlock::sLogName = std::string("performance");
}
if (clp.hasOption("logmetrics"))
{
- LLFastTimer::sMetricLog = TRUE ;
+ LLTrace::TimeBlock::sMetricLog = true ;
// '--logmetrics' can be specified with a named test metric argument so the data gathering is done only on that test
// In the absence of argument, every metric is gathered (makes for a rather slow run and hard to decipher report...)
std::string test_name = clp.getOption("logmetrics")[0];
@@ -2482,11 +2476,11 @@ bool LLAppViewer::initConfiguration()
if (test_name == "")
{
llwarns << "No '--logmetrics' argument given, will output all metrics to " << DEFAULT_METRIC_NAME << llendl;
- LLFastTimer::sLogName = DEFAULT_METRIC_NAME;
+ LLTrace::TimeBlock::sLogName = DEFAULT_METRIC_NAME;
}
else
{
- LLFastTimer::sLogName = test_name;
+ LLTrace::TimeBlock::sLogName = test_name;
}
}
@@ -3222,8 +3216,6 @@ void LLAppViewer::writeSystemInfo()
LL_INFOS("SystemInfo") << "OS: " << getOSInfo().getOSStringSimple() << LL_ENDL;
LL_INFOS("SystemInfo") << "OS info: " << getOSInfo() << LL_ENDL;
- LL_INFOS("SystemInfo") << "Timers: " << LLFastTimer::sClockType << LL_ENDL;
-
writeDebugInfo(); // Save out debug_info.log early, in case of crash.
}
@@ -4198,6 +4190,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()
@@ -4207,7 +4201,6 @@ static LLFastTimer::DeclareTimer FTM_VLMANAGER("VL Manager");
///////////////////////////////////////////////////////
void LLAppViewer::idle()
{
- LLMemType mt_idle(LLMemType::MTYPE_IDLE);
pingMainloopTimeout("Main:Idle");
// Update frame timers
@@ -4320,7 +4313,6 @@ void LLAppViewer::idle()
// of SEND_STATS_PERIOD so that the initial stats report will
// be sent immediately.
static LLFrameStatsTimer viewer_stats_timer(SEND_STATS_PERIOD);
- reset_statistics();
// Update session stats every large chunk of time
// *FIX: (???) SAMANTHA
@@ -4352,10 +4344,6 @@ void LLAppViewer::idle()
gObjectList.mNumUnknownUpdates = 0;
}
- // ViewerMetrics FPS piggy-backing on the debug timer.
- // The 5-second interval is nice for this purpose. If the object debug
- // bit moves or is disabled, please give this a suitable home.
- LLViewerAssetStatsFF::record_fps_main(gFPSClamped);
LLViewerAssetStatsFF::record_avatar_stats();
}
}
@@ -4380,7 +4368,7 @@ void LLAppViewer::idle()
idle_afk_check();
// Update statistics for this frame
- update_statistics(gFrameCount);
+ update_statistics();
}
////////////////////////////////////////
@@ -4437,8 +4425,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);
@@ -4485,8 +4472,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();
@@ -4806,7 +4792,6 @@ static LLFastTimer::DeclareTimer FTM_CHECK_REGION_CIRCUIT("Check Region Circuit"
void LLAppViewer::idleNetwork()
{
- LLMemType mt_in(LLMemType::MTYPE_IDLE_NETWORK);
pingMainloopTimeout("idleNetwork");
gObjectList.mNumNewObjects = 0;
@@ -4885,7 +4870,7 @@ void LLAppViewer::idleNetwork()
gPrintMessagesThisFrame = FALSE;
}
}
- LLViewerStats::getInstance()->mNumNewObjectsStat.addValue(gObjectList.mNumNewObjects);
+ LLStatViewer::NUM_NEW_OBJECTS.sample(gObjectList.mNumNewObjects);
// Retransmit unacknowledged packets.
gXferManager->retransmitUnackedPackets();
@@ -5295,17 +5280,7 @@ void LLAppViewer::metricsUpdateRegion(U64 region_handle)
{
if (0 != region_handle)
{
- LLViewerAssetStatsFF::set_region_main(region_handle);
- if (LLAppViewer::sTextureFetch)
- {
- // Send a region update message into 'thread1' to get the new region.
- LLAppViewer::sTextureFetch->commandSetRegion(region_handle);
- }
- else
- {
- // No 'thread1', a.k.a. TextureFetch, so update directly
- LLViewerAssetStatsFF::set_region_thread1(region_handle);
- }
+ LLViewerAssetStatsFF::set_region(region_handle);
}
}
@@ -5316,7 +5291,7 @@ void LLAppViewer::metricsUpdateRegion(U64 region_handle)
*/
void LLAppViewer::metricsSend(bool enable_reporting)
{
- if (! gViewerAssetStatsMain)
+ if (! gViewerAssetStats)
return;
if (LLAppViewer::sTextureFetch)
@@ -5329,7 +5304,10 @@ void LLAppViewer::metricsSend(bool enable_reporting)
// Make a copy of the main stats to send into another thread.
// Receiving thread takes ownership.
- LLViewerAssetStats * main_stats(new LLViewerAssetStats(*gViewerAssetStatsMain));
+ LLViewerAssetStats * main_stats(new LLViewerAssetStats(*gViewerAssetStats));
+ main_stats->stop();
+
+ main_stats->updateStats();
// Send a report request into 'thread1' to get the rest of the data
// and provide some additional parameters while here.
@@ -5348,6 +5326,6 @@ void LLAppViewer::metricsSend(bool enable_reporting)
// Reset even if we can't report. Rather than gather up a huge chunk of
// data, we'll keep to our sampling interval and retain the data
// resolution in time.
- gViewerAssetStatsMain->reset();
+ gViewerAssetStats->reset();
}