SH-3931 WIP Interesting: Add graphs to visualize scene load metrics

scene monitor output is cleaned up, no duplicate first frame, less scientific notation
periodic recording extension now works more cleanly
meow-7.2.2
Richard Linden 2013-06-19 20:30:41 -07:00
parent 1236c920ea
commit 3fe19d883d
4 changed files with 58 additions and 39 deletions

View File

@ -428,36 +428,49 @@ void PeriodicRecording::appendPeriodicRecording( PeriodicRecording& other )
getCurRecording().update();
other.getCurRecording().update();
const U32 other_recording_slots = other.mRecordingPeriods.size();
const U32 other_num_recordings = other.getNumRecordedPeriods();
const U32 other_current_recording_index = other.mCurPeriod;
const U32 other_oldest_recording_index = (other_current_recording_index + other_recording_slots - other_num_recordings + 1) % other_recording_slots;
// append first recording into our current slot
getCurRecording().appendRecording(other.mRecordingPeriods[other_oldest_recording_index]);
// from now on, add new recordings for everything after the first
U32 other_index = (other_oldest_recording_index + 1) % other_recording_slots;
if (mAutoResize)
{
S32 other_index = (other.mCurPeriod + 1) % other.mRecordingPeriods.size();
S32 end_index = (other.mCurPeriod) % other.mRecordingPeriods.size();
// append first recording into our current slot
getCurRecording().appendRecording(other.mRecordingPeriods[other_oldest_recording_index]);
do
// push back recordings for everything in the middle
U32 other_index = (other_oldest_recording_index + 1) % other_recording_slots;
while (other_index != other_current_recording_index)
{
if (other.mRecordingPeriods[other_index].getDuration().value())
{
mRecordingPeriods.push_back(other.mRecordingPeriods[other_index]);
}
other_index = (other_index + 1) % other.mRecordingPeriods.size();
mRecordingPeriods.push_back(other.mRecordingPeriods[other_index]);
other_index = (other_index + 1) % other_recording_slots;
}
// add final recording, if it wasn't already added as the first
if (other_num_recordings > 1)
{
mRecordingPeriods.push_back(other.mRecordingPeriods[other_current_recording_index]);
}
while(other_index != end_index);
mCurPeriod = mRecordingPeriods.size() - 1;
mNumPeriods = mRecordingPeriods.size();
}
else
{
//FIXME: get proper number of recordings from other...might not have used all its slots
size_t num_to_copy = llmin( mRecordingPeriods.size(), other.getNumRecordedPeriods());
std::vector<Recording>::iterator src_it = other.mRecordingPeriods.begin()
+ ( (other.mCurPeriod + 1 // oldest period
+ (other.mRecordingPeriods.size() - num_to_copy)) // minus room for copy
% other.mRecordingPeriods.size());
size_t num_to_copy = llmin( mRecordingPeriods.size(), other_num_recordings);
std::vector<Recording>::iterator src_it = other.mRecordingPeriods.begin() + other_index ;
std::vector<Recording>::iterator dest_it = mRecordingPeriods.begin() + mCurPeriod;
for(size_t i = 0; i < num_to_copy; i++)
// already consumed the first recording from other, so start counting at 1
for(size_t i = 1; i < num_to_copy; i++)
{
*dest_it = *src_it;
@ -474,17 +487,14 @@ void PeriodicRecording::appendPeriodicRecording( PeriodicRecording& other )
// want argument to % to be positive, otherwise result could be negative and thus out of bounds
llassert(num_to_copy >= 1);
// advance to last recording period copied, so we can check if the last period had actually carried any data, in which case we'll advance below
// using nextPeriod() which retains continuity (mLastValue, etc)
// advance to last recording period copied, and make that our current period
mCurPeriod = (mCurPeriod + num_to_copy - 1) % mRecordingPeriods.size();
mNumPeriods = llmin(mRecordingPeriods.size(), mNumPeriods + num_to_copy);
mNumPeriods = llmin(mRecordingPeriods.size(), mNumPeriods + num_to_copy - 1);
}
if (getCurRecording().getDuration().value())
{
//call this to chain last period copied to new active period
nextPeriod();
}
// end with fresh period, otherwise next appendPeriodicRecording() will merge the first
// recording period with the last one appended here
nextPeriod();
getCurRecording().setPlayState(getPlayState());
}

View File

