summaryrefslogtreecommitdiff
path: root/indra/newview/llscenemonitor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llscenemonitor.cpp')
-rw-r--r--indra/newview/llscenemonitor.cpp218
1 files changed, 112 insertions, 106 deletions
diff --git a/indra/newview/llscenemonitor.cpp b/indra/newview/llscenemonitor.cpp
index 3c9ce6b752..f9baf5fbd3 100644
--- a/indra/newview/llscenemonitor.cpp
+++ b/indra/newview/llscenemonitor.cpp
@@ -530,157 +530,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);
-
- LLTrace::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);
+ LLTrace::PeriodicRecording& scene_load_recording = mSceneLoadRecording.getResults();
+ const U32 frame_count = scene_load_recording.getNumRecordedPeriods();
- typedef LLTrace::StatType<LLTrace::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++)
{
- LLTrace::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 LLTrace::StatType<LLTrace::CountAccumulator> trace_count;
+ for (auto& it : trace_count::instance_snapshot())
{
- os << row.str();
- }
- }
-
- typedef LLTrace::StatType<LLTrace::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++)
- {
- LLTrace::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";
+ LLTrace::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 LLTrace::StatType<LLTrace::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 LLTrace::StatType<LLTrace::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++)
+ {
+ LLTrace::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 LLTrace::StatType<LLTrace::SampleAccumulator> trace_sample;
- for (S32 frame = 1; frame <= frame_count; frame++)
+ for (auto& it : trace_sample::instance_snapshot())
{
- LLTrace::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";
+ LLTrace::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 LLTrace::StatType<LLTrace::MemAccumulator> trace_mem;
+ for (auto& it : trace_mem::instance_snapshot())
{
- os << row.str();
- }
- }
+ os << it.getName() << "(KiB)";
- typedef LLTrace::StatType<LLTrace::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();
}
//-------------------------------------------------------------------------------------------------------------