diff options
author | Mnikolenko Productengine <mnikolenko@productengine.com> | 2021-01-27 18:32:41 +0200 |
---|---|---|
committer | Mnikolenko Productengine <mnikolenko@productengine.com> | 2021-01-27 18:32:41 +0200 |
commit | 9fc3014435aac812754f0d47b53c87526513113e (patch) | |
tree | 41977264f544a8f7412424babb1c56adf57cf2cd /indra | |
parent | a3d31ca683eb0744563b36d6432168fde6ae77d9 (diff) |
SL-14422 Crash at LLSceneMonitor::dumpToFile
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llappviewer.cpp | 6 | ||||
-rw-r--r-- | indra/newview/llscenemonitor.cpp | 218 |
2 files changed, 117 insertions, 107 deletions
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 0596df4ddb..0a6906febc 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -1678,7 +1678,11 @@ bool LLAppViewer::cleanup() //dump scene loading monitor results if (LLSceneMonitor::instanceExists()) { - LLSceneMonitor::instance().dumpToFile(gDirUtilp->getExpandedFilename(LL_PATH_LOGS, "scene_monitor_results.csv")); + if (!isSecondInstance()) + { + LLSceneMonitor::instance().dumpToFile(gDirUtilp->getExpandedFilename(LL_PATH_LOGS, "scene_monitor_results.csv")); + } + LLSceneMonitor::deleteSingleton(); } // There used to be an 'if (LLFastTimerView::sAnalyzePerformance)' block diff --git a/indra/newview/llscenemonitor.cpp b/indra/newview/llscenemonitor.cpp index 2c0c38dc75..a16cb81255 100644 --- a/indra/newview/llscenemonitor.cpp +++ b/indra/newview/llscenemonitor.cpp @@ -531,157 +531,163 @@ void LLSceneMonitor::dumpToFile(std::string file_name) if (!hasResults()) return; LL_INFOS("SceneMonitor") << "Saving scene load stats to " << file_name << LL_ENDL; - - llofstream os(file_name.c_str()); - - os << std::setprecision(10); - - PeriodicRecording& scene_load_recording = mSceneLoadRecording.getResults(); - const U32 frame_count = scene_load_recording.getNumRecordedPeriods(); - - F64Seconds frame_time; - - os << "Stat"; - for (S32 frame = 1; frame <= frame_count; frame++) + try { - frame_time += scene_load_recording.getPrevRecording(frame_count - frame).getDuration(); - os << ", " << frame_time.value(); - } - os << '\n'; + llofstream os(file_name.c_str()); - os << "Sample period(s)"; - for (S32 frame = 1; frame <= frame_count; frame++) - { - frame_time = scene_load_recording.getPrevRecording(frame_count - frame).getDuration(); - os << ", " << frame_time.value(); - } - os << '\n'; + os << std::setprecision(10); + PeriodicRecording& scene_load_recording = mSceneLoadRecording.getResults(); + const U32 frame_count = scene_load_recording.getNumRecordedPeriods(); - typedef StatType<CountAccumulator> trace_count; - for (auto& it : trace_count::instance_snapshot()) - { - std::ostringstream row; - row << std::setprecision(10); + F64Seconds frame_time; - row << it.getName(); - - const char* unit_label = it.getUnitLabel(); - if(unit_label[0]) + os << "Stat"; + for (S32 frame = 1; frame <= frame_count; frame++) { - row << "(" << unit_label << ")"; + frame_time += scene_load_recording.getPrevRecording(frame_count - frame).getDuration(); + os << ", " << frame_time.value(); } + os << '\n'; - S32 samples = 0; - + os << "Sample period(s)"; for (S32 frame = 1; frame <= frame_count; frame++) { - Recording& recording = scene_load_recording.getPrevRecording(frame_count - frame); - samples += recording.getSampleCount(it); - row << ", " << recording.getSum(it); + frame_time = scene_load_recording.getPrevRecording(frame_count - frame).getDuration(); + os << ", " << frame_time.value(); } + os << '\n'; - row << '\n'; - if (samples > 0) + typedef StatType<CountAccumulator> trace_count; + for (auto& it : trace_count::instance_snapshot()) { - os << row.str(); - } - } - - typedef StatType<EventAccumulator> trace_event; + std::ostringstream row; + row << std::setprecision(10); - for (auto& it : trace_event::instance_snapshot()) - { - std::ostringstream row; - row << std::setprecision(10); - row << it.getName(); + row << it.getName(); - const char* unit_label = it.getUnitLabel(); - if(unit_label[0]) - { - row << "(" << unit_label << ")"; - } + const char* unit_label = it.getUnitLabel(); + if (unit_label[0]) + { + row << "(" << unit_label << ")"; + } - S32 samples = 0; + S32 samples = 0; - for (S32 frame = 1; frame <= frame_count; frame++) - { - Recording& recording = scene_load_recording.getPrevRecording(frame_count - frame); - samples += recording.getSampleCount(it); - F64 mean = recording.getMean(it); - if (llisnan(mean)) + for (S32 frame = 1; frame <= frame_count; frame++) { - row << ", n/a"; + Recording& recording = scene_load_recording.getPrevRecording(frame_count - frame); + samples += recording.getSampleCount(it); + row << ", " << recording.getSum(it); } - else + + row << '\n'; + + if (samples > 0) { - row << ", " << mean; + os << row.str(); } } - row << '\n'; + typedef StatType<EventAccumulator> trace_event; - if (samples > 0) + for (auto& it : trace_event::instance_snapshot()) { - os << row.str(); - } - } + std::ostringstream row; + row << std::setprecision(10); + row << it.getName(); - typedef StatType<SampleAccumulator> trace_sample; + const char* unit_label = it.getUnitLabel(); + if (unit_label[0]) + { + row << "(" << unit_label << ")"; + } - for (auto& it : trace_sample::instance_snapshot()) - { - std::ostringstream row; - row << std::setprecision(10); - row << it.getName(); + S32 samples = 0; - const char* unit_label = it.getUnitLabel(); - if(unit_label[0]) - { - row << "(" << unit_label << ")"; + for (S32 frame = 1; frame <= frame_count; frame++) + { + Recording& recording = scene_load_recording.getPrevRecording(frame_count - frame); + samples += recording.getSampleCount(it); + F64 mean = recording.getMean(it); + if (llisnan(mean)) + { + row << ", n/a"; + } + else + { + row << ", " << mean; + } + } + + row << '\n'; + + if (samples > 0) + { + os << row.str(); + } } - S32 samples = 0; + typedef StatType<SampleAccumulator> trace_sample; - for (S32 frame = 1; frame <= frame_count; frame++) + for (auto& it : trace_sample::instance_snapshot()) { - Recording& recording = scene_load_recording.getPrevRecording(frame_count - frame); - samples += recording.getSampleCount(it); - F64 mean = recording.getMean(it); - if (llisnan(mean)) + std::ostringstream row; + row << std::setprecision(10); + row << it.getName(); + + const char* unit_label = it.getUnitLabel(); + if (unit_label[0]) + { + row << "(" << unit_label << ")"; + } + + S32 samples = 0; + + for (S32 frame = 1; frame <= frame_count; frame++) { - row << ", n/a"; + Recording& recording = scene_load_recording.getPrevRecording(frame_count - frame); + samples += recording.getSampleCount(it); + F64 mean = recording.getMean(it); + if (llisnan(mean)) + { + row << ", n/a"; + } + else + { + row << ", " << mean; + } } - else + + row << '\n'; + + if (samples > 0) { - row << ", " << mean; + os << row.str(); } } - row << '\n'; - - if (samples > 0) + typedef StatType<MemAccumulator> trace_mem; + for (auto& it : trace_mem::instance_snapshot()) { - os << row.str(); - } - } + os << it.getName() << "(KiB)"; - typedef StatType<MemAccumulator> trace_mem; - for (auto& it : trace_mem::instance_snapshot()) - { - os << it.getName() << "(KiB)"; + for (S32 frame = 1; frame <= frame_count; frame++) + { + os << ", " << scene_load_recording.getPrevRecording(frame_count - frame).getMax(it).valueInUnits<LLUnits::Kilobytes>(); + } - for (S32 frame = 1; frame <= frame_count; frame++) - { - os << ", " << scene_load_recording.getPrevRecording(frame_count - frame).getMax(it).valueInUnits<LLUnits::Kilobytes>(); + os << '\n'; } - os << '\n'; + os.flush(); + os.close(); + } + catch (const std::ios_base::failure &e) + { + LL_WARNS() << "Unable to dump scene monitor results: " << e.what() << LL_ENDL; } - - os.flush(); - os.close(); } //------------------------------------------------------------------------------------------------------------- |