@ -103,6 +103,11 @@ private:
struct TimerBarRow
{
TimerBarRow()
: mBottom(0),
mTop(0),
mBars(NULL)
{}
S32 mBottom,
mTop;
TimerBar* mBars;
@ -118,9 +123,9 @@ private:
enum EDisplayType
{
TIME,
CALLS,
HZ
DISPLAY_TIME,
DISPLAY_CALLS,
DISPLAY_HZ
} mDisplayType;
bool mPauseHistory;
LLUnit<F64, LLUnits::Seconds> mAllTimeMax,

View File

@ -500,7 +500,7 @@ void LLSceneMonitor::dumpToFile(std::string file_name)
std::ofstream os(file_name.c_str());
os << std::setprecision(3);
os << std::setprecision(10);
PeriodicRecording& scene_load_recording = mSceneLoadRecording.getAcceptedRecording();
const U32 frame_count = scene_load_recording.getNumRecordedPeriods();
@ -508,12 +508,12 @@ void LLSceneMonitor::dumpToFile(std::string file_name)
LLUnit<F64, LLUnits::Seconds> frame_time;
os << "Stat";
for (S32 frame = 0; frame < frame_count; frame++)
for (S32 frame = 1; frame <= frame_count; frame++)
{
frame_time += scene_load_recording.getPrevRecording(frame_count - frame).getDuration();
os << ", " << frame_time.value();
}
os << std::endl;
os << '\n';
typedef TraceType<CountAccumulator> trace_count;
for (trace_count::instance_iter it = trace_count::beginInstances(), end_it = trace_count::endInstances();
@ -521,6 +521,8 @@ void LLSceneMonitor::dumpToFile(std::string file_name)
++it)
{
std::ostringstream row;
row << std::setprecision(10);
row << it->getName();
const char* unit_label = it->getUnitLabel();
@ -531,13 +533,13 @@ void LLSceneMonitor::dumpToFile(std::string file_name)
S32 samples = 0;
for (S32 frame = 0; frame < frame_count; frame++)
for (S32 frame = 1; frame <= frame_count; frame++)
{
samples += scene_load_recording.getPrevRecording(frame_count - frame).getSampleCount(*it);
row << ", " << scene_load_recording.getPrevRecording(frame_count - frame).getSum(*it);
}
row << std::endl;
row << '\n';
if (samples > 0)
{
@ -552,6 +554,7 @@ void LLSceneMonitor::dumpToFile(std::string file_name)
++it)
{
std::ostringstream row;
row << std::setprecision(10);
row << it->getName();
const char* unit_label = it->getUnitLabel();
@ -562,13 +565,13 @@ void LLSceneMonitor::dumpToFile(std::string file_name)
S32 samples = 0;
for (S32 frame = 0; frame < frame_count; frame++)
for (S32 frame = 1; frame <= frame_count; frame++)
{
samples += scene_load_recording.getPrevRecording(frame_count - frame).getSampleCount(*it);
row << ", " << scene_load_recording.getPrevRecording(frame_count - frame).getMean(*it);
}
row << std::endl;
row << '\n';
if (samples > 0)
{
@ -583,6 +586,7 @@ void LLSceneMonitor::dumpToFile(std::string file_name)
++it)
{
std::ostringstream row;
row << std::setprecision(10);
row << it->getName();
const char* unit_label = it->getUnitLabel();
@ -593,13 +597,13 @@ void LLSceneMonitor::dumpToFile(std::string file_name)
S32 samples = 0;
for (S32 frame = 0; frame < frame_count; frame++)
for (S32 frame = 1; frame <= frame_count; frame++)
{
samples += scene_load_recording.getPrevRecording(frame_count - frame).getSampleCount(*it);
row << ", " << scene_load_recording.getPrevRecording(frame_count - frame).getMean(*it);
}
row << std::endl;
row << '\n';
if (samples > 0)
{
@ -614,12 +618,12 @@ void LLSceneMonitor::dumpToFile(std::string file_name)
{
os << it->getName() << "(KiB)";
for (S32 frame = 0; frame < frame_count; frame++)
for (S32 frame = 1; frame <= frame_count; frame++)
{
os << ", " << scene_load_recording.getPrevRecording(frame_count - frame).getMax(*it).getAs<LLUnits::Kibibytes>();
}
os << std::endl;
os << '\n';
}
os.flush();

View File

@ -37,7 +37,7 @@ class LLCharacter;
class LLRenderTarget;
class LLViewerTexture;
class LLSceneMonitor : public LLSingleton<LLSceneMonitor>
class LLSceneMonitor : public LLSingleton<LLSceneMonitor>
{
LOG_CLASS(LLSceneMonitor);
public: