summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/llcommon/lltrace.h10
-rw-r--r--indra/llcommon/llunit.h34
-rw-r--r--indra/newview/llscenemonitor.cpp29
3 files changed, 49 insertions, 24 deletions
diff --git a/indra/llcommon/lltrace.h b/indra/llcommon/lltrace.h
index c485552061..2953e993d4 100644
--- a/indra/llcommon/lltrace.h
+++ b/indra/llcommon/lltrace.h
@@ -265,6 +265,8 @@ public:
size_t getIndex() const { return mAccumulatorIndex; }
+ virtual const char* getUnitLabel() { return ""; }
+
const std::string& getName() const { return mName; }
protected:
@@ -662,6 +664,9 @@ public:
EventStatHandle(const char* name, const char* description = NULL)
: trace_t(name, description)
{}
+
+ /*virtual*/ const char* getUnitLabel() { return LLGetUnitLabel<T>::getUnitLabel(); }
+
};
template<typename T, typename VALUE_T>
@@ -682,6 +687,8 @@ public:
SampleStatHandle(const char* name, const char* description = NULL)
: trace_t(name, description)
{}
+
+ /*virtual*/ const char* getUnitLabel() { return LLGetUnitLabel<T>::getUnitLabel(); }
};
template<typename T, typename VALUE_T>
@@ -703,6 +710,7 @@ public:
: trace_t(name)
{}
+ /*virtual*/ const char* getUnitLabel() { return LLGetUnitLabel<T>::getUnitLabel(); }
};
template<typename T, typename VALUE_T>
@@ -755,6 +763,8 @@ public:
MemStatHandle(const char* name)
: trace_t(name)
{}
+
+ /*virtual*/ const char* getUnitLabel() { return "B"; }
};
// measures effective memory footprint of specified type
diff --git a/indra/llcommon/llunit.h b/indra/llcommon/llunit.h
index c617d2a87f..77c19b5152 100644
--- a/indra/llcommon/llunit.h
+++ b/indra/llcommon/llunit.h
@@ -406,6 +406,22 @@ COMPARISON_OPERATORS(>=)
COMPARISON_OPERATORS(==)
COMPARISON_OPERATORS(!=)
+
+template<typename T>
+struct LLGetUnitLabel
+{
+ static const char* getUnitLabel() { return ""; }
+};
+
+template<typename T, typename STORAGE_T>
+struct LLGetUnitLabel<LLUnit<T, STORAGE_T> >
+{
+ static const char* getUnitLabel() { return T::getUnitLabel(); }
+};
+
+//
+// Unit declarations
+//
namespace LLUnits
{
template<typename T>
@@ -427,9 +443,8 @@ struct HighestPrecisionType<LLUnit<UNIT_TYPE, STORAGE_TYPE> >
struct unit_name \
{ \
typedef base_unit_name base_unit_t; \
- static const char* sUnitLabel; \
+ static const char* getUnitLabel() { return unit_label; } \
}; \
-const char* unit_name::sUnitLabel = unit_label; \
template<typename STORAGE_TYPE> \
struct ConversionFactor<unit_name, base_unit_name, STORAGE_TYPE> \
{ \
@@ -448,8 +463,7 @@ struct ConversionFactor<base_unit_name, unit_name, STORAGE_TYPE> \
} \
}
-struct Bytes { typedef Bytes base_unit_t; static const char* sUnitLabel;};
-const char* Bytes::sUnitLabel = "B";
+struct Bytes { typedef Bytes base_unit_t; static const char* getUnitLabel() { return "B"; }};
LL_DECLARE_DERIVED_UNIT(1024, Bytes, Kilobytes, "KiB");
LL_DECLARE_DERIVED_UNIT(1024 * 1024, Bytes, Megabytes, "MiB");
LL_DECLARE_DERIVED_UNIT(1024 * 1024 * 1024, Bytes, Gigabytes, "GiB");
@@ -458,28 +472,24 @@ LL_DECLARE_DERIVED_UNIT(1024 / 8, Bytes, Kilobits, "Kib");
LL_DECLARE_DERIVED_UNIT(1024 / 8, Bytes, Megabits, "Mib");
LL_DECLARE_DERIVED_UNIT(1024 * 1024 * 1024 / 8, Bytes, Gigabits, "Gib");
-struct Seconds { typedef Seconds base_unit_t; static const char* sUnitLabel; };
-const char* Seconds::sUnitLabel = "s";
+struct Seconds { typedef Seconds base_unit_t; static const char* getUnitLabel() { return "s"; } };
LL_DECLARE_DERIVED_UNIT(60, Seconds, Minutes, "min");
LL_DECLARE_DERIVED_UNIT(60 * 60, Seconds, Hours, "h");
LL_DECLARE_DERIVED_UNIT(1.0 / 1000.0, Seconds, Milliseconds, "ms");
LL_DECLARE_DERIVED_UNIT(1.0 / 1000000.0, Seconds, Microseconds, "\x09\x3cs");
LL_DECLARE_DERIVED_UNIT(1.0 / 1000000000.0, Seconds, Nanoseconds, "ns");
-struct Meters { typedef Meters base_unit_t; static const char* sUnitLabel; };
-const char* Meters::sUnitLabel = "m";
+struct Meters { typedef Meters base_unit_t; static const char* getUnitLabel() { return "m"; } };
LL_DECLARE_DERIVED_UNIT(1000, Meters, Kilometers, "km");
LL_DECLARE_DERIVED_UNIT(1.0 / 100.0, Meters, Centimeters, "cm");
LL_DECLARE_DERIVED_UNIT(1.0 / 1000.0, Meters, Millimeters, "mm");
-struct Hertz { typedef Hertz base_unit_t; static const char* sUnitLabel; };
-const char* Hertz::sUnitLabel = "Hz";
+struct Hertz { typedef Hertz base_unit_t; static const char* getUnitLabel() { return "Hz"; } };
LL_DECLARE_DERIVED_UNIT(1000, Hertz, Kilohertz, "KHz");
LL_DECLARE_DERIVED_UNIT(1000 * 1000, Hertz, Megahertz, "MHz");
LL_DECLARE_DERIVED_UNIT(1000 * 1000 * 1000, Hertz, Gigahertz, "GHz");
-struct Radians { typedef Radians base_unit_t; static const char* sUnitLabel;};
-const char* Radians::sUnitLabel = "rad";
+struct Radians { typedef Radians base_unit_t; static const char* getUnitLabel() { return "rad"; } };
LL_DECLARE_DERIVED_UNIT(DEG_TO_RAD, Radians, Degrees, "deg");
} // namespace LLUnits
diff --git a/indra/newview/llscenemonitor.cpp b/indra/newview/llscenemonitor.cpp
index 1a5b43c703..f7abb982e1 100644
--- a/indra/newview/llscenemonitor.cpp
+++ b/indra/newview/llscenemonitor.cpp
@@ -523,12 +523,18 @@ void LLSceneMonitor::dumpToFile(std::string file_name)
std::ostringstream row;
row << it->getName();
+ const char* unit_label = it->getUnitLabel();
+ if(unit_label[0])
+ {
+ row << "(" << unit_label << ")";
+ }
+
S32 samples = 0;
- for (S32 i = frame_count - 1; i >= 0; --i)
+ for (S32 frame = 0; frame < frame_count; frame++)
{
- samples += scene_load_recording.getPrevRecording(i).getSampleCount(*it);
- row << ", " << scene_load_recording.getPrevRecording(i).getSum(*it);
+ samples += scene_load_recording.getPrevRecording(frame_count - frame).getSampleCount(*it);
+ row << ", " << scene_load_recording.getPrevRecording(frame_count - frame).getSum(*it);
}
row << std::endl;
@@ -550,10 +556,10 @@ void LLSceneMonitor::dumpToFile(std::string file_name)
S32 samples = 0;
- for (S32 i = frame_count - 1; i >= 0; --i)
+ for (S32 frame = 0; frame < frame_count; frame++)
{
- samples += scene_load_recording.getPrevRecording(i).getSampleCount(*it);
- row << ", " << scene_load_recording.getPrevRecording(i).getMean(*it);
+ samples += scene_load_recording.getPrevRecording(frame_count - frame).getSampleCount(*it);
+ row << ", " << scene_load_recording.getPrevRecording(frame_count - frame).getMean(*it);
}
row << std::endl;
@@ -575,10 +581,10 @@ void LLSceneMonitor::dumpToFile(std::string file_name)
S32 samples = 0;
- for (S32 i = frame_count - 1; i >= 0; --i)
+ for (S32 frame = 0; frame < frame_count; frame++)
{
- samples += scene_load_recording.getPrevRecording(i).getSampleCount(*it);
- row << ", " << scene_load_recording.getPrevRecording(i).getMean(*it);
+ samples += scene_load_recording.getPrevRecording(frame_count - frame).getSampleCount(*it);
+ row << ", " << scene_load_recording.getPrevRecording(frame_count - frame).getMean(*it);
}
row << std::endl;
@@ -596,9 +602,9 @@ void LLSceneMonitor::dumpToFile(std::string file_name)
{
os << it->getName();
- for (S32 i = frame_count - 1; i >= 0; --i)
+ for (S32 frame = 0; frame < frame_count; frame++)
{
- os << ", " << scene_load_recording.getPrevRecording(i).getSum(*it).as<LLUnits::Megabytes>().value();
+ os << ", " << scene_load_recording.getPrevRecording(frame_count - frame).getSum(*it).value();
}
os << std::endl;
@@ -606,7 +612,6 @@ void LLSceneMonitor::dumpToFile(std::string file_name)
os.flush();
os.close();
-
}
//-------------------------------------------------------------------------------------------------------------