summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Linden <none@none>2012-10-03 19:32:59 -0700
committerRichard Linden <none@none>2012-10-03 19:32:59 -0700
commit8f5e83789254d19a1a31737b0d7515cd7e967b26 (patch)
treee010acddfb59491fe805371b91167e679b8fa598
parent7196619b4a0823a332e10b7f98464a1649e0dfd2 (diff)
SH-3405 WIP convert existing stats to lltrace system
SH-3403 FIX implement unit conversion LLUnit implements unit tracking and conversion added support for LLUnit to LLTrace duplicated most llstats into LLTrace equivalents
-rw-r--r--indra/llcommon/CMakeLists.txt1
-rw-r--r--indra/llcommon/lltrace.h62
-rw-r--r--indra/llcommon/lltracerecording.h18
-rw-r--r--indra/llcommon/llunit.h226
-rw-r--r--indra/newview/llstatusbar.cpp2
-rwxr-xr-xindra/newview/llviewerstats.cpp131
-rwxr-xr-xindra/newview/llviewerstats.h120
-rw-r--r--indra/newview/llviewertexturelist.cpp2
-rw-r--r--indra/newview/llworld.cpp3
9 files changed, 529 insertions, 36 deletions
diff --git a/indra/llcommon/CMakeLists.txt b/indra/llcommon/CMakeLists.txt
index 1ccee23e1e..471558ea01 100644
--- a/indra/llcommon/CMakeLists.txt
+++ b/indra/llcommon/CMakeLists.txt
@@ -247,6 +247,7 @@ set(llcommon_HEADER_FILES
lltracerecording.h
lltreeiterators.h
lltypeinfolookup.h
+ llunit.h
lluri.h
lluuid.h
lluuidhashmap.h
diff --git a/indra/llcommon/lltrace.h b/indra/llcommon/lltrace.h
index 39de79e4c1..6a889f74df 100644
--- a/indra/llcommon/lltrace.h
+++ b/indra/llcommon/lltrace.h
@@ -35,6 +35,7 @@
#include "lltimer.h"
#include "llrefcount.h"
#include "lltracerecording.h"
+#include "llunit.h"
#include <list>
@@ -42,11 +43,8 @@
#define TOKEN_PASTE(x, y) TOKEN_PASTE_ACTUAL(x, y)
#define RECORD_BLOCK_TIME(block_timer) LLTrace::BlockTimer::Recorder TOKEN_PASTE(block_time_recorder, __COUNTER__)(block_timer);
-
namespace LLTrace
{
- class Recording;
-
void init();
void cleanup();
@@ -325,10 +323,10 @@ namespace LLTrace
U32 mNumSamples;
};
- template <typename T>
+ template <typename T, typename IS_UNIT = void>
class LL_COMMON_API Measurement
: public TraceType<MeasurementAccumulator<T> >,
- public LLInstanceTracker<Measurement<T>, std::string>
+ public LLInstanceTracker<Measurement<T, IS_UNIT>, std::string>
{
public:
Measurement(const std::string& name)
@@ -343,13 +341,37 @@ namespace LLTrace
};
template <typename T>
+ class LL_COMMON_API Measurement <T, typename T::is_unit_t>
+ : public Measurement<typename T::value_t>
+ {
+ public:
+ typedef Measurement<typename T::value_t> base_measurement_t;
+ Measurement(const std::string& name)
+ : Measurement<typename T::value_t>(name)
+ {}
+
+ template<typename UNIT_T>
+ void sample(UNIT_T value)
+ {
+ base_measurement_t::sample(value.get());
+ }
+
+ template<typename UNIT_T>
+ typename T::value_t get()
+ {
+ UNIT_T value(*this);
+ return value.get();
+ }
+ };
+
+ template <typename T, typename IS_UNIT = void>
class LL_COMMON_API Rate
- : public TraceType<RateAccumulator<T> >,
+ : public TraceType<RateAccumulator<T> >,
public LLInstanceTracker<Rate<T>, std::string>
{
public:
Rate(const std::string& name)
- : TraceType(name),
+ : TraceType(name),
LLInstanceTracker(name)
{}
@@ -359,6 +381,30 @@ namespace LLTrace
}
};
+ template <typename T>
+ class LL_COMMON_API Rate <T, typename T::is_unit_t>
+ : public Rate<typename T::value_t>
+ {
+ public:
+ Rate(const std::string& name)
+ : Rate<typename T::value_t>(name)
+ {}
+
+ template<typename UNIT_T>
+ void add(UNIT_T value)
+ {
+ getPrimaryAccumulator().add(value.get());
+ }
+
+ template<typename UNIT_T>
+ typename T::value_t get()
+ {
+ UNIT_T value(*this);
+ return value.get();
+ }
+
+ };
+
class LL_COMMON_API TimerAccumulator
{
public:
@@ -482,6 +528,8 @@ namespace LLTrace
static Recorder::StackEntry sCurRecorder;
};
+ class Recording;
+
class LL_COMMON_API ThreadRecorder
{
public:
diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h
index 0a54e4cedf..4d5793014f 100644
--- a/indra/llcommon/lltracerecording.h
+++ b/indra/llcommon/lltracerecording.h
@@ -35,8 +35,8 @@
namespace LLTrace
{
- template<typename T> class Rate;
- template<typename T> class Measurement;
+ template<typename T, typename IS_UNIT> class Rate;
+ template<typename T, typename IS_UNIT> class Measurement;
template<typename T> class AccumulatorBuffer;
template<typename T> class RateAccumulator;
template<typename T> class MeasurementAccumulator;
@@ -63,14 +63,14 @@ namespace LLTrace
bool isStarted() { return mIsStarted; }
- F32 getSum(Rate<F32>& stat);
- F32 getPerSec(Rate<F32>& stat);
+ F32 getSum(Rate<F32, void>& stat);
+ F32 getPerSec(Rate<F32, void>& stat);
- F32 getSum(Measurement<F32>& stat);
- F32 getMin(Measurement<F32>& stat);
- F32 getMax(Measurement<F32>& stat);
- F32 getMean(Measurement<F32>& stat);
- F32 getStandardDeviation(Measurement<F32>& stat);
+ F32 getSum(Measurement<F32, void>& stat);
+ F32 getMin(Measurement<F32, void>& stat);
+ F32 getMax(Measurement<F32, void>& stat);
+ F32 getMean(Measurement<F32, void>& stat);
+ F32 getStandardDeviation(Measurement<F32, void>& stat);
F64 getSampleTime() { return mElapsedSeconds; }
diff --git a/indra/llcommon/llunit.h b/indra/llcommon/llunit.h
new file mode 100644
index 0000000000..9d78df7cae
--- /dev/null
+++ b/indra/llcommon/llunit.h
@@ -0,0 +1,226 @@
+/**
+ * @file llunit.h
+ * @brief Unit conversion classes
+ *
+ * $LicenseInfo:firstyear=2001&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2012, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
+ * $/LicenseInfo$
+ */
+
+#ifndef LL_LLUNIT_H
+#define LL_LLUNIT_H
+
+#include "stdtypes.h"
+#include "llpreprocessor.h"
+
+template<typename BASE_UNIT, typename DERIVED_UNIT = BASE_UNIT>
+struct LLUnit : public BASE_UNIT
+{
+ typedef LLUnit<BASE_UNIT, DERIVED_UNIT> unit_t;
+ typedef typename BASE_UNIT::value_t value_t;
+ typedef void is_unit_t;
+
+ LLUnit()
+ {}
+
+ explicit LLUnit(value_t value)
+ : BASE_UNIT(convertToBase(value))
+ {}
+
+ operator value_t() { return get(); }
+
+ value_t get() const
+ {
+ return convertToDerived(mValue);
+ }
+
+ static value_t convertToBase(value_t derived_value)
+ {
+ return (value_t)((F32)derived_value * DERIVED_UNIT::conversionToBaseFactor());
+ }
+
+ static value_t convertToDerived(value_t base_value)
+ {
+ return (value_t)((F32)base_value / DERIVED_UNIT::conversionToBaseFactor());
+ }
+
+};
+
+template<typename T>
+struct LLUnit<T, T>
+{
+ typedef LLUnit<T, T> unit_t;
+ typedef T value_t;
+ typedef void is_unit_t;
+
+ LLUnit()
+ : mValue()
+ {}
+
+ explicit LLUnit(T value)
+ : mValue(value)
+ {}
+
+ unit_t& operator=(T value)
+ {
+ setBaseValue(value);
+ return *this;
+ }
+
+ value_t get() { return mValue; }
+
+ static value_t convertToBase(value_t derived_value)
+ {
+ return (value_t)1;
+ }
+
+ static value_t convertToDerived(value_t base_value)
+ {
+ return (value_t)1;
+ }
+
+ unit_t operator + (const unit_t other) const
+ {
+ return unit_t(mValue + other.mValue);
+ }
+
+ void operator += (const unit_t other)
+ {
+ mValue += other.mValue;
+ }
+
+ unit_t operator - (const unit_t other) const
+ {
+ return unit_t(mValue - other.mValue);
+ }
+
+ void operator -= (const unit_t other)
+ {
+ mValue -= other.mValue;
+ }
+
+ unit_t operator * (value_t multiplicand) const
+ {
+ return unit_t(mValue * multiplicand);
+ }
+
+ void operator *= (value_t multiplicand)
+ {
+ mValue *= multiplicand;
+ }
+
+ unit_t operator / (value_t divisor) const
+ {
+ return unit_t(mValue / divisor);
+ }
+
+ void operator /= (value_t divisor)
+ {
+ mValue /= divisor;
+ }
+
+protected:
+ void setBaseValue(T value)
+ {
+ mValue = value;
+ }
+
+ T mValue;
+};
+
+#define LL_DECLARE_BASE_UNIT(unit_name) \
+ template<typename STORAGE_TYPE> \
+ struct unit_name : public LLUnit<STORAGE_TYPE> \
+ { \
+ unit_name(STORAGE_TYPE value) \
+ : LLUnit(value) \
+ {} \
+ \
+ unit_name() \
+ {} \
+ \
+ template <typename T> \
+ unit_name(const LLUnit<unit_name, T>& other) \
+ { \
+ setBaseValue(other.unit_name::get()); \
+ } \
+ \
+ using LLUnit<STORAGE_TYPE>::operator +; \
+ using LLUnit<STORAGE_TYPE>::operator +=; \
+ using LLUnit<STORAGE_TYPE>::operator -; \
+ using LLUnit<STORAGE_TYPE>::operator -=; \
+ using LLUnit<STORAGE_TYPE>::operator *; \
+ using LLUnit<STORAGE_TYPE>::operator *=; \
+ using LLUnit<STORAGE_TYPE>::operator /; \
+ using LLUnit<STORAGE_TYPE>::operator /=; \
+ };
+
+#define LL_DECLARE_DERIVED_UNIT(base_unit, derived_unit, conversion_factor) \
+ template<typename STORAGE_TYPE> \
+ struct derived_unit : public LLUnit<base_unit<STORAGE_TYPE>, derived_unit<STORAGE_TYPE> > \
+ { \
+ derived_unit(value_t value) \
+ : LLUnit(value) \
+ {} \
+ \
+ derived_unit() \
+ {} \
+ \
+ template <typename T> \
+ derived_unit(const LLUnit<base_unit<STORAGE_TYPE>, T>& other) \
+ { \
+ setBaseValue(other.base_unit<STORAGE_TYPE>::get()); \
+ } \
+ \
+ static F32 conversionToBaseFactor() { return (F32)(conversion_factor); } \
+ \
+ using LLUnit<STORAGE_TYPE>::operator +; \
+ using LLUnit<STORAGE_TYPE>::operator +=; \
+ using LLUnit<STORAGE_TYPE>::operator -; \
+ using LLUnit<STORAGE_TYPE>::operator -=; \
+ using LLUnit<STORAGE_TYPE>::operator *; \
+ using LLUnit<STORAGE_TYPE>::operator *=; \
+ using LLUnit<STORAGE_TYPE>::operator /; \
+ using LLUnit<STORAGE_TYPE>::operator /=; \
+ };
+
+namespace LLUnits
+{
+ LL_DECLARE_BASE_UNIT(Bytes);
+ LL_DECLARE_DERIVED_UNIT(Bytes, Kilobytes, 1024);
+ LL_DECLARE_DERIVED_UNIT(Bytes, Megabytes, 1024 * 1024);
+ LL_DECLARE_DERIVED_UNIT(Bytes, Gigabytes, 1024 * 1024 * 1024);
+ LL_DECLARE_DERIVED_UNIT(Bytes, Bits, (1.f / 8.f));
+ LL_DECLARE_DERIVED_UNIT(Bytes, Kilobit, (1024 / 8));
+ LL_DECLARE_DERIVED_UNIT(Bytes, Megabits, (1024 / 8));
+ LL_DECLARE_DERIVED_UNIT(Bytes, Gigabits, (1024 * 1024 * 1024 / 8));
+
+ LL_DECLARE_BASE_UNIT(Seconds);
+ LL_DECLARE_DERIVED_UNIT(Seconds, Minutes, 60);
+ LL_DECLARE_DERIVED_UNIT(Seconds, Hours, 60 * 60);
+ LL_DECLARE_DERIVED_UNIT(Seconds, Days, 60 * 60 * 24);
+ LL_DECLARE_DERIVED_UNIT(Seconds, Weeks, 60 * 60 * 24 * 7);
+ LL_DECLARE_DERIVED_UNIT(Seconds, Milliseconds, (1.f / 1000.f));
+ LL_DECLARE_DERIVED_UNIT(Seconds, Microseconds, (1.f / (1000000.f)));
+ LL_DECLARE_DERIVED_UNIT(Seconds, Nanoseconds, (1.f / (1000000000.f)));
+
+}
+
+#endif // LL_LLUNIT_H
diff --git a/indra/newview/llstatusbar.cpp b/indra/newview/llstatusbar.cpp
index ab97d6465a..6f2a0de894 100644
--- a/indra/newview/llstatusbar.cpp
+++ b/indra/newview/llstatusbar.cpp
@@ -198,7 +198,7 @@ BOOL LLStatusBar::postBuild()
sgp.rect(r);
sgp.follows.flags(FOLLOWS_BOTTOM | FOLLOWS_RIGHT);
sgp.mouse_opaque(false);
- sgp.stat.rate_stat(&STAT_KBIT);
+ sgp.stat.rate_stat(&LLStatViewer::KBIT);
sgp.units("Kbps");
sgp.precision(0);
mSGBandwidth = LLUICtrlFactory::create<LLStatGraph>(sgp);
diff --git a/indra/newview/llviewerstats.cpp b/indra/newview/llviewerstats.cpp
index a6e9643edd..954fa24eaa 100755
--- a/indra/newview/llviewerstats.cpp
+++ b/indra/newview/llviewerstats.cpp
@@ -61,21 +61,128 @@
#include "llviewernetwork.h"
#include "llmeshrepository.h" //for LLMeshRepository::sBytesReceived
+namespace LLStatViewer
+{
-LLTrace::Rate<F32> STAT_KBIT("kbitstat"),
- STAT_LAYERS_KBIT("layerskbitstat"),
- STAT_OBJECT_KBIT("objectkbitstat"),
- STAT_ASSET_KBIT("assetkbitstat"),
- STAT_TEXTURE_KBIT("texturekbitstat");
-
+LLTrace::Rate<F32> FPS("fpsstat"),
+ PACKETS_IN("packetsinstat"),
+ PACKETS_LOST("packetsloststat"),
+ PACKETS_OUT("packetsoutstat"),
+ TEXTURE_PACKETS("texturepacketsstat"),
+ TRIANGLES_DRAWN("trianglesdrawnstat"),
+ CHAT_COUNT("chatcount"),
+ IM_COUNT("imcount"),
+ OBJECT_CREATE("objectcreate"),
+ OBJECT_REZ("objectrez"),
+ LOADING_WEARABLES_LONG_DELAY("loadingwearableslongdelay"),
+ LOGIN_TIMEOUTS("logintimeouts"),
+ FAILED_DOWNLOADS("faileddownloads"),
+ LSL_SAVES("lslsaves"),
+ ANIMATION_UPLOADS("animationuploads"),
+ FLY("fly"),
+ TELEPORT("teleport"),
+ DELETE_OBJECT("deleteobject"),
+ SNAPSHOT("snapshot"),
+ UPLOAD_SOUND("uploadsound"),
+ UPLOAD_TEXTURE("uploadtexture"),
+ EDIT_TEXTURE("edittexture"),
+ KILLED("killed"),
+ FRAMETIME_DOUBLED("frametimedoubled"),
+ TEX_BAKES("texbakes"),
+ TEX_REBAKES("texrebakes");
+LLTrace::Rate<LLUnits::Bytes<F32> > KBIT("kbitstat"),
+ LAYERS_KBIT("layerskbitstat"),
+ OBJECT_KBIT("objectkbitstat"),
+ ASSET_KBIT("assetkbitstat"),
+ TEXTURE_KBIT("texturekbitstat"),
+ ACTUAL_IN_KBIT("actualinkbit"),
+ ACTUAL_OUT_KBIT("actualoutkbit");
+
+LLTrace::Rate<LLUnits::Seconds<F32> > AVATAR_EDIT_TIME("avataredittimr"),
+ TOOLBOX_TIME("toolboxtime"),
+ MOUSELOOK_TIME("mouselooktime"),
+ FPS_10_TIME("fps10time"),
+ FPS_8_TIME("fps8time"),
+ FPS_2_TIME("fps2time"),
+ SIM_20_FPS_TIME("sim20fpstime"),
+ SIM_PHYSICS_20_FPS_TIME("simphysics20fpstime"),
+ LOSS_5_PERCENT_TIME("loss5percenttime");
+
+LLTrace::Measurement<F32> SIM_TIME_DILATION("simtimedilation"),
+ SIM_FPS("simfps"),
+ SIM_PHYSICS_FPS("simphysicsfps"),
+ SIM_AGENT_UPS("simagentups"),
+ SIM_SCRIPT_EPS("simscripteps"),
+ SIM_SKIPPED_SILHOUETTE("simsimskippedsilhouettesteps"),
+ SIM_SKIPPED_CHARACTERS_PERCENTAGE("simsimpctsteppedcharacters"),
+ SIM_MAIN_AGENTS("simmainagents"),
+ SIM_CHILD_AGENTS("simchildagents"),
+ SIM_OBJECTS("simobjects"),
+ SIM_ACTIVE_OBJECTS("simactiveobjects"),
+ SIM_ACTIVE_SCRIPTS("simactivescripts"),
+ SIM_PERCENTAGE_SCRIPTS_RUN("simpctscriptsrun"),
+ SIM_IN_PACKETS_PER_SEC("siminpps"),
+ SIM_OUT_PACKETS_PER_SEC("simoutpps"),
+ SIM_PENDING_DOWNLOADS("simpendingdownloads"),
+ SIM_PENDING_UPLOADS("simpendinguploads"),
+ SIM_PENING_LOCAL_UPLOADS("simpendinglocaluploads"),
+ SIM_PHYSICS_PINNED_TASKS("physicspinnedtasks"),
+ SIM_PHYSICS_LOD_TASKS("physicslodtasks"),
+ NUM_IMAGES("numimagesstat"),
+ NUM_RAW_IMAGES("numrawimagesstat"),
+ NUM_OBJECTS("numobjectsstat"),
+ NUM_ACTIVE_OBJECTS("numactiveobjectsstat"),
+ NUM_NEW_OBJECTS("numnewobjectsstat"),
+ NUM_SIZE_CULLED("numsizeculledstat"),
+ NUM_VIS_CULLED("numvisculledstat"),
+ ENABLE_VBO("enablevbo"),
+ DELTA_BANDWIDTH("deltabandwidth"),
+ MAX_BANDWIDTH("maxbandwidth"),
+ LIGHTING_DETAIL("lightingdetail"),
+ VISIBLE_AVATARS("visibleavatars"),
+ SHADER_OBJECTS("shaderobjects"),
+ DRAW_DISTANCE("drawdistance"),
+ CHAT_BUBBLES("chatbubbles"),
+ WINDOW_WIDTH("windowwidth"),
+ WINDOW_HEIGHT("windowheight");
+
+LLTrace::Measurement<LLUnits::Bytes<F32> > SIM_UNACKED_BYTES("simtotalunackedbytes"),
+ SIM_PHYSICS_MEM("physicsmemoryallocated"),
+ GL_TEX_MEM("gltexmemstat"),
+ GL_BOUND_MEM("glboundmemstat"),
+ RAW_MEM("rawmemstat"),
+ FORMATTED_MEM("formattedmemstat");
+
+
+LLTrace::Measurement<LLUnits::Seconds<F32> > SIM_PHYSICS_TIME("simsimphysicsmsec"),
+ SIM_PHYSICS_STEP_TIME("simsimphysicsstepmsec"),
+ SIM_PHYSICS_SHAPE_UPDATE_TIME("simsimphysicsshapeupdatemsec"),
+ SIM_PHYSICS_OTHER_TIME("simsimphysicsothermsec"),
+ SIM_AI_TIME("simsimaistepmsec"),
+ SIM_AGENTS_TIME("simagentmsec"),
+ SIM_IMAGES_TIME("simimagesmsec"),
+ SIM_SCRIPTS_TIME("simscriptmsec"),
+ SIM_SPARE_TIME("simsparemsec"),
+ SIM_SLEEP_TIME("simsleepmsec"),
+ SIM_PUMP_IO_TIME("simpumpiomsec"),
+ SIM_PING("simpingstat"),
+ LOGIN_SECONDS("loginseconds"),
+ REGION_CROSSING_TIME("regioncrossingtime"),
+ FRAME_STACKTIME("framestacktime"),
+ UPDATE_STACKTIME("updatestacktime"),
+ NETWORK_STACKTIME("networkstacktime"),
+ IMAGE_STACKTIME("imagestacktime"),
+ REBUILD_STACKTIME("rebuildstacktime"),
+ RENDER_STACKTIME("renderstacktime");
+}
class StatAttributes
{
public:
StatAttributes(const char* name,
const BOOL enabled)
- : mName(name),
- mEnabled(enabled)
+ : mName(name),
+ mEnabled(enabled)
{
}
@@ -465,12 +572,12 @@ void update_statistics()
stats.mFPSStat.addValue(1);
F32 layer_bits = (F32)(gVLManager.getLandBits() + gVLManager.getWindBits() + gVLManager.getCloudBits());
- STAT_LAYERS_KBIT.add(layer_bits/1024.f);
+ LLStatViewer::LAYERS_KBIT.add<LLUnits::Bits<F32> >(layer_bits);
//stats.mLayersKBitStat.addValue(layer_bits/1024.f);
- STAT_OBJECT_KBIT.add(gObjectBits/1024.f);
+ LLStatViewer::OBJECT_KBIT.add<LLUnits::Bits<F32> >(gObjectBits);
//stats.mObjectKBitStat.addValue(gObjectBits/1024.f);
stats.mVFSPendingOperations.addValue(LLVFile::getVFSThread()->getPending());
- STAT_ASSET_KBIT.add(gTransferManager.getTransferBitsIn(LLTCT_ASSET)/1024.f);
+ LLStatViewer::ASSET_KBIT.add<LLUnits::Bits<F32> >(gTransferManager.getTransferBitsIn(LLTCT_ASSET));
//stats.mAssetKBitStat.addValue(gTransferManager.getTransferBitsIn(LLTCT_ASSET)/1024.f);
gTransferManager.resetTransferBitsIn(LLTCT_ASSET);
@@ -508,7 +615,7 @@ void update_statistics()
static LLFrameTimer texture_stats_timer;
if (texture_stats_timer.getElapsedTimeF32() >= texture_stats_freq)
{
- STAT_TEXTURE_KBIT.add(LLViewerTextureList::sTextureBits/1024.f);
+ LLStatViewer::TEXTURE_KBIT.add<LLUnits::Bits<F32> >(LLViewerTextureList::sTextureBits);
//stats.mTextureKBitStat.addValue(LLViewerTextureList::sTextureBits/1024.f);
stats.mTexturePacketsStat.addValue(LLViewerTextureList::sTexturePackets);
gTotalTextureBytes += LLViewerTextureList::sTextureBits / 8;
diff --git a/indra/newview/llviewerstats.h b/indra/newview/llviewerstats.h
index ca5f6c6821..af2e915994 100755
--- a/indra/newview/llviewerstats.h
+++ b/indra/newview/llviewerstats.h
@@ -32,11 +32,121 @@
#include "lltracerecording.h"
#include "lltrace.h"
-extern LLTrace::Rate<F32> STAT_KBIT,
- STAT_LAYERS_KBIT,
- STAT_OBJECT_KBIT,
- STAT_ASSET_KBIT,
- STAT_TEXTURE_KBIT;
+namespace LLStatViewer
+{
+extern LLTrace::Rate<F32> FPS,
+ PACKETS_IN,
+ PACKETS_LOST,
+ PACKETS_OUT,
+ TEXTURE_PACKETS,
+ TRIANGLES_DRAWN,
+ CHAT_COUNT,
+ IM_COUNT,
+ OBJECT_CREATE,
+ OBJECT_REZ,
+ LOADING_WEARABLES_LONG_DELAY,
+ LOGIN_TIMEOUTS,
+ FAILED_DOWNLOADS,
+ LSL_SAVES,
+ ANIMATION_UPLOADS,
+ FLY,
+ TELEPORT,
+ DELETE_OBJECT,
+ SNAPSHOT,
+ UPLOAD_SOUND,
+ UPLOAD_TEXTURE,
+ EDIT_TEXTURE,
+ KILLED,
+ FRAMETIME_DOUBLED,
+ TEX_BAKES,
+ TEX_REBAKES;
+
+
+extern LLTrace::Rate<LLUnits::Bytes<F32> > KBIT,
+ LAYERS_KBIT,
+ OBJECT_KBIT,
+ ASSET_KBIT,
+ TEXTURE_KBIT,
+ ACTUAL_IN_KBIT,
+ ACTUAL_OUT_KBIT;
+
+extern LLTrace::Rate<LLUnits::Seconds<F32> > AVATAR_EDIT_TIME,
+ TOOLBOX_TIME,
+ MOUSELOOK_TIME,
+ FPS_10_TIME,
+ FPS_8_TIME,
+ FPS_2_TIME,
+ SIM_20_FPS_TIME,
+ SIM_PHYSICS_20_FPS_TIME,
+ LOSS_5_PERCENT_TIME;
+
+extern LLTrace::Measurement<F32> SIM_TIME_DILATION,
+ SIM_FPS,
+ SIM_PHYSICS_FPS,
+ SIM_AGENT_UPS,
+ SIM_SCRIPT_EPS,
+ SIM_SKIPPED_SILHOUETTE,
+ SIM_SKIPPED_CHARACTERS_PERCENTAGE,
+ SIM_MAIN_AGENTS,
+ SIM_CHILD_AGENTS,
+ SIM_OBJECTS,
+ SIM_ACTIVE_OBJECTS,
+ SIM_ACTIVE_SCRIPTS,
+ SIM_PERCENTAGE_SCRIPTS_RUN,
+ SIM_IN_PACKETS_PER_SEC,
+ SIM_OUT_PACKETS_PER_SEC,
+ SIM_PENDING_DOWNLOADS,
+ SIM_PENDING_UPLOADS,
+ SIM_PENING_LOCAL_UPLOADS,
+ SIM_PHYSICS_PINNED_TASKS,
+ SIM_PHYSICS_LOD_TASKS,
+ NUM_IMAGES,
+ NUM_RAW_IMAGES,
+ NUM_OBJECTS,
+ NUM_ACTIVE_OBJECTS,
+ NUM_NEW_OBJECTS,
+ NUM_SIZE_CULLED,
+ NUM_VIS_CULLED,
+ ENABLE_VBO,
+ DELTA_BANDWIDTH,
+ MAX_BANDWIDTH,
+ LIGHTING_DETAIL,
+ VISIBLE_AVATARS,
+ SHADER_OBJECTS,
+ DRAW_DISTANCE,
+ CHAT_BUBBLES,
+ WINDOW_WIDTH,
+ WINDOW_HEIGHT;
+
+extern LLTrace::Measurement<LLUnits::Bytes<F32> > SIM_UNACKED_BYTES,
+ SIM_PHYSICS_MEM,
+ GL_TEX_MEM,
+ GL_BOUND_MEM,
+ RAW_MEM,
+ FORMATTED_MEM;
+
+
+extern LLTrace::Measurement<LLUnits::Seconds<F32> > SIM_PHYSICS_TIME,
+ SIM_PHYSICS_STEP_TIME,
+ SIM_PHYSICS_SHAPE_UPDATE_TIME,
+ SIM_PHYSICS_OTHER_TIME,
+ SIM_AI_TIME,
+ SIM_AGENTS_TIME,
+ SIM_IMAGES_TIME,
+ SIM_SCRIPTS_TIME,
+ SIM_SPARE_TIME,
+ SIM_SLEEP_TIME,
+ SIM_PUMP_IO_TIME,
+ SIM_PING,
+ LOGIN_SECONDS,
+ REGION_CROSSING_TIME,
+ FRAME_STACKTIME,
+ UPDATE_STACKTIME,
+ NETWORK_STACKTIME,
+ IMAGE_STACKTIME,
+ REBUILD_STACKTIME,
+ RENDER_STACKTIME;
+}
class LLViewerStats : public LLSingleton<LLViewerStats>
{
diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp
index 4e62cbd714..de3dd3c1c6 100644
--- a/indra/newview/llviewertexturelist.cpp
+++ b/indra/newview/llviewertexturelist.cpp
@@ -624,7 +624,7 @@ void LLViewerTextureList::updateImages(F32 max_time)
LLTrace::Recording* recording = LLTrace::get_thread_recorder()->getPrimaryRecording();
- LLAppViewer::getTextureFetch()->setTextureBandwidth(recording->getPerSec(STAT_TEXTURE_KBIT));
+ LLAppViewer::getTextureFetch()->setTextureBandwidth(recording->getPerSec(LLStatViewer::TEXTURE_KBIT));
LLViewerStats::getInstance()->mNumImagesStat.addValue(sNumImages);
LLViewerStats::getInstance()->mNumRawImagesStat.addValue(LLImageRaw::sRawImageCount);
diff --git a/indra/newview/llworld.cpp b/indra/newview/llworld.cpp
index 1e8665e229..bf2a58f107 100644
--- a/indra/newview/llworld.cpp
+++ b/indra/newview/llworld.cpp
@@ -702,9 +702,10 @@ void LLWorld::updateNetStats()
S32 actual_in_bits = gMessageSystem->mPacketRing.getAndResetActualInBits();
S32 actual_out_bits = gMessageSystem->mPacketRing.getAndResetActualOutBits();
+
LLViewerStats::getInstance()->mActualInKBitStat.addValue(actual_in_bits/1024.f);
LLViewerStats::getInstance()->mActualOutKBitStat.addValue(actual_out_bits/1024.f);
- STAT_KBIT.add(bits/1024.f);
+ LLStatViewer::KBIT.add<LLUnits::Bits<F32> >(bits);
//LLViewerStats::getInstance()->mKBitStat.addValue(bits/1024.f);
LLViewerStats::getInstance()->mPacketsInStat.addValue(packets_in);
LLViewerStats::getInstance()->mPacketsOutStat.addValue(packets_out);