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.cpp221
1 files changed, 113 insertions, 108 deletions
diff --git a/indra/newview/llscenemonitor.cpp b/indra/newview/llscenemonitor.cpp
index 2c0c38dc75..f9baf5fbd3 100644
--- a/indra/newview/llscenemonitor.cpp
+++ b/indra/newview/llscenemonitor.cpp
@@ -526,162 +526,167 @@ void LLSceneMonitor::fetchQueryResult()
//dump results to a file _scene_xmonitor_results.csv
void LLSceneMonitor::dumpToFile(std::string file_name)
-{ using namespace LLTrace;
-
+{
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++)
- {
- frame_time += scene_load_recording.getPrevRecording(frame_count - frame).getDuration();
- os << ", " << frame_time.value();
- }
- os << '\n';
-
- os << "Sample period(s)";
- 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 << std::setprecision(10);
- typedef StatType<CountAccumulator> trace_count;
- for (auto& it : trace_count::instance_snapshot())
- {
- std::ostringstream row;
- row << std::setprecision(10);
+ LLTrace::PeriodicRecording& scene_load_recording = mSceneLoadRecording.getResults();
+ const U32 frame_count = scene_load_recording.getNumRecordedPeriods();
- row << it.getName();
+ F64Seconds frame_time;
- 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 LLTrace::StatType<LLTrace::CountAccumulator> trace_count;
+ for (auto& it : trace_count::instance_snapshot())
{
- os << row.str();
- }
- }
+ std::ostringstream row;
+ row << std::setprecision(10);
- typedef StatType<EventAccumulator> trace_event;
+ row << it.getName();
- for (auto& it : trace_event::instance_snapshot())
- {
- std::ostringstream row;
- row << std::setprecision(10);
- 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";
+ 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 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++)
+ {
+ 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())
{
- 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 << ", n/a";
+ row << "(" << unit_label << ")";
}
- else
+
+ S32 samples = 0;
+
+ for (S32 frame = 1; frame <= frame_count; frame++)
{
- row << ", " << mean;
+ 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';
+ row << '\n';
- if (samples > 0)
- {
- os << row.str();
+ if (samples > 0)
+ {
+ os << row.str();
+ }
}
- }
-
- typedef StatType<MemAccumulator> trace_mem;
- for (auto& it : trace_mem::instance_snapshot())
- {
- os << it.getName() << "(KiB)";
- for (S32 frame = 1; frame <= frame_count; frame++)
+ typedef LLTrace::StatType<LLTrace::MemAccumulator> trace_mem;
+ for (auto& it : trace_mem::instance_snapshot())
{
- os << ", " << scene_load_recording.getPrevRecording(frame_count - frame).getMax(it).valueInUnits<LLUnits::Kilobytes>();
+ 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>();
+ }
+
+ 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();
}
//-------------------------------------------------------------------------------------------------------------