summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorRichard Linden <none@none>2013-05-31 16:01:46 -0700
committerRichard Linden <none@none>2013-05-31 16:01:46 -0700
commit9def3590f41dee3cba7760e4443fdc71f5fb2db6 (patch)
tree5bd891d511af528d5ddbcb2ac0b0c759052dd52d /indra
parente50e6004082223fdc0bfd78bc697d48a7f45b379 (diff)
SH-3931 WIP Interesting: Add graphs to visualize scene load metrics
fixed multithreading lltrace causing values to be interpolated towards 0 added Radians unit improved sceneloadmonitor restart heuristic to use accumulated camera motion
Diffstat (limited to 'indra')
-rw-r--r--indra/llcommon/lltrace.h8
-rw-r--r--indra/llcommon/lltracerecording.cpp2
-rw-r--r--indra/llcommon/lltracerecording.h9
-rw-r--r--indra/llcommon/lltracethreadrecorder.cpp2
-rw-r--r--indra/llcommon/llunit.h3
-rw-r--r--indra/newview/llappviewer.cpp5
-rw-r--r--indra/newview/llscenemonitor.cpp32
-rw-r--r--indra/newview/llscenemonitor.h9
8 files changed, 32 insertions, 38 deletions
diff --git a/indra/llcommon/lltrace.h b/indra/llcommon/lltrace.h
index 6dfe9e4b4e..0daac95ea4 100644
--- a/indra/llcommon/lltrace.h
+++ b/indra/llcommon/lltrace.h
@@ -504,9 +504,11 @@ public:
LLUnitImplicit<LLUnits::Seconds, F64> time_stamp = LLTimer::getTotalSeconds();
LLUnitImplicit<LLUnits::Seconds, F64> delta_time = time_stamp - mLastSampleTimeStamp;
- mSum += (F64)mLastValue * delta_time;
-
- mTotalSamplingTime += delta_time;
+ if (mHasValue)
+ {
+ mSum += (F64)mLastValue * delta_time;
+ mTotalSamplingTime += delta_time;
+ }
mLastSampleTimeStamp = time_stamp;
}
diff --git a/indra/llcommon/lltracerecording.cpp b/indra/llcommon/lltracerecording.cpp
index 3994e4f521..e45639a034 100644
--- a/indra/llcommon/lltracerecording.cpp
+++ b/indra/llcommon/lltracerecording.cpp
@@ -538,7 +538,7 @@ void PeriodicRecording::appendPeriodicRecording( PeriodicRecording& other )
other.setPlayState(other_play_state);
}
-LLUnit<LLUnits::Seconds, F64> PeriodicRecording::getDuration()
+LLUnit<LLUnits::Seconds, F64> PeriodicRecording::getDuration() const
{
LLUnit<LLUnits::Seconds, F64> duration;
size_t num_periods = mRecordingPeriods.size();
diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h
index aaeb32e891..4a77dfb1f6 100644
--- a/indra/llcommon/lltracerecording.h
+++ b/indra/llcommon/lltracerecording.h
@@ -308,7 +308,7 @@ namespace LLTrace
void nextPeriod();
U32 getNumPeriods() { return mRecordingPeriods.size(); }
- LLUnit<LLUnits::Seconds, F64> getDuration();
+ LLUnit<LLUnits::Seconds, F64> getDuration() const;
void appendPeriodicRecording(PeriodicRecording& other);
Recording& getLastRecording();
@@ -356,7 +356,7 @@ namespace LLTrace
size_t total_periods = mRecordingPeriods.size();
num_periods = llmin(num_periods, total_periods);
- typename T min_val = std::numeric_limits<T>::max();
+ T min_val = std::numeric_limits<T>::max();
for (S32 i = 1; i <= num_periods; i++)
{
S32 index = (mCurPeriod + total_periods - i) % total_periods;
@@ -397,7 +397,7 @@ namespace LLTrace
}
template <typename T>
- typename T getPeriodMax(const TraceType<SampleAccumulator<T> >& stat, size_t num_periods = U32_MAX) const
+ T getPeriodMax(const TraceType<SampleAccumulator<T> >& stat, size_t num_periods = U32_MAX) const
{
size_t total_periods = mRecordingPeriods.size();
num_periods = llmin(num_periods, total_periods);
@@ -412,7 +412,7 @@ namespace LLTrace
}
template <typename T>
- typename T getPeriodMax(const TraceType<EventAccumulator<T> >& stat, size_t num_periods = U32_MAX) const
+ T getPeriodMax(const TraceType<EventAccumulator<T> >& stat, size_t num_periods = U32_MAX) const
{
size_t total_periods = mRecordingPeriods.size();
num_periods = llmin(num_periods, total_periods);
@@ -551,7 +551,6 @@ namespace LLTrace
private:
std::vector<Recording> mRecordingPeriods;
- Recording mTotalRecording;
const bool mAutoResize;
S32 mCurPeriod;
};
diff --git a/indra/llcommon/lltracethreadrecorder.cpp b/indra/llcommon/lltracethreadrecorder.cpp
index 75c7cb2ff1..c281b768ce 100644
--- a/indra/llcommon/lltracethreadrecorder.cpp
+++ b/indra/llcommon/lltracethreadrecorder.cpp
@@ -247,7 +247,7 @@ void SlaveThreadRecorder::SharedData::reset()
// MasterThreadRecorder
///////////////////////////////////////////////////////////////////////
-LLFastTimer::DeclareTimer FTM_PULL_TRACE_DATA_FROM_SLAVES("Pull slave trace data");
+static LLFastTimer::DeclareTimer FTM_PULL_TRACE_DATA_FROM_SLAVES("Pull slave trace data");
void MasterThreadRecorder::pullFromSlaveThreads()
{
LLFastTimer _(FTM_PULL_TRACE_DATA_FROM_SLAVES);
diff --git a/indra/llcommon/llunit.h b/indra/llcommon/llunit.h
index f86f111b90..e2803c74b0 100644
--- a/indra/llcommon/llunit.h
+++ b/indra/llcommon/llunit.h
@@ -471,6 +471,9 @@ struct Hertz { typedef Hertz base_unit_t; };
LL_DECLARE_DERIVED_UNIT(1000, Hertz, Kilohertz);
LL_DECLARE_DERIVED_UNIT(1000 * 1000, Hertz, Megahertz);
LL_DECLARE_DERIVED_UNIT(1000 * 1000 * 1000, Hertz, Gigahertz);
+
+struct Radians { typedef Radians base_unit_t; };
+LL_DECLARE_DERIVED_UNIT(DEG_TO_RAD, Radians, Degrees);
} // namespace LLUnits
#endif // LL_LLUNIT_H
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index ff481d6278..451ea76a02 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -1578,10 +1578,7 @@ bool LLAppViewer::cleanup()
LLEventPumps::instance().reset();
//dump scene loading monitor results
- if(LLSceneMonitor::instance().hasResults())
- {
- LLSceneMonitor::instance().dumpToFile(gDirUtilp->getExpandedFilename(LL_PATH_LOGS, "scene_monitor_results.csv"));
- }
+ LLSceneMonitor::instance().dumpToFile(gDirUtilp->getExpandedFilename(LL_PATH_LOGS, "scene_monitor_results.csv"));
if (LLFastTimerView::sAnalyzePerformance)
{
diff --git a/indra/newview/llscenemonitor.cpp b/indra/newview/llscenemonitor.cpp
index a28c2eac20..7eb48eb575 100644
--- a/indra/newview/llscenemonitor.cpp
+++ b/indra/newview/llscenemonitor.cpp
@@ -67,22 +67,13 @@ LLSceneMonitor::LLSceneMonitor() :
{
mFrames[0] = NULL;
mFrames[1] = NULL;
-
- mRecording = new LLTrace::ExtendablePeriodicRecording();
}
LLSceneMonitor::~LLSceneMonitor()
{
mDiffState = VIEWER_QUITTING;
- destroyClass();
-}
-
-void LLSceneMonitor::destroyClass()
-{
reset();
- delete mRecording;
- mRecording = NULL;
mDitheringTexture = NULL;
}
@@ -96,7 +87,8 @@ void LLSceneMonitor::reset()
mFrames[1] = NULL;
mDiff = NULL;
- mRecording->reset();
+ mMonitorRecording.reset();
+ mSceneLoadRecording.reset();
unfreezeScene();
@@ -269,10 +261,9 @@ void LLSceneMonitor::capture()
static LLCachedControl<F32> scene_load_sample_time(gSavedSettings, "SceneLoadingMonitorSampleTime");
static LLFrameTimer timer;
- LLTrace::Recording& last_frame_recording = LLTrace::get_frame_recording().getLastRecording();
if (mEnabled
- && (last_frame_recording.getSum(*LLViewerCamera::getVelocityStat()) > 0.001f
- || last_frame_recording.getSum(*LLViewerCamera::getAngularVelocityStat()) > 0.01f))
+ && (mMonitorRecording.getSum(*LLViewerCamera::getVelocityStat()) > 0.1f
+ || mMonitorRecording.getSum(*LLViewerCamera::getAngularVelocityStat()) > 0.05f))
{
reset();
freezeScene();
@@ -299,7 +290,8 @@ void LLSceneMonitor::capture()
&& LLGLSLShader::sNoFixedFunction
&& last_capture_time != gFrameCount)
{
- mRecording->resume();
+ mSceneLoadRecording.resume();
+ mMonitorRecording.resume();
timer.reset();
@@ -486,13 +478,13 @@ void LLSceneMonitor::fetchQueryResult()
static LLCachedControl<F32> diff_threshold(gSavedSettings,"SceneLoadingPixelDiffThreshold");
if(mDiffResult > diff_threshold())
{
- mRecording->extend();
- llassert(mRecording->getAcceptedRecording().getLastRecording().getSum(LLStatViewer::FPS));
+ mSceneLoadRecording.extend();
+ llassert(mSceneLoadRecording.getAcceptedRecording().getLastRecording().getSum(LLStatViewer::FPS));
}
else
{
- mRecording->getPotentialRecording().nextPeriod();
- llassert(mRecording->getPotentialRecording().getLastRecording().getSum(LLStatViewer::FPS));
+ mSceneLoadRecording.getPotentialRecording().nextPeriod();
+ llassert(mSceneLoadRecording.getPotentialRecording().getLastRecording().getSum(LLStatViewer::FPS));
}
}
}
@@ -501,13 +493,15 @@ void LLSceneMonitor::fetchQueryResult()
//dump results to a file _scene_xmonitor_results.csv
void LLSceneMonitor::dumpToFile(std::string file_name)
{
+ if (!hasResults()) return;
+
LL_INFOS("SceneMonitor") << "Saving scene load stats to " << file_name << LL_ENDL;
std::ofstream os(file_name.c_str());
os << std::setprecision(4);
- LLTrace::PeriodicRecording& scene_load_recording = mRecording->getAcceptedRecording();
+ LLTrace::PeriodicRecording& scene_load_recording = mSceneLoadRecording.getAcceptedRecording();
U32 frame_count = scene_load_recording.getNumPeriods();
LLUnit<LLUnits::Seconds, F64> frame_time;
diff --git a/indra/newview/llscenemonitor.h b/indra/newview/llscenemonitor.h
index 3351ed0579..6af58b707a 100644
--- a/indra/newview/llscenemonitor.h
+++ b/indra/newview/llscenemonitor.h
@@ -44,8 +44,6 @@ public:
LLSceneMonitor();
~LLSceneMonitor();
- void destroyClass();
-
void freezeAvatar(LLCharacter* avatarp);
void setDebugViewerVisible(bool visible);
@@ -62,9 +60,9 @@ public:
bool isEnabled()const {return mEnabled;}
bool needsUpdate() const;
- LLTrace::ExtendablePeriodicRecording* getRecording() const {return mRecording;}
+ const LLTrace::ExtendablePeriodicRecording* getRecording() const {return &mSceneLoadRecording;}
void dumpToFile(std::string file_name);
- bool hasResults() const { return mRecording->getAcceptedRecording().getDuration() != 0;}
+ bool hasResults() const { return mSceneLoadRecording.getAcceptedRecording().getDuration() != 0;}
private:
void freezeScene();
@@ -103,7 +101,8 @@ private:
std::vector<LLAnimPauseRequest> mAvatarPauseHandles;
- LLTrace::ExtendablePeriodicRecording* mRecording;
+ LLTrace::ExtendablePeriodicRecording mSceneLoadRecording;
+ LLTrace::Recording mMonitorRecording;
};
class LLSceneMonitorView : public LLFloater