diff options
Diffstat (limited to 'indra')
-rw-r--r-- | indra/llcommon/lltracerecording.cpp | 58 | ||||
-rwxr-xr-x | indra/newview/llfasttimerview.h | 11 | ||||
-rw-r--r-- | indra/newview/llscenemonitor.cpp | 26 | ||||
-rw-r--r-- | indra/newview/llscenemonitor.h | 2 |
4 files changed, 58 insertions, 39 deletions
diff --git a/indra/llcommon/lltracerecording.cpp b/indra/llcommon/lltracerecording.cpp index 33002929ea..0fe95ee75f 100644 --- a/indra/llcommon/lltracerecording.cpp +++ b/indra/llcommon/lltracerecording.cpp @@ -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()); } diff --git a/indra/newview/llfasttimerview.h b/indra/newview/llfasttimerview.h index d931f25a7e..9d88bb2d3f 100755 --- a/indra/newview/llfasttimerview.h +++ b/indra/newview/llfasttimerview.h @@ -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, diff --git a/indra/newview/llscenemonitor.cpp b/indra/newview/llscenemonitor.cpp index 8086745471..ed9eeb9330 100644 --- a/indra/newview/llscenemonitor.cpp +++ b/indra/newview/llscenemonitor.cpp @@ -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(); diff --git a/indra/newview/llscenemonitor.h b/indra/newview/llscenemonitor.h index 6af58b707a..9717310da4 100644 --- a/indra/newview/llscenemonitor.h +++ b/indra/newview/llscenemonitor.h @@ -37,7 +37,7 @@ class LLCharacter; class LLRenderTarget; class LLViewerTexture; -class LLSceneMonitor : public LLSingleton<LLSceneMonitor> +class LLSceneMonitor : public LLSingleton<LLSceneMonitor> { LOG_CLASS(LLSceneMonitor); public: |