summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorRichard Linden <none@none>2013-04-23 18:52:34 -0700
committerRichard Linden <none@none>2013-04-23 18:52:34 -0700
commitc6737163854981d94fde8bdd440eaf4bbc816b4f (patch)
tree06917f606853cb7333f57264d708bba4975ee045 /indra
parent62c8844414b84ee9e8cc488f4e02cbaed5f67a14 (diff)
SH-3931 WIP Interesting: Add graphs to visualize scene load metrics
convert scene monitor to use extendable periodic recording
Diffstat (limited to 'indra')
-rw-r--r--indra/llcommon/lltracerecording.cpp61
-rw-r--r--indra/llcommon/lltracerecording.h56
-rw-r--r--indra/newview/llscenemonitor.cpp2
-rw-r--r--indra/newview/llscenemonitor.h4
4 files changed, 76 insertions, 47 deletions
diff --git a/indra/llcommon/lltracerecording.cpp b/indra/llcommon/lltracerecording.cpp
index 2917c217d7..af7b61dd4e 100644
--- a/indra/llcommon/lltracerecording.cpp
+++ b/indra/llcommon/lltracerecording.cpp
@@ -464,8 +464,62 @@ void PeriodicRecording::appendPeriodicRecording( PeriodicRecording& other )
other.setPlayState(other_play_state);
}
+LLUnit<LLUnits::Seconds, F64> PeriodicRecording::getDuration()
+{
+ LLUnit<LLUnits::Seconds, F64> duration;
+ size_t num_periods = mRecordingPeriods.size();
+ for (size_t i = 1; i <= num_periods; i++)
+ {
+ size_t index = (mCurPeriod + num_periods - i) % num_periods;
+ duration += mRecordingPeriods[index].getDuration();
+ }
+ return duration;
+}
+LLTrace::Recording PeriodicRecording::snapshotCurRecording() const
+{
+ Recording recording_copy(getCurRecording());
+ recording_copy.stop();
+ return recording_copy;
+}
+
+
+Recording& PeriodicRecording::getLastRecording()
+{
+ U32 num_periods = mRecordingPeriods.size();
+ return mRecordingPeriods[(mCurPeriod + num_periods - 1) % num_periods];
+}
+
+const Recording& PeriodicRecording::getLastRecording() const
+{
+ return getPrevRecording(1);
+}
+
+Recording& PeriodicRecording::getCurRecording()
+{
+ return mRecordingPeriods[mCurPeriod];
+}
+
+const Recording& PeriodicRecording::getCurRecording() const
+{
+ return mRecordingPeriods[mCurPeriod];
+}
+
+Recording& PeriodicRecording::getPrevRecording( U32 offset )
+{
+ U32 num_periods = mRecordingPeriods.size();
+ offset = llclamp(offset, 0u, num_periods - 1);
+ return mRecordingPeriods[(mCurPeriod + num_periods - offset) % num_periods];
+}
+
+const Recording& PeriodicRecording::getPrevRecording( U32 offset ) const
+{
+ U32 num_periods = mRecordingPeriods.size();
+ offset = llclamp(offset, 0u, num_periods - 1);
+ return mRecordingPeriods[(mCurPeriod + num_periods - offset) % num_periods];
+}
+
void PeriodicRecording::start()
{
getCurRecording().start();
@@ -577,6 +631,13 @@ void ExtendableRecording::splitFrom(ExtendableRecording& other)
// ExtendablePeriodicRecording
///////////////////////////////////////////////////////////////////////
+
+ExtendablePeriodicRecording::ExtendablePeriodicRecording()
+: mAcceptedRecording(0),
+ mPotentialRecording(0)
+{
+}
+
void ExtendablePeriodicRecording::extend()
{
// stop recording to get latest data
diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h
index 23b031b49b..84006a10b8 100644
--- a/indra/llcommon/lltracerecording.h
+++ b/indra/llcommon/lltracerecording.h
@@ -254,49 +254,16 @@ namespace LLTrace
void nextPeriod();
U32 getNumPeriods() { return mRecordingPeriods.size(); }
- void appendPeriodicRecording(PeriodicRecording& other);
-
- Recording& getLastRecording()
- {
- U32 num_periods = mRecordingPeriods.size();
- return mRecordingPeriods[(mCurPeriod + num_periods - 1) % num_periods];
- }
-
- const Recording& getLastRecording() const
- {
- return getPrevRecording(1);
- }
-
- Recording& getCurRecording()
- {
- return mRecordingPeriods[mCurPeriod];
- }
-
- const Recording& getCurRecording() const
- {
- return mRecordingPeriods[mCurPeriod];
- }
-
- Recording& getPrevRecording(U32 offset)
- {
- U32 num_periods = mRecordingPeriods.size();
- offset = llclamp(offset, 0u, num_periods - 1);
- return mRecordingPeriods[(mCurPeriod + num_periods - offset) % num_periods];
- }
+ LLUnit<LLUnits::Seconds, F64> getDuration();
- const Recording& getPrevRecording(U32 offset) const
- {
- U32 num_periods = mRecordingPeriods.size();
- offset = llclamp(offset, 0u, num_periods - 1);
- return mRecordingPeriods[(mCurPeriod + num_periods - offset) % num_periods];
- }
-
- Recording snapshotCurRecording() const
- {
- Recording recording_copy(getCurRecording());
- recording_copy.stop();
- return recording_copy;
- }
+ void appendPeriodicRecording(PeriodicRecording& other);
+ Recording& getLastRecording();
+ const Recording& getLastRecording() const;
+ Recording& getCurRecording();
+ const Recording& getCurRecording() const;
+ Recording& getPrevRecording(U32 offset);
+ const Recording& getPrevRecording(U32 offset) const;
+ Recording snapshotCurRecording() const;
template <typename T>
typename T::value_t getPeriodMin(const TraceType<T>& stat, size_t num_periods = U32_MAX) const
@@ -447,10 +414,11 @@ namespace LLTrace
: public LLStopWatchControlsMixin<ExtendablePeriodicRecording>
{
public:
+ ExtendablePeriodicRecording();
void extend();
- PeriodicRecording& getAcceptedRecording() { return mAcceptedRecording; }
- const PeriodicRecording& getAcceptedRecording() const {return mAcceptedRecording;}
+ PeriodicRecording& getAcceptedRecording() { return mAcceptedRecording; }
+ const PeriodicRecording& getAcceptedRecording() const {return mAcceptedRecording;}
// implementation for LLStopWatchControlsMixin
/*virtual*/ void start();
diff --git a/indra/newview/llscenemonitor.cpp b/indra/newview/llscenemonitor.cpp
index 15fe77f028..7f7e61cc88 100644
--- a/indra/newview/llscenemonitor.cpp
+++ b/indra/newview/llscenemonitor.cpp
@@ -73,7 +73,7 @@ LLSceneMonitor::LLSceneMonitor() :
mFrames[0] = NULL;
mFrames[1] = NULL;
- mRecording = new LLTrace::ExtendableRecording();
+ mRecording = new LLTrace::ExtendablePeriodicRecording();
mRecording->start();
}
diff --git a/indra/newview/llscenemonitor.h b/indra/newview/llscenemonitor.h
index c897b237b6..45a5241924 100644
--- a/indra/newview/llscenemonitor.h
+++ b/indra/newview/llscenemonitor.h
@@ -63,7 +63,7 @@ public:
bool isEnabled()const {return mEnabled;}
bool needsUpdate() const;
- LLTrace::ExtendableRecording* getRecording() const {return mRecording;}
+ LLTrace::ExtendablePeriodicRecording* getRecording() const {return mRecording;}
void dumpToFile(std::string file_name);
bool hasResults() const { return !mMonitorResults.empty();}
@@ -102,7 +102,7 @@ private:
std::vector<LLAnimPauseRequest> mAvatarPauseHandles;
- LLTrace::ExtendableRecording* mRecording;
+ LLTrace::ExtendablePeriodicRecording* mRecording;
//---------------------------------------
typedef struct _monitor_result