summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
Diffstat (limited to 'indra')
-rw-r--r--indra/llcommon/CMakeLists.txt2
-rw-r--r--indra/llcommon/llinstancetracker.h10
-rw-r--r--indra/llcommon/llmetricperformancetester.cpp1
-rw-r--r--indra/llcommon/llpredicate.h4
-rw-r--r--indra/llcommon/llstat.cpp352
-rw-r--r--indra/llcommon/llstat.h103
-rw-r--r--indra/llcommon/lltrace.h90
-rw-r--r--indra/llcommon/lltracerecording.cpp119
-rw-r--r--indra/llcommon/lltracerecording.h216
-rw-r--r--indra/llcommon/lltracethreadrecorder.cpp4
-rw-r--r--indra/llui/llstatbar.cpp138
-rw-r--r--indra/llui/llstatbar.h11
-rw-r--r--indra/llui/llstatgraph.cpp20
-rw-r--r--indra/llui/llstatgraph.h13
-rw-r--r--indra/llvfs/llvfile.cpp2
-rw-r--r--indra/lscript/lscript_execute/lscript_execute.cpp1
-rw-r--r--indra/newview/llagentcamera.cpp4
-rw-r--r--indra/newview/llappviewer.cpp3
-rw-r--r--indra/newview/llfasttimerview.cpp1
-rw-r--r--indra/newview/llfloaterjoystick.cpp17
-rw-r--r--indra/newview/llfloaterjoystick.h1
-rw-r--r--indra/newview/llhudnametag.cpp5
-rw-r--r--indra/newview/llstatusbar.cpp4
-rw-r--r--indra/newview/llsurface.h1
-rw-r--r--indra/newview/lltexturefetch.cpp10
-rw-r--r--indra/newview/lltexturefetch.h7
-rw-r--r--indra/newview/llviewercamera.cpp13
-rw-r--r--indra/newview/llviewercamera.h28
-rw-r--r--indra/newview/llviewerdisplay.cpp6
-rwxr-xr-xindra/newview/llviewermessage.cpp22
-rw-r--r--indra/newview/llviewerobjectlist.cpp4
-rw-r--r--indra/newview/llviewerobjectlist.h4
-rw-r--r--indra/newview/llviewerregion.cpp9
-rw-r--r--indra/newview/llviewerregion.h6
-rwxr-xr-xindra/newview/llviewerstats.cpp33
-rwxr-xr-xindra/newview/llviewerstats.h1
-rw-r--r--indra/newview/llviewertexturelist.h1
-rwxr-xr-xindra/newview/llviewerwindow.cpp11
-rw-r--r--indra/newview/llviewerwindow.h7
-rwxr-xr-xindra/newview/llvoavatar.cpp6
-rw-r--r--indra/newview/llworld.cpp17
-rw-r--r--indra/newview/pipeline.cpp6
42 files changed, 543 insertions, 770 deletions
diff --git a/indra/llcommon/CMakeLists.txt b/indra/llcommon/CMakeLists.txt
index d876842cf1..0f5ded86ed 100644
--- a/indra/llcommon/CMakeLists.txt
+++ b/indra/llcommon/CMakeLists.txt
@@ -91,7 +91,6 @@ set(llcommon_SOURCE_FILES
llsdutil.cpp
llsecondlifeurls.cpp
llsingleton.cpp
- llstat.cpp
llstacktrace.cpp
llstreamqueue.cpp
llstreamtools.cpp
@@ -234,7 +233,6 @@ set(llcommon_HEADER_FILES
llsortedvector.h
llstack.h
llstacktrace.h
- llstat.h
llstatenums.h
llstl.h
llstreamqueue.h
diff --git a/indra/llcommon/llinstancetracker.h b/indra/llcommon/llinstancetracker.h
index 403df08990..3a1187a4c1 100644
--- a/indra/llcommon/llinstancetracker.h
+++ b/indra/llcommon/llinstancetracker.h
@@ -77,8 +77,8 @@ protected:
/// This mix-in class adds support for tracking all instances of the specified class parameter T
/// The (optional) key associates a value of type KEY with a given instance of T, for quick lookup
/// If KEY is not provided, then instances are stored in a simple set
-/// @NOTE: see explicit specialization below for default KEY==T* case
-template<typename T, typename KEY = T*>
+/// @NOTE: see explicit specialization below for default KEY==void case
+template<typename T, typename KEY = void>
class LLInstanceTracker : public LLInstanceTrackerBase
{
typedef LLInstanceTracker<T, KEY> MyT;
@@ -224,12 +224,12 @@ private:
KEY mInstanceKey;
};
-/// explicit specialization for default case where KEY is T*
+/// explicit specialization for default case where KEY is void
/// use a simple std::set<T*>
template<typename T>
-class LLInstanceTracker<T, T*> : public LLInstanceTrackerBase
+class LLInstanceTracker<T, void> : public LLInstanceTrackerBase
{
- typedef LLInstanceTracker<T, T*> MyT;
+ typedef LLInstanceTracker<T, void> MyT;
typedef typename std::set<T*> InstanceSet;
struct StaticData: public StaticBase
{
diff --git a/indra/llcommon/llmetricperformancetester.cpp b/indra/llcommon/llmetricperformancetester.cpp
index 41d3eb0bf3..a1b0a684c5 100644
--- a/indra/llcommon/llmetricperformancetester.cpp
+++ b/indra/llcommon/llmetricperformancetester.cpp
@@ -29,7 +29,6 @@
#include "indra_constants.h"
#include "llerror.h"
#include "llsdserialize.h"
-#include "llstat.h"
#include "lltreeiterators.h"
#include "llmetricperformancetester.h"
diff --git a/indra/llcommon/llpredicate.h b/indra/llcommon/llpredicate.h
index 3f1bf1c8e6..75744667d9 100644
--- a/indra/llcommon/llpredicate.h
+++ b/indra/llcommon/llpredicate.h
@@ -165,6 +165,10 @@ namespace LLPredicate
: Literal(e)
{}
+ Value(const Literal other)
+ : Literal(other)
+ {}
+
Value()
{}
};
diff --git a/indra/llcommon/llstat.cpp b/indra/llcommon/llstat.cpp
deleted file mode 100644
index b46d2e58b2..0000000000
--- a/indra/llcommon/llstat.cpp
+++ /dev/null
@@ -1,352 +0,0 @@
-/**
- * @file llstat.cpp
- *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, 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$
- */
-
-#include "linden_common.h"
-
-#include "llstat.h"
-#include "lllivefile.h"
-#include "llerrorcontrol.h"
-#include "llframetimer.h"
-#include "timing.h"
-#include "llsd.h"
-#include "llsdserialize.h"
-#include "llstl.h"
-#include "u64.h"
-
-
-// statics
-//------------------------------------------------------------------------
-LLTimer LLStat::sTimer;
-LLFrameTimer LLStat::sFrameTimer;
-
-void LLStat::reset()
-{
- mNumValues = 0;
- mLastValue = 0.f;
- delete[] mBins;
- mBins = new ValueEntry[mNumBins];
- mCurBin = mNumBins-1;
- mNextBin = 0;
-}
-
-LLStat::LLStat(std::string name, BOOL use_frame_timer)
-: LLInstanceTracker<LLStat, std::string>(name),
- mUseFrameTimer(use_frame_timer),
- mNumBins(50),
- mName(name),
- mBins(NULL)
-{
- llassert(mNumBins > 0);
- mLastTime = 0.f;
-
- reset();
-}
-
-LLStat::~LLStat()
-{
- delete[] mBins;
-}
-//
-//void LLStat::start()
-//{
-// if (mUseFrameTimer)
-// {
-// mBins[mNextBin].mBeginTime = sFrameTimer.getElapsedSeconds();
-// }
-// else
-// {
-// mBins[mNextBin].mBeginTime = sTimer.getElapsedTimeF64();
-// }
-//}
-
-void LLStat::addValue(const F32 value)
-{
- if (mNumValues < mNumBins)
- {
- mNumValues++;
- }
-
- // Increment the bin counters.
- mCurBin++;
- if (mCurBin >= mNumBins)
- {
- mCurBin = 0;
- }
- mNextBin++;
- if (mNextBin >= mNumBins)
- {
- mNextBin = 0;
- }
-
- mBins[mCurBin].mValue = value;
- if (mUseFrameTimer)
- {
- mBins[mCurBin].mTime = sFrameTimer.getElapsedSeconds();
- }
- else
- {
- mBins[mCurBin].mTime = sTimer.getElapsedTimeF64();
- }
- mBins[mCurBin].mDT = (F32)(mBins[mCurBin].mTime - mBins[mCurBin].mBeginTime);
-
- //this value is used to prime the min/max calls
- mLastTime = mBins[mCurBin].mTime;
- mLastValue = value;
-
- // Set the begin time for the next stat segment.
- mBins[mNextBin].mBeginTime = mBins[mCurBin].mTime;
- mBins[mNextBin].mTime = mBins[mCurBin].mTime;
- mBins[mNextBin].mDT = 0.f;
-}
-
-
-F32 LLStat::getMax() const
-{
- S32 i;
- F32 current_max = mLastValue;
- if (mNumBins == 0)
- {
- current_max = 0.f;
- }
- else
- {
- for (i = 0; (i < mNumBins) && (i < mNumValues); i++)
- {
- // Skip the bin we're currently filling.
- if (i == mNextBin)
- {
- continue;
- }
- if (mBins[i].mValue > current_max)
- {
- current_max = mBins[i].mValue;
- }
- }
- }
- return current_max;
-}
-
-F32 LLStat::getMean() const
-{
- S32 i;
- F32 current_mean = 0.f;
- S32 samples = 0;
- for (i = 0; (i < mNumBins) && (i < mNumValues); i++)
- {
- // Skip the bin we're currently filling.
- if (i == mNextBin)
- {
- continue;
- }
- current_mean += mBins[i].mValue;
- samples++;
- }
-
- // There will be a wrap error at 2^32. :)
- if (samples != 0)
- {
- current_mean /= samples;
- }
- else
- {
- current_mean = 0.f;
- }
- return current_mean;
-}
-
-F32 LLStat::getMin() const
-{
- S32 i;
- F32 current_min = mLastValue;
-
- if (mNumBins == 0)
- {
- current_min = 0.f;
- }
- else
- {
- for (i = 0; (i < mNumBins) && (i < mNumValues); i++)
- {
- // Skip the bin we're currently filling.
- if (i == mNextBin)
- {
- continue;
- }
- if (mBins[i].mValue < current_min)
- {
- current_min = mBins[i].mValue;
- }
- }
- }
- return current_min;
-}
-
-F32 LLStat::getPrev(S32 age) const
-{
- S32 bin;
- bin = mCurBin - age;
-
- while (bin < 0)
- {
- bin += mNumBins;
- }
-
- if (bin == mNextBin)
- {
- // Bogus for bin we're currently working on.
- return 0.f;
- }
- return mBins[bin].mValue;
-}
-
-F32 LLStat::getPrevPerSec(S32 age) const
-{
- S32 bin;
- bin = mCurBin - age;
-
- while (bin < 0)
- {
- bin += mNumBins;
- }
-
- if (bin == mNextBin)
- {
- // Bogus for bin we're currently working on.
- return 0.f;
- }
- return mBins[bin].mValue / mBins[bin].mDT;
-}
-
-F32 LLStat::getCurrent() const
-{
- return mBins[mCurBin].mValue;
-}
-
-F32 LLStat::getCurrentPerSec() const
-{
- return mBins[mCurBin].mValue / mBins[mCurBin].mDT;
-}
-
-F32 LLStat::getMeanPerSec() const
-{
- S32 i;
- F32 value = 0.f;
- F32 dt = 0.f;
-
- for (i = 0; (i < mNumBins) && (i < mNumValues); i++)
- {
- // Skip the bin we're currently filling.
- if (i == mNextBin)
- {
- continue;
- }
- value += mBins[i].mValue;
- dt += mBins[i].mDT;
- }
-
- if (dt > 0.f)
- {
- return value/dt;
- }
- else
- {
- return 0.f;
- }
-}
-
-F32 LLStat::getMaxPerSec() const
-{
- F32 value;
-
- if (mNextBin != 0)
- {
- value = mBins[0].mValue/mBins[0].mDT;
- }
- else if (mNumValues > 0)
- {
- value = mBins[1].mValue/mBins[1].mDT;
- }
- else
- {
- value = 0.f;
- }
-
- for (S32 i = 0; (i < mNumBins) && (i < mNumValues); i++)
- {
- // Skip the bin we're currently filling.
- if (i == mNextBin)
- {
- continue;
- }
- value = llmax(value, mBins[i].mValue/mBins[i].mDT);
- }
- return value;
-}
-
-F32 LLStat::getMinPerSec() const
-{
- S32 i;
- F32 value;
-
- if (mNextBin != 0)
- {
- value = mBins[0].mValue/mBins[0].mDT;
- }
- else if (mNumValues > 0)
- {
- value = mBins[1].mValue/mBins[0].mDT;
- }
- else
- {
- value = 0.f;
- }
-
- for (i = 0; (i < mNumBins) && (i < mNumValues); i++)
- {
- // Skip the bin we're currently filling.
- if (i == mNextBin)
- {
- continue;
- }
- value = llmin(value, mBins[i].mValue/mBins[i].mDT);
- }
- return value;
-}
-
-U32 LLStat::getNumValues() const
-{
- return mNumValues;
-}
-
-S32 LLStat::getNumBins() const
-{
- return mNumBins;
-}
-
-S32 LLStat::getNextBin() const
-{
- return mNextBin;
-}
-
diff --git a/indra/llcommon/llstat.h b/indra/llcommon/llstat.h
deleted file mode 100644
index 82a246275d..0000000000
--- a/indra/llcommon/llstat.h
+++ /dev/null
@@ -1,103 +0,0 @@
-/**
- * @file llstat.h
- * @brief Runtime statistics accumulation.
- *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, 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_LLSTAT_H
-#define LL_LLSTAT_H
-
-#include <map>
-
-#include "lltimer.h"
-#include "llframetimer.h"
-#include "llinstancetracker.h"
-
-class LLSD;
-
-// ----------------------------------------------------------------------------
-class LL_COMMON_API LLStat : public LLInstanceTracker<LLStat, std::string>
-{
-public:
- LLStat(std::string name = std::string(), BOOL use_frame_timer = FALSE);
- ~LLStat();
-
- //void start(); // Start the timer for the current "frame", otherwise uses the time tracked from
- // the last addValue
- void reset();
- void addValue(const F32 value = 1.f); // Adds the current value being tracked, and tracks the DT.
- void addValue(const S32 value) { addValue((F32)value); }
- void addValue(const U32 value) { addValue((F32)value); }
-
- S32 getNextBin() const;
-
- F32 getPrev(S32 age) const; // Age is how many "addValues" previously - zero is current
- F32 getPrevPerSec(S32 age) const; // Age is how many "addValues" previously - zero is current
-
- F32 getCurrent() const;
- F32 getCurrentPerSec() const;
-
- F32 getMin() const;
- F32 getMinPerSec() const;
-
- F32 getMean() const;
- F32 getMeanPerSec() const;
-
- F32 getMax() const;
- F32 getMaxPerSec() const;
-
- U32 getNumValues() const;
- S32 getNumBins() const;
-
-private:
- bool mUseFrameTimer;
- U32 mNumValues;
- U32 mNumBins;
- F32 mLastValue;
- F64 mLastTime;
-
- struct ValueEntry
- {
- ValueEntry()
- : mValue(0.f),
- mBeginTime(0.0),
- mTime(0.0),
- mDT(0.f)
- {}
- F32 mValue;
- F64 mBeginTime;
- F64 mTime;
- F32 mDT;
- };
- ValueEntry* mBins;
-
- S32 mCurBin;
- S32 mNextBin;
-
- std::string mName;
-
- static LLTimer sTimer;
- static LLFrameTimer sFrameTimer;
-};
-
-#endif // LL_STAT_
diff --git a/indra/llcommon/lltrace.h b/indra/llcommon/lltrace.h
index 2cdae4b0d2..2823db5cbb 100644
--- a/indra/llcommon/lltrace.h
+++ b/indra/llcommon/lltrace.h
@@ -227,10 +227,33 @@ namespace LLTrace
};
+ template<typename T, typename IS_UNIT = void>
+ struct StorageType
+ {
+ typedef T type_t;
+ };
+
+ template<typename T>
+ struct StorageType<T, typename T::is_unit_tag_t>
+ {
+ typedef typename StorageType<typename T::storage_t>::type_t type_t;
+ };
+
+ template<> struct StorageType<F32> { typedef F64 type_t; };
+ template<> struct StorageType<S32> { typedef S64 type_t; };
+ template<> struct StorageType<U32> { typedef S64 type_t; };
+ template<> struct StorageType<S16> { typedef S64 type_t; };
+ template<> struct StorageType<U16> { typedef S64 type_t; };
+ template<> struct StorageType<S8> { typedef S64 type_t; };
+ template<> struct StorageType<U8> { typedef S64 type_t; };
+
template<typename T>
class LL_COMMON_API MeasurementAccumulator
{
public:
+ typedef T value_t;
+ typedef MeasurementAccumulator<T> self_t;
+
MeasurementAccumulator()
: mSum(0),
mMin(std::numeric_limits<T>::max()),
@@ -243,23 +266,24 @@ namespace LLTrace
LL_FORCE_INLINE void sample(T value)
{
+ T storage_value(value);
mNumSamples++;
- mSum += value;
- if (value < mMin)
+ mSum += storage_value;
+ if (storage_value < mMin)
{
- mMin = value;
+ mMin = storage_value;
}
- else if (value > mMax)
+ if (storage_value > mMax)
{
- mMax = value;
+ mMax = storage_value;
}
F64 old_mean = mMean;
- mMean += ((F64)value - old_mean) / (F64)mNumSamples;
- mVarianceSum += ((F64)value - old_mean) * ((F64)value - mMean);
- mLastValue = value;
+ mMean += ((F64)storage_value - old_mean) / (F64)mNumSamples;
+ mVarianceSum += ((F64)storage_value - old_mean) * ((F64)storage_value - mMean);
+ mLastValue = storage_value;
}
- void addSamples(const MeasurementAccumulator<T>& other)
+ void addSamples(const self_t& other)
{
mSum += other.mSum;
if (other.mMin < mMin)
@@ -293,7 +317,7 @@ namespace LLTrace
}
else
{
- mVarianceSum = (F32)mNumSamples
+ mVarianceSum = (F64)mNumSamples
* ((((n_1 - 1.f) * sd_1 * sd_1)
+ ((n_2 - 1.f) * sd_2 * sd_2)
+ (((n_1 * n_2) / (n_1 + n_2))
@@ -311,10 +335,10 @@ namespace LLTrace
mMax = 0;
}
- T getSum() const { return mSum; }
- T getMin() const { return mMin; }
- T getMax() const { return mMax; }
- T getLastValue() const { return mLastValue; }
+ T getSum() const { return (T)mSum; }
+ T getMin() const { return (T)mMin; }
+ T getMax() const { return (T)mMax; }
+ T getLastValue() const { return (T)mLastValue; }
F64 getMean() const { return mMean; }
F64 getStandardDeviation() const { return sqrtf(mVarianceSum / mNumSamples); }
U32 getSampleCount() const { return mNumSamples; }
@@ -325,7 +349,7 @@ namespace LLTrace
mMax,
mLastValue;
- F64 mMean,
+ F64 mMean,
mVarianceSum;
U32 mNumSamples;
@@ -335,6 +359,8 @@ namespace LLTrace
class LL_COMMON_API CountAccumulator
{
public:
+ typedef T value_t;
+
CountAccumulator()
: mSum(0),
mNumSamples(0)
@@ -358,7 +384,7 @@ namespace LLTrace
mSum = 0;
}
- T getSum() const { return mSum; }
+ T getSum() const { return (T)mSum; }
private:
T mSum;
@@ -366,14 +392,15 @@ namespace LLTrace
U32 mNumSamples;
};
- typedef TraceType<MeasurementAccumulator<F64> > measurement_common_t;
+ typedef TraceType<MeasurementAccumulator<F64> > measurement_common_float_t;
+ typedef TraceType<MeasurementAccumulator<S64> > measurement_common_int_t;
template <typename T = F64, typename IS_UNIT = void>
class LL_COMMON_API Measurement
- : public TraceType<MeasurementAccumulator<T> >
+ : public TraceType<MeasurementAccumulator<typename StorageType<T>::type_t> >
{
public:
- typedef T storage_t;
+ typedef typename StorageType<T>::type_t storage_t;
Measurement(const char* name, const char* description = NULL)
: TraceType(name, description)
@@ -381,17 +408,16 @@ namespace LLTrace
void sample(T value)
{
- getPrimaryAccumulator().sample(value);
+ getPrimaryAccumulator().sample((storage_t)value);
}
};
template <typename T>
class LL_COMMON_API Measurement <T, typename T::is_unit_tag_t>
- : public TraceType<MeasurementAccumulator<typename T::storage_t> >
+ : public TraceType<MeasurementAccumulator<typename StorageType<typename T::storage_t>::type_t> >
{
public:
- typedef typename T::storage_t storage_t;
- typedef Measurement<typename T::storage_t> base_measurement_t;
+ typedef typename StorageType<typename T::storage_t>::type_t storage_t;
Measurement(const char* name, const char* description = NULL)
: TraceType(name, description)
@@ -402,18 +428,19 @@ namespace LLTrace
{
T converted_value;
converted_value.assignFrom(value);
- getPrimaryAccumulator().sample(converted_value.value());
+ getPrimaryAccumulator().sample((storage_t)converted_value.value());
}
};
- typedef TraceType<CountAccumulator<F64> > count_common_t;
+ typedef TraceType<CountAccumulator<F64> > count_common_float_t;
+ typedef TraceType<CountAccumulator<S64> > count_common_int_t;
template <typename T = F64, typename IS_UNIT = void>
class LL_COMMON_API Count
- : public TraceType<CountAccumulator<T> >
+ : public TraceType<CountAccumulator<typename StorageType<T>::type_t> >
{
public:
- typedef T storage_t;
+ typedef typename StorageType<T>::type_t storage_t;
Count(const char* name, const char* description = NULL)
: TraceType(name)
@@ -421,17 +448,16 @@ namespace LLTrace
void add(T value)
{
- getPrimaryAccumulator().add(value);
+ getPrimaryAccumulator().add((storage_t)value);
}
};
template <typename T>
class LL_COMMON_API Count <T, typename T::is_unit_tag_t>
- : public TraceType<CountAccumulator<typename T::storage_t> >
+ : public TraceType<CountAccumulator<typename StorageType<typename T::storage_t>::type_t> >
{
public:
- typedef typename T::storage_t storage_t;
- typedef Count<typename T::storage_t> base_count_t;
+ typedef typename StorageType<typename T::storage_t>::type_t storage_t;
Count(const char* name, const char* description = NULL)
: TraceType(name)
@@ -442,7 +468,7 @@ namespace LLTrace
{
T converted_value;
converted_value.assignFrom(value);
- getPrimaryAccumulator().add(converted_value.value());
+ getPrimaryAccumulator().add((storage_t)converted_value.value());
}
};
diff --git a/indra/llcommon/lltracerecording.cpp b/indra/llcommon/lltracerecording.cpp
index 9a769ff344..f44a0a2764 100644
--- a/indra/llcommon/lltracerecording.cpp
+++ b/indra/llcommon/lltracerecording.cpp
@@ -39,8 +39,10 @@ namespace LLTrace
Recording::Recording()
: mElapsedSeconds(0),
- mCounts(new AccumulatorBuffer<CountAccumulator<F64> >()),
- mMeasurements(new AccumulatorBuffer<MeasurementAccumulator<F64> >()),
+ mCountsFloat(new AccumulatorBuffer<CountAccumulator<F64> >()),
+ mMeasurementsFloat(new AccumulatorBuffer<MeasurementAccumulator<F64> >()),
+ mCounts(new AccumulatorBuffer<CountAccumulator<S64> >()),
+ mMeasurements(new AccumulatorBuffer<MeasurementAccumulator<S64> >()),
mStackTimers(new AccumulatorBuffer<TimerAccumulator>())
{}
@@ -59,6 +61,8 @@ void Recording::update()
void Recording::handleReset()
{
+ mCountsFloat.write()->reset();
+ mMeasurementsFloat.write()->reset();
mCounts.write()->reset();
mMeasurements.write()->reset();
mStackTimers.write()->reset();
@@ -88,6 +92,8 @@ void Recording::handleSplitTo(Recording& other)
void Recording::makePrimary()
{
+ mCountsFloat.write()->makePrimary();
+ mMeasurementsFloat.write()->makePrimary();
mCounts.write()->makePrimary();
mMeasurements.write()->makePrimary();
mStackTimers.write()->makePrimary();
@@ -100,14 +106,120 @@ bool Recording::isPrimary() const
void Recording::mergeRecording( const Recording& other )
{
+ mCountsFloat.write()->addSamples(*other.mCountsFloat);
+ mMeasurementsFloat.write()->addSamples(*other.mMeasurementsFloat);
mCounts.write()->addSamples(*other.mCounts);
mMeasurements.write()->addSamples(*other.mMeasurements);
mStackTimers.write()->addSamples(*other.mStackTimers);
mElapsedSeconds += other.mElapsedSeconds;
}
+F64 Recording::getSum( const TraceType<CountAccumulator<F64> >& stat ) const
+{
+ return stat.getAccumulator(mCountsFloat).getSum();
+}
+
+S64 Recording::getSum( const TraceType<CountAccumulator<S64> >& stat ) const
+{
+ return stat.getAccumulator(mCounts).getSum();
+}
+
+F64 Recording::getSum( const TraceType<MeasurementAccumulator<F64> >& stat ) const
+{
+ return (F64)stat.getAccumulator(mMeasurementsFloat).getSum();
+}
+
+S64 Recording::getSum( const TraceType<MeasurementAccumulator<S64> >& stat ) const
+{
+ return (S64)stat.getAccumulator(mMeasurements).getSum();
+}
+
+
+
+F64 Recording::getPerSec( const TraceType<CountAccumulator<F64> >& stat ) const
+{
+ return stat.getAccumulator(mCountsFloat).getSum() / mElapsedSeconds;
+}
+
+F64 Recording::getPerSec( const TraceType<CountAccumulator<S64> >& stat ) const
+{
+ return (F64)stat.getAccumulator(mCounts).getSum() / mElapsedSeconds;
+}
+
+F64 Recording::getPerSec( const TraceType<MeasurementAccumulator<F64> >& stat ) const
+{
+ return stat.getAccumulator(mMeasurementsFloat).getSum() / mElapsedSeconds;
+}
+
+F64 Recording::getPerSec( const TraceType<MeasurementAccumulator<S64> >& stat ) const
+{
+ return (F64)stat.getAccumulator(mMeasurements).getSum() / mElapsedSeconds;
+}
+
+F64 Recording::getMin( const TraceType<MeasurementAccumulator<F64> >& stat ) const
+{
+ return stat.getAccumulator(mMeasurementsFloat).getMin();
+}
+
+S64 Recording::getMin( const TraceType<MeasurementAccumulator<S64> >& stat ) const
+{
+ return stat.getAccumulator(mMeasurements).getMin();
+}
+
+F64 Recording::getMax( const TraceType<MeasurementAccumulator<F64> >& stat ) const
+{
+ return stat.getAccumulator(mMeasurementsFloat).getMax();
+}
+
+S64 Recording::getMax( const TraceType<MeasurementAccumulator<S64> >& stat ) const
+{
+ return stat.getAccumulator(mMeasurements).getMax();
+}
+
+F64 Recording::getMean( const TraceType<MeasurementAccumulator<F64> >& stat ) const
+{
+ return stat.getAccumulator(mMeasurementsFloat).getMean();
+}
+
+F64 Recording::getMean( const TraceType<MeasurementAccumulator<S64> >& stat ) const
+{
+ return stat.getAccumulator(mMeasurements).getMean();
+}
+
+F64 Recording::getStandardDeviation( const TraceType<MeasurementAccumulator<F64> >& stat ) const
+{
+ return stat.getAccumulator(mMeasurementsFloat).getStandardDeviation();
+}
+
+F64 Recording::getStandardDeviation( const TraceType<MeasurementAccumulator<S64> >& stat ) const
+{
+ return stat.getAccumulator(mMeasurements).getStandardDeviation();
+}
+
+F64 Recording::getLastValue( const TraceType<MeasurementAccumulator<F64> >& stat ) const
+{
+ return stat.getAccumulator(mMeasurementsFloat).getLastValue();
+}
+
+S64 Recording::getLastValue( const TraceType<MeasurementAccumulator<S64> >& stat ) const
+{
+ return stat.getAccumulator(mMeasurements).getLastValue();
+}
+
+U32 Recording::getSampleCount( const TraceType<MeasurementAccumulator<F64> >& stat ) const
+{
+ return stat.getAccumulator(mMeasurementsFloat).getSampleCount();
+}
+
+U32 Recording::getSampleCount( const TraceType<MeasurementAccumulator<S64> >& stat ) const
+{
+ return stat.getAccumulator(mMeasurements).getSampleCount();
+}
+
+
+
///////////////////////////////////////////////////////////////////////
-// Recording
+// PeriodicRecording
///////////////////////////////////////////////////////////////////////
PeriodicRecording::PeriodicRecording( S32 num_periods )
@@ -179,6 +291,7 @@ void PeriodicRecording::handleSplitTo( PeriodicRecording& other )
getCurRecordingPeriod().handleSplitTo(other.getCurRecordingPeriod());
}
+
///////////////////////////////////////////////////////////////////////
// ExtendableRecording
///////////////////////////////////////////////////////////////////////
diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h
index d3f001ab6a..4af973515d 100644
--- a/indra/llcommon/lltracerecording.h
+++ b/indra/llcommon/lltracerecording.h
@@ -112,124 +112,81 @@ namespace LLTrace
void update();
// Count accessors
+ F64 getSum(const TraceType<CountAccumulator<F64> >& stat) const;
+ S64 getSum(const TraceType<CountAccumulator<S64> >& stat) const;
template <typename T>
- T getSum(const TraceType<CountAccumulator<T> >& stat) const
+ T getSum(const Count<T, typename T::is_unit_tag_t>& stat) const
{
- return (T)stat.getAccumulator(mCounts).getSum();
- }
-
- template <typename T, typename IS_UNIT>
- T getSum(const Count<T, IS_UNIT>& stat) const
- {
- return (T)stat.getAccumulator(mCounts).getSum();
+ return (T)getSum(static_cast<const TraceType<CountAccumulator<StorageType<T>::type_t> >&> (stat));
}
+ F64 getPerSec(const TraceType<CountAccumulator<F64> >& stat) const;
+ F64 getPerSec(const TraceType<CountAccumulator<S64> >& stat) const;
template <typename T>
- T getPerSec(const TraceType<CountAccumulator<T> >& stat) const
+ T getPerSec(const Count<T, typename T::is_unit_tag_t>& stat) const
{
- return (T)stat.getAccumulator(mCounts).getSum() / mElapsedSeconds;
- }
-
- template <typename T, typename IS_UNIT>
- T getPerSec(const Count<T, IS_UNIT>& stat) const
- {
- return (T)stat.getAccumulator(mCounts).getSum() / mElapsedSeconds;
+ return (T)getPerSec(static_cast<const TraceType<CountAccumulator<StorageType<T>::type_t> >&> (stat));
}
// Measurement accessors
+ F64 getSum(const TraceType<MeasurementAccumulator<F64> >& stat) const;
+ S64 getSum(const TraceType<MeasurementAccumulator<S64> >& stat) const;
template <typename T>
- T getSum(const TraceType<MeasurementAccumulator<T> >& stat) const
+ T getSum(const Measurement<T, typename T::is_unit_tag_t>& stat) const
{
- return (T)stat.getAccumulator(mMeasurements).getSum();
-
- }
-
- template <typename T, typename IS_UNIT>
- T getSum(const Measurement<T, IS_UNIT>& stat) const
- {
- return (T)stat.getAccumulator(mMeasurements).getSum();
-
+ return (T)getSum(static_cast<const TraceType<MeasurementAccumulator<StorageType<T>::type_t> >&> (stat));
}
+ F64 getPerSec(const TraceType<MeasurementAccumulator<F64> >& stat) const;
+ F64 getPerSec(const TraceType<MeasurementAccumulator<S64> >& stat) const;
template <typename T>
- T getPerSec(const TraceType<MeasurementAccumulator<T> >& stat) const
- {
- return (T)stat.getAccumulator(mMeasurements).getSum() / mElapsedSeconds;
- }
-
- template <typename T, typename IS_UNIT>
- T getPerSec(const Measurement<T, IS_UNIT>& stat) const
+ T getPerSec(const Measurement<T, typename T::is_unit_tag_t>& stat) const
{
- return (typename Count<T, IS_UNIT>::base_unit_t)stat.getAccumulator(mMeasurements).getSum() / mElapsedSeconds;
+ return (T)getPerSec(static_cast<const TraceType<MeasurementAccumulator<StorageType<T>::type_t> >&> (stat));
}
+ F64 getMin(const TraceType<MeasurementAccumulator<F64> >& stat) const;
+ S64 getMin(const TraceType<MeasurementAccumulator<S64> >& stat) const;
template <typename T>
- T getMin(const TraceType<MeasurementAccumulator<T> >& stat) const
- {
- return (T)stat.getAccumulator(mMeasurements).getMin();
- }
-
- template <typename T, typename IS_UNIT>
- T getMin(const Measurement<T, IS_UNIT>& stat) const
+ T getMin(const Measurement<T, typename T::is_unit_tag_t>& stat) const
{
- return (T)stat.getAccumulator(mMeasurements).getMin();
+ return (T)getMin(static_cast<const TraceType<MeasurementAccumulator<StorageType<T>::type_t> >&> (stat));
}
-
+ F64 getMax(const TraceType<MeasurementAccumulator<F64> >& stat) const;
+ S64 getMax(const TraceType<MeasurementAccumulator<S64> >& stat) const;
template <typename T>
- T getMax(const TraceType<MeasurementAccumulator<T> >& stat) const
- {
- return (T)stat.getAccumulator(mMeasurements).getMax();
- }
-
- template <typename T, typename IS_UNIT>
- T getMax(const Measurement<T, IS_UNIT>& stat) const
+ T getMax(const Measurement<T, typename T::is_unit_tag_t>& stat) const
{
- return (T)stat.getAccumulator(mMeasurements).getMax();
+ return (T)getMax(static_cast<const TraceType<MeasurementAccumulator<StorageType<T>::type_t> >&> (stat));
}
+ F64 getMean(const TraceType<MeasurementAccumulator<F64> >& stat) const;
+ F64 getMean(const TraceType<MeasurementAccumulator<S64> >& stat) const;
template <typename T>
- T getMean(const TraceType<MeasurementAccumulator<T> >& stat) const
+ T getMean(Measurement<T, typename T::is_unit_tag_t>& stat) const
{
- return (T)stat.getAccumulator(mMeasurements).getMean();
- }
-
- template <typename T, typename IS_UNIT>
- T getMean(Measurement<T, IS_UNIT>& stat) const
- {
- return (T)stat.getAccumulator(mMeasurements).getMean();
+ return (T)getMean(static_cast<const TraceType<MeasurementAccumulator<StorageType<T>::type_t> >&> (stat));
}
+ F64 getStandardDeviation(const TraceType<MeasurementAccumulator<F64> >& stat) const;
+ F64 getStandardDeviation(const TraceType<MeasurementAccumulator<S64> >& stat) const;
template <typename T>
- T getStandardDeviation(const TraceType<MeasurementAccumulator<T> >& stat) const
- {
- return (T)stat.getAccumulator(mMeasurements).getStandardDeviation();
- }
-
- template <typename T, typename IS_UNIT>
- T getStandardDeviation(const Measurement<T, IS_UNIT>& stat) const
+ T getStandardDeviation(const Measurement<T, typename T::is_unit_tag_t>& stat) const
{
- return (T)stat.getAccumulator(mMeasurements).getStandardDeviation();
+ return (T)getMean(static_cast<const TraceType<MeasurementAccumulator<StorageType<T>::type_t> >&> (stat));
}
+ F64 getLastValue(const TraceType<MeasurementAccumulator<F64> >& stat) const;
+ S64 getLastValue(const TraceType<MeasurementAccumulator<S64> >& stat) const;
template <typename T>
- T getLastValue(const TraceType<MeasurementAccumulator<T> >& stat) const
- {
- return (T)stat.getAccumulator(mMeasurements).getLastValue();
- }
-
- template <typename T, typename IS_UNIT>
- T getLastValue(const Measurement<T, IS_UNIT>& stat) const
+ T getLastValue(const Measurement<T, typename T::is_unit_tag_t>& stat) const
{
- return (T)stat.getAccumulator(mMeasurements).getLastValue();
+ return (T)getLastValue(static_cast<const TraceType<MeasurementAccumulator<StorageType<T>::type_t> >&> (stat));
}
-
- template <typename T>
- U32 getSampleCount(const TraceType<MeasurementAccumulator<T> >& stat) const
- {
- return stat.getAccumulator(mMeasurements).getSampleCount();
- }
+ U32 getSampleCount(const TraceType<MeasurementAccumulator<F64> >& stat) const;
+ U32 getSampleCount(const TraceType<MeasurementAccumulator<S64> >& stat) const;
LLUnit::Seconds<F64> getDuration() const { return mElapsedSeconds; }
@@ -244,8 +201,10 @@ namespace LLTrace
// returns data for current thread
class ThreadRecorder* getThreadRecorder();
- LLCopyOnWritePointer<AccumulatorBuffer<CountAccumulator<F64> > > mCounts;
- LLCopyOnWritePointer<AccumulatorBuffer<MeasurementAccumulator<F64> > > mMeasurements;
+ LLCopyOnWritePointer<AccumulatorBuffer<CountAccumulator<F64> > > mCountsFloat;
+ LLCopyOnWritePointer<AccumulatorBuffer<MeasurementAccumulator<F64> > > mMeasurementsFloat;
+ LLCopyOnWritePointer<AccumulatorBuffer<CountAccumulator<S64> > > mCounts;
+ LLCopyOnWritePointer<AccumulatorBuffer<MeasurementAccumulator<S64> > > mMeasurements;
LLCopyOnWritePointer<AccumulatorBuffer<TimerAccumulator> > mStackTimers;
LLTimer mSamplingTimer;
@@ -260,6 +219,7 @@ namespace LLTrace
~PeriodicRecording();
void nextPeriod();
+ S32 getNumPeriods() { return mNumPeriods; }
Recording& getLastRecordingPeriod()
{
@@ -268,7 +228,7 @@ namespace LLTrace
const Recording& getLastRecordingPeriod() const
{
- return mRecordingPeriods[(mCurPeriod + mNumPeriods - 1) % mNumPeriods];
+ return getPrevRecordingPeriod(1);
}
Recording& getCurRecordingPeriod()
@@ -281,6 +241,16 @@ namespace LLTrace
return mRecordingPeriods[mCurPeriod];
}
+ Recording& getPrevRecordingPeriod(S32 offset)
+ {
+ return mRecordingPeriods[(mCurPeriod + mNumPeriods - offset) % mNumPeriods];
+ }
+
+ const Recording& getPrevRecordingPeriod(S32 offset) const
+ {
+ return mRecordingPeriods[(mCurPeriod + mNumPeriods - offset) % mNumPeriods];
+ }
+
Recording snapshotCurRecordingPeriod() const
{
Recording recording_copy(getCurRecordingPeriod());
@@ -290,6 +260,84 @@ namespace LLTrace
Recording& getTotalRecording();
+ template <typename T>
+ typename T getPeriodMin(const TraceType<CountAccumulator<T> >& stat) const
+ {
+ T min_val = std::numeric_limits<T>::max();
+ for (S32 i = 0; i < mNumPeriods; i++)
+ {
+ min_val = llmin(min_val, mRecordingPeriods[i].getSum(stat));
+ }
+ return (T)min_val;
+ }
+
+ template <typename T>
+ F64 getPeriodMinPerSec(const TraceType<CountAccumulator<T> >& stat) const
+ {
+ F64 min_val = std::numeric_limits<F64>::max();
+ for (S32 i = 0; i < mNumPeriods; i++)
+ {
+ min_val = llmin(min_val, mRecordingPeriods[i].getPerSec(stat));
+ }
+ return min_val;
+ }
+
+ template <typename T>
+ T getPeriodMax(const TraceType<CountAccumulator<T> >& stat) const
+ {
+ T max_val = std::numeric_limits<T>::min();
+ for (S32 i = 0; i < mNumPeriods; i++)
+ {
+ max_val = llmax(max_val, mRecordingPeriods[i].getSum(stat));
+ }
+ return max_val;
+ }
+
+ template <typename T>
+ F64 getPeriodMaxPerSec(const TraceType<CountAccumulator<T> >& stat) const
+ {
+ F64 max_val = std::numeric_limits<F64>::min();
+ for (S32 i = 0; i < mNumPeriods; i++)
+ {
+ max_val = llmax(max_val, mRecordingPeriods[i].getPerSec(stat));
+ }
+ return max_val;
+ }
+
+ template <typename T>
+ F64 getPeriodMean(const TraceType<CountAccumulator<T> >& stat) const
+ {
+ F64 mean = 0.0;
+ F64 count = 0;
+ for (S32 i = 0; i < mNumPeriods; i++)
+ {
+ if (mRecordingPeriods[i].getDuration() > 0.f)
+ {
+ count++;
+ mean += mRecordingPeriods[i].getSum(stat);
+ }
+ }
+ mean /= (F64)mNumPeriods;
+ return mean;
+ }
+
+ template <typename T>
+ F64 getPeriodMeanPerSec(const TraceType<CountAccumulator<T> >& stat) const
+ {
+ F64 mean = 0.0;
+ F64 count = 0;
+ for (S32 i = 0; i < mNumPeriods; i++)
+ {
+ if (mRecordingPeriods[i].getDuration() > 0.f)
+ {
+ count++;
+ mean += mRecordingPeriods[i].getPerSec(stat);
+ }
+ }
+ mean /= count;
+ return mean;
+ }
+
private:
// implementation for LLVCRControlsMixin
diff --git a/indra/llcommon/lltracethreadrecorder.cpp b/indra/llcommon/lltracethreadrecorder.cpp
index e81333f7f2..15056b80e4 100644
--- a/indra/llcommon/lltracethreadrecorder.cpp
+++ b/indra/llcommon/lltracethreadrecorder.cpp
@@ -113,9 +113,13 @@ ThreadRecorder::ActiveRecording::ActiveRecording( Recording* target )
void ThreadRecorder::ActiveRecording::moveBaselineToTarget()
{
+ mTargetRecording->mMeasurementsFloat.write()->addSamples(*mBaseline.mMeasurementsFloat);
+ mTargetRecording->mCountsFloat.write()->addSamples(*mBaseline.mCountsFloat);
mTargetRecording->mMeasurements.write()->addSamples(*mBaseline.mMeasurements);
mTargetRecording->mCounts.write()->addSamples(*mBaseline.mCounts);
mTargetRecording->mStackTimers.write()->addSamples(*mBaseline.mStackTimers);
+ mBaseline.mMeasurementsFloat.write()->reset();
+ mBaseline.mCountsFloat.write()->reset();
mBaseline.mMeasurements.write()->reset();
mBaseline.mCounts.write()->reset();
mBaseline.mStackTimers.write()->reset();
diff --git a/indra/llui/llstatbar.cpp b/indra/llui/llstatbar.cpp
index 535c6f96e3..6b40f8d475 100644
--- a/indra/llui/llstatbar.cpp
+++ b/indra/llui/llstatbar.cpp
@@ -34,7 +34,6 @@
#include "llgl.h"
#include "llfontgl.h"
-#include "llstat.h"
#include "lluictrlfactory.h"
#include "lltracerecording.h"
@@ -46,8 +45,10 @@ LLStatBar::LLStatBar(const Params& p)
mUnitLabel(p.unit_label),
mMinBar(p.bar_min),
mMaxBar(p.bar_max),
- mStatp(LLStat::getInstance(p.stat)),
- mNewStatp(LLTrace::Count<>::getInstance(p.stat)),
+ mCountFloatp(LLTrace::Count<>::getInstance(p.stat)),
+ mCountIntp(LLTrace::Count<S64>::getInstance(p.stat)),
+ mMeasurementFloatp(LLTrace::Measurement<>::getInstance(p.stat)),
+ mMeasurementIntp(LLTrace::Measurement<S64>::getInstance(p.stat)),
mTickSpacing(p.tick_spacing),
mLabelSpacing(p.label_spacing),
mPrecision(p.precision),
@@ -90,46 +91,62 @@ void LLStatBar::draw()
max = 0.f,
mean = 0.f;
- if (mStatp)
+ LLTrace::PeriodicRecording& frame_recording = LLTrace::get_frame_recording();
+
+ if (mCountFloatp)
{
- // Get the values.
+ LLTrace::Recording& last_frame_recording = frame_recording.getLastRecordingPeriod();
+
if (mPerSec)
{
- current = mStatp->getCurrentPerSec();
- min = mStatp->getMinPerSec();
- max = mStatp->getMaxPerSec();
- mean = mStatp->getMeanPerSec();
+ current = last_frame_recording.getPerSec(*mCountFloatp);
+ min = frame_recording.getPeriodMinPerSec(*mCountFloatp);
+ max = frame_recording.getPeriodMaxPerSec(*mCountFloatp);
+ mean = frame_recording.getPeriodMeanPerSec(*mCountFloatp);
}
else
{
- current = mStatp->getCurrent();
- min = mStatp->getMin();
- max = mStatp->getMax();
- mean = mStatp->getMean();
+ current = last_frame_recording.getSum(*mCountFloatp);
+ min = frame_recording.getPeriodMin(*mCountFloatp);
+ max = frame_recording.getPeriodMax(*mCountFloatp);
+ mean = frame_recording.getPeriodMean(*mCountFloatp);
}
}
- else if (mNewStatp)
+ else if (mCountIntp)
{
- LLTrace::PeriodicRecording& frame_recording = LLTrace::get_frame_recording();
LLTrace::Recording& last_frame_recording = frame_recording.getLastRecordingPeriod();
- LLTrace::Recording& windowed_frame_recording = frame_recording.getTotalRecording();
if (mPerSec)
{
- current = last_frame_recording.getPerSec(*mNewStatp);
- //min = frame_window_recording.getMin(*mNewStatp) / frame_window_recording.getDuration();
- //max = frame_window_recording.getMax(*mNewStatp) / frame_window_recording.getDuration();
- mean = windowed_frame_recording.getPerSec(*mNewStatp);//frame_window_recording.getMean(*mNewStatp) / frame_window_recording.getDuration();
+ current = last_frame_recording.getPerSec(*mCountIntp);
+ min = frame_recording.getPeriodMinPerSec(*mCountIntp);
+ max = frame_recording.getPeriodMaxPerSec(*mCountIntp);
+ mean = frame_recording.getPeriodMeanPerSec(*mCountIntp);
}
else
{
- current = last_frame_recording.getSum(*mNewStatp);
- //min = last_frame_recording.getMin(*mNewStatp);
- //max = last_frame_recording.getMax(*mNewStatp);
- mean = windowed_frame_recording.getSum(*mNewStatp);
+ current = last_frame_recording.getSum(*mCountIntp);
+ min = frame_recording.getPeriodMin(*mCountIntp);
+ max = frame_recording.getPeriodMax(*mCountIntp);
+ mean = frame_recording.getPeriodMean(*mCountIntp);
}
}
-
+ else if (mMeasurementFloatp)
+ {
+ LLTrace::Recording& recording = frame_recording.getTotalRecording();
+ current = recording.getLastValue(*mMeasurementFloatp);
+ min = recording.getMin(*mMeasurementFloatp);
+ max = recording.getMax(*mMeasurementFloatp);
+ mean = recording.getMean(*mMeasurementFloatp);
+ }
+ else if (mMeasurementIntp)
+ {
+ LLTrace::Recording& recording = frame_recording.getTotalRecording();
+ current = recording.getLastValue(*mMeasurementIntp);
+ min = recording.getMin(*mMeasurementIntp);
+ max = recording.getMax(*mMeasurementIntp);
+ mean = recording.getMean(*mMeasurementIntp);
+ }
if ((mUpdatesPerSec == 0.f) || (mUpdateTimer.getElapsedTimeF32() > 1.f/mUpdatesPerSec) || (mValue == 0.f))
{
@@ -176,7 +193,7 @@ void LLStatBar::draw()
LLFontGL::RIGHT, LLFontGL::TOP);
value_format = llformat( "%%.%df", mPrecision);
- if (mDisplayBar && mStatp)
+ if (mDisplayBar && (mCountFloatp || mCountIntp || mMeasurementFloatp || mMeasurementIntp))
{
std::string tick_label;
@@ -219,7 +236,7 @@ void LLStatBar::draw()
right = width;
gl_rect_2d(left, top, right, bottom, LLColor4(0.f, 0.f, 0.f, 0.25f));
- if (mStatp->getNumValues() == 0)
+ if (frame_recording.getNumPeriods() == 0)
{
// No data, don't draw anything...
return;
@@ -236,26 +253,58 @@ void LLStatBar::draw()
right = (S32) ((max - mMinBar) * value_scale);
gl_rect_2d(left, top, right, bottom, LLColor4(1.f, 0.f, 0.f, 0.25f));
- if (mDisplayHistory)
+ if (mDisplayHistory && (mCountFloatp || mCountIntp || mMeasurementFloatp || mMeasurementIntp))
{
- S32 num_values = mStatp->getNumValues() - 1;
+ S32 num_values = frame_recording.getNumPeriods() - 1;
S32 i;
- for (i = 0; i < num_values; i++)
+ for (i = 1; i <= num_values; i++)
{
- if (i == mStatp->getNextBin())
- {
- continue;
- }
if (mPerSec)
{
- left = (S32)((mStatp->getPrevPerSec(i) - mMinBar) * value_scale);
- right = (S32)((mStatp->getPrevPerSec(i) - mMinBar) * value_scale) + 1;
+ if (mCountFloatp)
+ {
+ left = (S32)((frame_recording.getPrevRecordingPeriod(i).getPerSec(*mCountFloatp) - mMinBar) * value_scale);
+ right = (S32)((frame_recording.getPrevRecordingPeriod(i).getPerSec(*mCountFloatp) - mMinBar) * value_scale) + 1;
+ }
+ else if (mCountIntp)
+ {
+ left = (S32)((frame_recording.getPrevRecordingPeriod(i).getPerSec(*mCountIntp) - mMinBar) * value_scale);
+ right = (S32)((frame_recording.getPrevRecordingPeriod(i).getPerSec(*mCountIntp) - mMinBar) * value_scale) + 1;
+ }
+ else if (mMeasurementFloatp)
+ {
+ left = (S32)((frame_recording.getPrevRecordingPeriod(i).getPerSec(*mMeasurementFloatp) - mMinBar) * value_scale);
+ right = (S32)((frame_recording.getPrevRecordingPeriod(i).getPerSec(*mMeasurementFloatp) - mMinBar) * value_scale) + 1;
+ }
+ else if (mMeasurementIntp)
+ {
+ left = (S32)((frame_recording.getPrevRecordingPeriod(i).getPerSec(*mMeasurementIntp) - mMinBar) * value_scale);
+ right = (S32)((frame_recording.getPrevRecordingPeriod(i).getPerSec(*mMeasurementIntp) - mMinBar) * value_scale) + 1;
+ }
gl_rect_2d(left, bottom+i+1, right, bottom+i, LLColor4(1.f, 0.f, 0.f, 1.f));
}
else
{
- left = (S32)((mStatp->getPrev(i) - mMinBar) * value_scale);
- right = (S32)((mStatp->getPrev(i) - mMinBar) * value_scale) + 1;
+ if (mCountFloatp)
+ {
+ left = (S32)((frame_recording.getPrevRecordingPeriod(i).getSum(*mCountFloatp) - mMinBar) * value_scale);
+ right = (S32)((frame_recording.getPrevRecordingPeriod(i).getSum(*mCountFloatp) - mMinBar) * value_scale) + 1;
+ }
+ else if (mCountIntp)
+ {
+ left = (S32)((frame_recording.getPrevRecordingPeriod(i).getSum(*mCountIntp) - mMinBar) * value_scale);
+ right = (S32)((frame_recording.getPrevRecordingPeriod(i).getSum(*mCountIntp) - mMinBar) * value_scale) + 1;
+ }
+ else if (mMeasurementFloatp)
+ {
+ left = (S32)((frame_recording.getPrevRecordingPeriod(i).getSum(*mMeasurementFloatp) - mMinBar) * value_scale);
+ right = (S32)((frame_recording.getPrevRecordingPeriod(i).getSum(*mMeasurementFloatp) - mMinBar) * value_scale) + 1;
+ }
+ else if (mMeasurementIntp)
+ {
+ left = (S32)((frame_recording.getPrevRecordingPeriod(i).getSum(*mMeasurementIntp) - mMinBar) * value_scale);
+ right = (S32)((frame_recording.getPrevRecordingPeriod(i).getSum(*mMeasurementIntp) - mMinBar) * value_scale) + 1;
+ }
gl_rect_2d(left, bottom+i+1, right, bottom+i, LLColor4(1.f, 0.f, 0.f, 1.f));
}
}
@@ -279,6 +328,15 @@ void LLStatBar::draw()
LLView::draw();
}
+void LLStatBar::setStat(const std::string& stat_name)
+{
+ mCountFloatp = LLTrace::Count<>::getInstance(stat_name);
+ mCountIntp = LLTrace::Count<S64>::getInstance(stat_name);
+ mMeasurementFloatp = LLTrace::Measurement<>::getInstance(stat_name);
+ mMeasurementIntp = LLTrace::Measurement<S64>::getInstance(stat_name);
+}
+
+
void LLStatBar::setRange(F32 bar_min, F32 bar_max, F32 tick_spacing, F32 label_spacing)
{
mMinBar = bar_min;
@@ -293,9 +351,9 @@ LLRect LLStatBar::getRequiredRect()
if (mDisplayBar)
{
- if (mDisplayHistory && mStatp)
+ if (mDisplayHistory)
{
- rect.mTop = 35 + mStatp->getNumBins();
+ rect.mTop = 35 + LLTrace::get_frame_recording().getNumPeriods();
}
else
{
diff --git a/indra/llui/llstatbar.h b/indra/llui/llstatbar.h
index d510f0e3fe..6aefb1e213 100644
--- a/indra/llui/llstatbar.h
+++ b/indra/llui/llstatbar.h
@@ -30,7 +30,6 @@
#include "llview.h"
#include "llframetimer.h"
#include "lltracerecording.h"
-class LLStat;
class LLStatBar : public LLView
{
@@ -79,7 +78,8 @@ public:
virtual void draw();
virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask);
- void setStat(LLStat* stat) { mStatp = stat; }
+ void setStat(const std::string& stat_name);
+
void setRange(F32 bar_min, F32 bar_max, F32 tick_spacing, F32 label_spacing);
void getRange(F32& bar_min, F32& bar_max) { bar_min = mMinBar; bar_max = mMaxBar; }
@@ -96,10 +96,11 @@ private:
BOOL mDisplayBar; // Display the bar graph.
BOOL mDisplayHistory;
BOOL mDisplayMean; // If true, display mean, if false, display current value
- LLTrace::PeriodicRecording* mFrameRecording;
- LLStat* mStatp;
- LLTrace::count_common_t* mNewStatp;
+ LLTrace::count_common_float_t* mCountFloatp;
+ LLTrace::count_common_int_t* mCountIntp;
+ LLTrace::measurement_common_float_t* mMeasurementFloatp;
+ LLTrace::measurement_common_int_t* mMeasurementIntp;
LLFrameTimer mUpdateTimer;
LLUIString mLabel;
diff --git a/indra/llui/llstatgraph.cpp b/indra/llui/llstatgraph.cpp
index e961e7d3c0..22c276a018 100644
--- a/indra/llui/llstatgraph.cpp
+++ b/indra/llui/llstatgraph.cpp
@@ -32,7 +32,6 @@
#include "llmath.h"
#include "llui.h"
-#include "llstat.h"
#include "llgl.h"
#include "llglheaders.h"
#include "lltracerecording.h"
@@ -48,8 +47,8 @@ LLStatGraph::LLStatGraph(const Params& p)
mPerSec(true),
mPrecision(p.precision),
mValue(p.value),
- mStatp(p.stat.legacy_stat),
- mNewStatp(p.stat.count_stat)
+ mNewStatFloatp(p.stat.count_stat_float),
+ mNewStatIntp(p.stat.count_stat_int)
{
setToolTip(p.name());
@@ -73,30 +72,31 @@ void LLStatGraph::draw()
{
F32 range, frac;
range = mMax - mMin;
- if (mStatp)
+ if (mNewStatFloatp)
{
+ LLTrace::Recording& recording = LLTrace::get_frame_recording().getLastRecordingPeriod();
+
if (mPerSec)
{
- mValue = mStatp->getMeanPerSec();
+ mValue = recording.getPerSec(*mNewStatFloatp);
}
else
{
- mValue = mStatp->getMean();
+ mValue = recording.getSum(*mNewStatFloatp);
}
}
- else if (mNewStatp)
+ else if (mNewStatIntp)
{
LLTrace::Recording& recording = LLTrace::get_frame_recording().getLastRecordingPeriod();
if (mPerSec)
{
- mValue = recording.getPerSec(*mNewStatp);
+ mValue = recording.getPerSec(*mNewStatIntp);
}
else
{
- mValue = recording.getSum(*mNewStatp);
+ mValue = recording.getSum(*mNewStatIntp);
}
-
}
frac = (mValue - mMin) / range;
diff --git a/indra/llui/llstatgraph.h b/indra/llui/llstatgraph.h
index b20966d608..f33c784262 100644
--- a/indra/llui/llstatgraph.h
+++ b/indra/llui/llstatgraph.h
@@ -32,8 +32,6 @@
#include "v4color.h"
#include "lltrace.h"
-class LLStat;
-
class LLStatGraph : public LLView
{
public:
@@ -59,9 +57,10 @@ public:
struct StatParams : public LLInitParam::ChoiceBlock<StatParams>
{
- Alternative<LLStat*> legacy_stat;
- Alternative<LLTrace::count_common_t* > count_stat;
- Alternative<LLTrace::measurement_common_t* > measurement_stat;
+ Alternative<LLTrace::count_common_float_t* > count_stat_float;
+ Alternative<LLTrace::count_common_int_t* > count_stat_int;
+ Alternative<LLTrace::measurement_common_float_t* > measurement_stat_float;
+ Alternative<LLTrace::measurement_common_int_t* > measurement_stat_int;
};
struct Params : public LLInitParam::Block<Params, LLView::Params>
@@ -106,8 +105,8 @@ public:
/*virtual*/ void setValue(const LLSD& value);
private:
- LLStat* mStatp;
- LLTrace::count_common_t* mNewStatp;
+ LLTrace::count_common_float_t* mNewStatFloatp;
+ LLTrace::count_common_int_t* mNewStatIntp;
BOOL mPerSec;
diff --git a/indra/llvfs/llvfile.cpp b/indra/llvfs/llvfile.cpp
index ca749c5eaf..7f631ef0bb 100644
--- a/indra/llvfs/llvfile.cpp
+++ b/indra/llvfs/llvfile.cpp
@@ -30,8 +30,8 @@
#include "llerror.h"
#include "llthread.h"
-#include "llstat.h"
#include "llvfs.h"
+#include "lltimer.h"
const S32 LLVFile::READ = 0x00000001;
const S32 LLVFile::WRITE = 0x00000002;
diff --git a/indra/lscript/lscript_execute/lscript_execute.cpp b/indra/lscript/lscript_execute/lscript_execute.cpp
index d79e9f8bde..23e1fe306e 100644
--- a/indra/lscript/lscript_execute/lscript_execute.cpp
+++ b/indra/lscript/lscript_execute/lscript_execute.cpp
@@ -35,7 +35,6 @@
#include "lscript_library.h"
#include "lscript_heapruntime.h"
#include "lscript_alloc.h"
-#include "llstat.h"
// Static
diff --git a/indra/newview/llagentcamera.cpp b/indra/newview/llagentcamera.cpp
index 751b73e1eb..8d80e3aa0a 100644
--- a/indra/newview/llagentcamera.cpp
+++ b/indra/newview/llagentcamera.cpp
@@ -1081,8 +1081,8 @@ void LLAgentCamera::updateLookAt(const S32 mouse_x, const S32 mouse_y)
LLQuaternion av_inv_rot = ~gAgentAvatarp->mRoot.getWorldRotation();
LLVector3 root_at = LLVector3::x_axis * gAgentAvatarp->mRoot.getWorldRotation();
- if ((gViewerWindow->getMouseVelocityStat()->getCurrent() < 0.01f) &&
- (root_at * last_at_axis > 0.95f))
+ if (LLTrace::get_frame_recording().getLastRecordingPeriod().getLastValue(*gViewerWindow->getMouseVelocityStat()) < 0.01f
+ && (root_at * last_at_axis > 0.95f))
{
LLVector3 vel = gAgentAvatarp->getVelocity();
if (vel.magVecSquared() > 4.f)
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index 559f427de6..2d090f0f74 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -4305,6 +4305,9 @@ void LLAppViewer::idle()
update_statistics();
}
+ LLTrace::get_frame_recording().nextPeriod();
+
+
////////////////////////////////////////
//
// Handle the regular UI idle callbacks as well as
diff --git a/indra/newview/llfasttimerview.cpp b/indra/newview/llfasttimerview.cpp
index 4dfb93f1bc..065b20ba2b 100644
--- a/indra/newview/llfasttimerview.cpp
+++ b/indra/newview/llfasttimerview.cpp
@@ -46,7 +46,6 @@
#include "llviewertexturelist.h"
#include "llui.h"
#include "llviewercontrol.h"
-#include "llstat.h"
#include "llfasttimer.h"
#include "lltreeiterators.h"
diff --git a/indra/newview/llfloaterjoystick.cpp b/indra/newview/llfloaterjoystick.cpp
index f7b2670b8e..e2813a8272 100644
--- a/indra/newview/llfloaterjoystick.cpp
+++ b/indra/newview/llfloaterjoystick.cpp
@@ -33,7 +33,7 @@
#include "llerror.h"
#include "llrect.h"
#include "llstring.h"
-#include "llstat.h"
+#include "lltrace.h"
// project includes
#include "lluictrlfactory.h"
@@ -42,6 +42,16 @@
#include "llviewerjoystick.h"
#include "llcheckboxctrl.h"
+static LLTrace::Measurement<> sJoystickAxes[6] =
+{
+ LLTrace::Measurement<>("Joystick axis 1"),
+ LLTrace::Measurement<>("Joystick axis 2"),
+ LLTrace::Measurement<>("Joystick axis 3"),
+ LLTrace::Measurement<>("Joystick axis 4"),
+ LLTrace::Measurement<>("Joystick axis 5"),
+ LLTrace::Measurement<>("Joystick axis 6")
+};
+
LLFloaterJoystick::LLFloaterJoystick(const LLSD& data)
: LLFloater(data)
{
@@ -61,7 +71,7 @@ void LLFloaterJoystick::draw()
for (U32 i = 0; i < 6; i++)
{
F32 value = joystick->getJoystickAxis(i);
- mAxisStats[i]->addValue(value * gFrameIntervalSeconds.value());
+ sJoystickAxes[i].sample(value * gFrameIntervalSeconds.value());
if (mAxisStatsBar[i])
{
F32 minbar, maxbar;
@@ -85,12 +95,11 @@ BOOL LLFloaterJoystick::postBuild()
for (U32 i = 0; i < 6; i++)
{
std::string stat_name(llformat("Joystick axis %d", i));
- mAxisStats[i] = new LLStat(stat_name, 4);
std::string axisname = llformat("axis%d", i);
mAxisStatsBar[i] = getChild<LLStatBar>(axisname);
if (mAxisStatsBar[i])
{
- mAxisStatsBar[i]->setStat(mAxisStats[i]);
+ mAxisStatsBar[i]->setStat(stat_name);
mAxisStatsBar[i]->setRange(-range, range, range * 0.25f, range * 0.5f);
}
}
diff --git a/indra/newview/llfloaterjoystick.h b/indra/newview/llfloaterjoystick.h
index dfdb108ff8..9c3752540d 100644
--- a/indra/newview/llfloaterjoystick.h
+++ b/indra/newview/llfloaterjoystick.h
@@ -84,7 +84,6 @@ private:
LLCheckBoxCtrl *mCheckFlycamEnabled;
// stats view
- LLStat* mAxisStats[6];
LLStatBar* mAxisStatsBar[6];
};
diff --git a/indra/newview/llhudnametag.cpp b/indra/newview/llhudnametag.cpp
index 482294c8a6..56fbdb429a 100644
--- a/indra/newview/llhudnametag.cpp
+++ b/indra/newview/llhudnametag.cpp
@@ -30,6 +30,7 @@
#include "llhudnametag.h"
#include "llrender.h"
+#include "lltracerecording.h"
#include "llagent.h"
#include "llviewercontrol.h"
@@ -899,8 +900,8 @@ void LLHUDNameTag::updateAll()
// }
}
- LLStat* camera_vel_stat = LLViewerCamera::getInstance()->getVelocityStat();
- F32 camera_vel = camera_vel_stat->getCurrent();
+ LLTrace::Count<>* camera_vel_stat = LLViewerCamera::getVelocityStat();
+ F32 camera_vel = LLTrace::get_frame_recording().getLastRecordingPeriod().getPerSec(*camera_vel_stat);
if (camera_vel > MAX_STABLE_CAMERA_VELOCITY)
{
return;
diff --git a/indra/newview/llstatusbar.cpp b/indra/newview/llstatusbar.cpp
index 5720395d05..b945ec2318 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.count_stat(&LLStatViewer::KBIT);
+ sgp.stat.count_stat_float(&LLStatViewer::KBIT);
sgp.units("Kbps");
sgp.precision(0);
mSGBandwidth = LLUICtrlFactory::create<LLStatGraph>(sgp);
@@ -212,7 +212,7 @@ BOOL LLStatusBar::postBuild()
pgp.rect(r);
pgp.follows.flags(FOLLOWS_BOTTOM | FOLLOWS_RIGHT);
pgp.mouse_opaque(false);
- pgp.stat.measurement_stat(&LLStatViewer::PACKETS_LOST_PERCENT);
+ pgp.stat.measurement_stat_float(&LLStatViewer::PACKETS_LOST_PERCENT);
pgp.units("%");
pgp.min(0.f);
pgp.max(5.f);
diff --git a/indra/newview/llsurface.h b/indra/newview/llsurface.h
index 9d24bf8771..33a64ae7d5 100644
--- a/indra/newview/llsurface.h
+++ b/indra/newview/llsurface.h
@@ -45,7 +45,6 @@
class LLTimer;
class LLUUID;
class LLAgent;
-class LLStat;
static const U8 NO_EDGE = 0x00;
static const U8 EAST_EDGE = 0x01;
diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp
index 2a72e77672..fa0e3acf5e 100644
--- a/indra/newview/lltexturefetch.cpp
+++ b/indra/newview/lltexturefetch.cpp
@@ -59,8 +59,8 @@
#include "llviewerstats.h"
bool LLTextureFetchDebugger::sDebuggerEnabled = false ;
-LLStat LLTextureFetch::sCacheHitRate("texture_cache_hits", 128);
-LLStat LLTextureFetch::sCacheReadLatency("texture_cache_read_latency", 128);
+LLTrace::Measurement<> LLTextureFetch::sCacheHitRate("texture_cache_hits");
+LLTrace::Measurement<> LLTextureFetch::sCacheReadLatency("texture_cache_read_latency");
//////////////////////////////////////////////////////////////////////////////
class LLTextureFetchWorker : public LLWorkerClass
@@ -895,7 +895,7 @@ bool LLTextureFetchWorker::doWork(S32 param)
LL_DEBUGS("Texture") << mID << ": Cached. Bytes: " << mFormattedImage->getDataSize()
<< " Size: " << llformat("%dx%d",mFormattedImage->getWidth(),mFormattedImage->getHeight())
<< " Desired Discard: " << mDesiredDiscard << " Desired Size: " << mDesiredSize << LL_ENDL;
- LLTextureFetch::sCacheHitRate.addValue(100.f);
+ LLTextureFetch::sCacheHitRate.sample(100.f);
}
else
{
@@ -912,7 +912,7 @@ bool LLTextureFetchWorker::doWork(S32 param)
}
// fall through
- LLTextureFetch::sCacheHitRate.addValue(0.f);
+ LLTextureFetch::sCacheHitRate.sample(0.f);
}
}
@@ -2039,7 +2039,7 @@ bool LLTextureFetch::getRequestFinished(const LLUUID& id, S32& discard_level,
F32 cache_read_time = worker->mCacheReadTime;
if (cache_read_time != 0.f)
{
- sCacheReadLatency.addValue(cache_read_time * 1000.f);
+ sCacheReadLatency.sample(cache_read_time * 1000.f);
}
res = true;
LL_DEBUGS("Texture") << id << ": Request Finished. State: " << worker->mState << " Discard: " << discard_level << LL_ENDL;
diff --git a/indra/newview/lltexturefetch.h b/indra/newview/lltexturefetch.h
index 7ffa58660e..4ec67c8cdb 100644
--- a/indra/newview/lltexturefetch.h
+++ b/indra/newview/lltexturefetch.h
@@ -35,8 +35,7 @@
#include "lltextureinfo.h"
#include "llapr.h"
#include "llimageworker.h"
-#include "llstat.h"
-//#include "lltexturecache.h"
+#include "lltrace.h"
class LLViewerTexture;
class LLTextureFetchWorker;
@@ -166,8 +165,8 @@ private:
LLMutex mQueueMutex; //to protect mRequestMap and mCommands only
LLMutex mNetworkQueueMutex; //to protect mNetworkQueue, mHTTPTextureQueue and mCancelQueue.
- static LLStat sCacheHitRate;
- static LLStat sCacheReadLatency;
+ static LLTrace::Measurement<> sCacheHitRate;
+ static LLTrace::Measurement<> sCacheReadLatency;
LLTextureCache* mTextureCache;
LLImageDecodeThread* mImageDecodeThread;
diff --git a/indra/newview/llviewercamera.cpp b/indra/newview/llviewercamera.cpp
index a437a8b3b5..831304f428 100644
--- a/indra/newview/llviewercamera.cpp
+++ b/indra/newview/llviewercamera.cpp
@@ -49,10 +49,14 @@
#include "llglheaders.h"
#include "llquaternion.h"
#include "llwindow.h" // getPixelAspectRatio()
+#include "lltracerecording.h"
// System includes
#include <iomanip> // for setprecision
+LLTrace::Count<> LLViewerCamera::sVelocityStat("camera_velocity");
+LLTrace::Count<> LLViewerCamera::sAngularVelocityStat("camera_angular_velocity");
+
U32 LLViewerCamera::sCurCameraID = LLViewerCamera::CAMERA_WORLD;
//glu pick matrix implementation borrowed from Mesa3D
@@ -163,11 +167,12 @@ void LLViewerCamera::updateCameraLocation(const LLVector3 &center,
F32 drot;
rotation.getAngleAxis(&drot, &x, &y, &z);
- mVelocityStat.addValue(dpos);
- mAngularVelocityStat.addValue(drot);
+ sVelocityStat.add(dpos);
+ sAngularVelocityStat.add(drot);
- mAverageSpeed = mVelocityStat.getMeanPerSec() ;
- mAverageAngularSpeed = mAngularVelocityStat.getMeanPerSec() ;
+ LLTrace::Recording& recording = LLTrace::get_frame_recording().getTotalRecording();
+ mAverageSpeed = LLTrace::get_frame_recording().getPeriodMeanPerSec(sVelocityStat);
+ mAverageAngularSpeed = LLTrace::get_frame_recording().getPeriodMeanPerSec(sAngularVelocityStat);
mCosHalfCameraFOV = cosf(0.5f * getView() * llmax(1.0f, getAspect()));
// update pixel meter ratio using default fov, not modified one
diff --git a/indra/newview/llviewercamera.h b/indra/newview/llviewercamera.h
index b857c7fe89..399eed7695 100644
--- a/indra/newview/llviewercamera.h
+++ b/indra/newview/llviewercamera.h
@@ -29,10 +29,10 @@
#include "llcamera.h"
#include "llsingleton.h"
-#include "llstat.h"
#include "lltimer.h"
#include "m4math.h"
#include "llcoord.h"
+#include "lltrace.h"
class LLViewerObject;
@@ -100,12 +100,12 @@ public:
BOOL projectPosAgentToScreen(const LLVector3 &pos_agent, LLCoordGL &out_point, const BOOL clamp = TRUE) const;
BOOL projectPosAgentToScreenEdge(const LLVector3 &pos_agent, LLCoordGL &out_point) const;
- const LLVector3* getVelocityDir() const {return &mVelocityDir;}
- LLStat *getVelocityStat() { return &mVelocityStat; }
- LLStat *getAngularVelocityStat() { return &mAngularVelocityStat; }
- F32 getCosHalfFov() {return mCosHalfCameraFOV;}
- F32 getAverageSpeed() {return mAverageSpeed ;}
- F32 getAverageAngularSpeed() {return mAverageAngularSpeed;}
+ const LLVector3* getVelocityDir() const {return &mVelocityDir;}
+ static LLTrace::Count<>* getVelocityStat() {return &sVelocityStat; }
+ static LLTrace::Count<>* getAngularVelocityStat() {return &sAngularVelocityStat; }
+ F32 getCosHalfFov() {return mCosHalfCameraFOV;}
+ F32 getAverageSpeed() {return mAverageSpeed ;}
+ F32 getAverageAngularSpeed() {return mAverageAngularSpeed;}
void getPixelVectors(const LLVector3 &pos_agent, LLVector3 &up, LLVector3 &right);
LLVector3 roundToPixel(const LLVector3 &pos_agent);
@@ -117,9 +117,9 @@ public:
F32 getDefaultFOV() { return mCameraFOVDefault; }
BOOL cameraUnderWater() const;
-
- const LLVector3 &getPointOfInterest() { return mLastPointOfInterest; }
BOOL areVertsVisible(LLViewerObject* volumep, BOOL all_verts);
+
+ const LLVector3 &getPointOfInterest() { return mLastPointOfInterest; }
F32 getPixelMeterRatio() const { return mPixelMeterRatio; }
S32 getScreenPixelArea() const { return mScreenPixelArea; }
@@ -130,12 +130,12 @@ public:
protected:
void calcProjection(const F32 far_distance) const;
- LLStat mVelocityStat;
- LLStat mAngularVelocityStat;
- LLVector3 mVelocityDir ;
- F32 mAverageSpeed ;
- F32 mAverageAngularSpeed ;
+ static LLTrace::Count<> sVelocityStat;
+ static LLTrace::Count<> sAngularVelocityStat;
+ LLVector3 mVelocityDir ;
+ F32 mAverageSpeed ;
+ F32 mAverageAngularSpeed ;
mutable LLMatrix4 mProjectionMatrix; // Cache of perspective matrix
mutable LLMatrix4 mModelviewMatrix;
F32 mCameraFOVDefault;
diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp
index 169b45c14e..41a08398bb 100644
--- a/indra/newview/llviewerdisplay.cpp
+++ b/indra/newview/llviewerdisplay.cpp
@@ -748,8 +748,10 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)
{
LLFastTimer t(FTM_IMAGE_UPDATE_CLASS);
- LLViewerTexture::updateClass(LLViewerCamera::getInstance()->getVelocityStat()->getMean(),
- LLViewerCamera::getInstance()->getAngularVelocityStat()->getMean());
+ LLTrace::Count<>* velocity_stat = LLViewerCamera::getVelocityStat();
+ LLTrace::Count<>* angular_velocity_stat = LLViewerCamera::getAngularVelocityStat();
+ LLViewerTexture::updateClass(LLTrace::get_frame_recording().getPeriodMeanPerSec(*velocity_stat),
+ LLTrace::get_frame_recording().getPeriodMeanPerSec(*angular_velocity_stat));
}
diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp
index 82caa05983..acbe836c29 100755
--- a/indra/newview/llviewermessage.cpp
+++ b/indra/newview/llviewermessage.cpp
@@ -4765,28 +4765,6 @@ void process_sim_stats(LLMessageSystem *msg, void **user_data)
}
}
- /*
- msg->getF32Fast(_PREHASH_Statistics, _PREHASH_PhysicsTimeDilation, time_dilation);
- LLViewerStats::getInstance()->mSimTDStat.addValue(time_dilation);
-
- // Process information
- // { CpuUsage F32 }
- // { SimMemTotal F32 }
- // { SimMemRSS F32 }
- // { ProcessUptime F32 }
- F32 cpu_usage;
- F32 sim_mem_total;
- F32 sim_mem_rss;
- F32 process_uptime;
- msg->getF32Fast(_PREHASH_Statistics, _PREHASH_CpuUsage, cpu_usage);
- msg->getF32Fast(_PREHASH_Statistics, _PREHASH_SimMemTotal, sim_mem_total);
- msg->getF32Fast(_PREHASH_Statistics, _PREHASH_SimMemRSS, sim_mem_rss);
- msg->getF32Fast(_PREHASH_Statistics, _PREHASH_ProcessUptime, process_uptime);
- LLViewerStats::getInstance()->mSimCPUUsageStat.addValue(cpu_usage);
- LLViewerStats::getInstance()->mSimMemTotalStat.addValue(sim_mem_total);
- LLViewerStats::getInstance()->mSimMemRSSStat.addValue(sim_mem_rss);
- */
-
//
// Various hacks that aren't statistics, but are being handled here.
//
diff --git a/indra/newview/llviewerobjectlist.cpp b/indra/newview/llviewerobjectlist.cpp
index 14a2ac3384..9c6045943f 100644
--- a/indra/newview/llviewerobjectlist.cpp
+++ b/indra/newview/llviewerobjectlist.cpp
@@ -93,7 +93,7 @@ extern LLPipeline gPipeline;
U32 LLViewerObjectList::sSimulatorMachineIndex = 1; // Not zero deliberately, to speed up index check.
std::map<U64, U32> LLViewerObjectList::sIPAndPortToIndex;
std::map<U64, LLUUID> LLViewerObjectList::sIndexAndLocalIDToUUID;
-LLStat LLViewerObjectList::sCacheHitRate("object_cache_hits", 128);
+LLTrace::Measurement<> LLViewerObjectList::sCacheHitRate("object_cache_hits");
LLViewerObjectList::LLViewerObjectList()
{
@@ -520,7 +520,7 @@ void LLViewerObjectList::processObjectUpdate(LLMessageSystem *mesgsys,
}
justCreated = TRUE;
mNumNewObjects++;
- sCacheHitRate.addValue(cached ? 100.f : 0.f);
+ sCacheHitRate.sample(cached ? 100.f : 0.f);
}
diff --git a/indra/newview/llviewerobjectlist.h b/indra/newview/llviewerobjectlist.h
index 9936432a71..ca4110230f 100644
--- a/indra/newview/llviewerobjectlist.h
+++ b/indra/newview/llviewerobjectlist.h
@@ -31,8 +31,8 @@
#include <set>
// common includes
-#include "llstat.h"
#include "llstring.h"
+#include "lltrace.h"
// project includes
#include "llviewerobject.h"
@@ -194,7 +194,7 @@ protected:
std::vector<OrphanInfo> mOrphanChildren; // UUID's of orphaned objects
S32 mNumOrphans;
- static LLStat sCacheHitRate;
+ static LLTrace::Measurement<> sCacheHitRate;
typedef std::vector<LLPointer<LLViewerObject> > vobj_list_t;
diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp
index 31e3820a21..652e0ee70b 100644
--- a/indra/newview/llviewerregion.cpp
+++ b/indra/newview/llviewerregion.cpp
@@ -291,7 +291,9 @@ LLViewerRegion::LLViewerRegion(const U64 &handle,
mCacheLoaded(FALSE),
mCacheDirty(FALSE),
mReleaseNotesRequested(FALSE),
- mCapabilitiesReceived(false)
+ mCapabilitiesReceived(false),
+ mBitsReceived(0.f),
+ mPacketsReceived(0.f)
{
mWidth = region_width_meters;
mImpl->mOriginGlobal = from_region_handle(handle);
@@ -909,9 +911,8 @@ void LLViewerRegion::updateNetStats()
mPacketsLost = cdp->getPacketsLost();
mPingDelay = cdp->getPingDelay();
- mBitStat.addValue(mBitsIn - mLastBitsIn);
- mPacketsStat.addValue(mPacketsIn - mLastPacketsIn);
- mPacketsLostStat.addValue(mPacketsLost);
+ mBitsReceived += mBitsIn - mLastBitsIn;
+ mPacketsReceived += mPacketsIn - mLastPacketsIn;
}
diff --git a/indra/newview/llviewerregion.h b/indra/newview/llviewerregion.h
index c9fffaf30e..756c0dc61f 100644
--- a/indra/newview/llviewerregion.h
+++ b/indra/newview/llviewerregion.h
@@ -34,7 +34,6 @@
#include "lldarray.h"
#include "llwind.h"
-#include "llstat.h"
#include "v3dmath.h"
#include "llstring.h"
#include "llregionflags.h"
@@ -351,9 +350,8 @@ public:
LLWind mWind;
LLViewerParcelOverlay *mParcelOverlay;
- LLStat mBitStat;
- LLStat mPacketsStat;
- LLStat mPacketsLostStat;
+ F32 mBitsReceived;
+ F32 mPacketsReceived;
LLMatrix4 mRenderMatrix;
diff --git a/indra/newview/llviewerstats.cpp b/indra/newview/llviewerstats.cpp
index 04b0c30b40..a42368cec4 100755
--- a/indra/newview/llviewerstats.cpp
+++ b/indra/newview/llviewerstats.cpp
@@ -94,8 +94,8 @@ LLTrace::Count<LLTrace::Kilobits> KBIT("kbitstat"),
OBJECT_KBIT("objectkbitstat"),
ASSET_KBIT("assetkbitstat"),
TEXTURE_KBIT("texturekbitstat"),
- ACTUAL_IN_KBIT("actualinkbit"),
- ACTUAL_OUT_KBIT("actualoutkbit");
+ ACTUAL_IN_KBIT("actualinkbitstat"),
+ ACTUAL_OUT_KBIT("actualoutkbitstat");
LLTrace::Count<LLTrace::Seconds> AVATAR_EDIT_TIME("avataredittime", "Seconds in Edit Appearence"),
TOOLBOX_TIME("toolboxtime", "Seconds using Toolbox"),
@@ -276,20 +276,25 @@ void LLViewerStats::addToMessage(LLSD &body) const
// *NOTE:Mani The following methods used to exist in viewer.cpp
// Moving them here, but not merging them into LLViewerStats yet.
-U32 gTotalLandIn = 0, gTotalLandOut = 0;
-U32 gTotalWaterIn = 0, gTotalWaterOut = 0;
-
-F32 gAveLandCompression = 0.f, gAveWaterCompression = 0.f;
-F32 gBestLandCompression = 1.f, gBestWaterCompression = 1.f;
-F32 gWorstLandCompression = 0.f, gWorstWaterCompression = 0.f;
+U32 gTotalLandIn = 0,
+ gTotalLandOut = 0,
+ gTotalWaterIn = 0,
+ gTotalWaterOut = 0;
+
+F32 gAveLandCompression = 0.f,
+ gAveWaterCompression = 0.f,
+ gBestLandCompression = 1.f,
+ gBestWaterCompression = 1.f,
+ gWorstLandCompression = 0.f,
+ gWorstWaterCompression = 0.f;
LLUnit::Bytes<U32> gTotalWorldData = 0,
gTotalObjectData = 0,
gTotalTextureData = 0;
-U32 gSimPingCount = 0;
+U32 gSimPingCount = 0;
LLUnit::Bits<U32> gObjectData = 0;
-F32 gAvgSimPing = 0.f;
-LLUnit::Bytes<U32> gTotalTextureBytesPerBoostLevel[LLViewerTexture::MAX_GL_IMAGE_CATEGORY] = {0};
+F32 gAvgSimPing = 0.f;
+LLUnit::Bytes<U32> gTotalTextureBytesPerBoostLevel[LLViewerTexture::MAX_GL_IMAGE_CATEGORY] = {0};
extern U32 gVisCompared;
extern U32 gVisTested;
@@ -334,13 +339,13 @@ void update_statistics()
LLCircuitData *cdp = gMessageSystem->mCircuitInfo.findCircuit(gAgent.getRegion()->getHost());
if (cdp)
{
- LLStatViewer::SIM_PING.sample<LLTrace::Seconds>(cdp->getPingDelay());
+ LLStatViewer::SIM_PING.sample<LLTrace::Milliseconds>(cdp->getPingDelay());
gAvgSimPing = ((gAvgSimPing * (F32)gSimPingCount) + (F32)(cdp->getPingDelay())) / ((F32)gSimPingCount + 1);
gSimPingCount++;
}
else
{
- LLStatViewer::SIM_PING.sample<LLTrace::Seconds>(10000);
+ LLStatViewer::SIM_PING.sample<LLTrace::Seconds>(10);
}
LLStatViewer::FPS.add(1);
@@ -390,8 +395,6 @@ void update_statistics()
texture_stats_timer.reset();
}
}
-
- LLTrace::get_frame_recording().nextPeriod();
}
class ViewerStatsResponder : public LLHTTPClient::Responder
diff --git a/indra/newview/llviewerstats.h b/indra/newview/llviewerstats.h
index 34731481f5..eda7b3329d 100755
--- a/indra/newview/llviewerstats.h
+++ b/indra/newview/llviewerstats.h
@@ -27,7 +27,6 @@
#ifndef LL_LLVIEWERSTATS_H
#define LL_LLVIEWERSTATS_H
-#include "llstat.h"
#include "llstatenums.h"
#include "lltextureinfo.h"
#include "lltracerecording.h"
diff --git a/indra/newview/llviewertexturelist.h b/indra/newview/llviewertexturelist.h
index a00f48b5a2..e3df71cca2 100644
--- a/indra/newview/llviewertexturelist.h
+++ b/indra/newview/llviewertexturelist.h
@@ -30,7 +30,6 @@
#include "lluuid.h"
//#include "message.h"
#include "llgl.h"
-#include "llstat.h"
#include "llviewertexture.h"
#include "llui.h"
#include <list>
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp
index 06daf15c08..b7415669bb 100755
--- a/indra/newview/llviewerwindow.cpp
+++ b/indra/newview/llviewerwindow.cpp
@@ -77,7 +77,6 @@
#include "llmediaentry.h"
#include "llurldispatcher.h"
#include "raytrace.h"
-#include "llstat.h"
// newview includes
#include "llagent.h"
@@ -249,6 +248,9 @@ std::string LLViewerWindow::sSnapshotDir;
std::string LLViewerWindow::sMovieBaseName;
+LLTrace::Measurement<> LLViewerWindow::sMouseVelocityStat("Mouse Velocity");
+
+
class RecordToChatConsole : public LLError::Recorder, public LLSingleton<RecordToChatConsole>
{
public:
@@ -1541,8 +1543,7 @@ LLViewerWindow::LLViewerWindow(const Params& p)
mResDirty(false),
mStatesDirty(false),
mCurrResolutionIndex(0),
- mProgressView(NULL),
- mMouseVelocityStat(new LLStat("Mouse Velocity"))
+ mProgressView(NULL)
{
// gKeyboard is still NULL, so it doesn't do LLWindowListener any good to
// pass its value right now. Instead, pass it a nullary function that
@@ -2072,8 +2073,6 @@ LLViewerWindow::~LLViewerWindow()
delete mDebugText;
mDebugText = NULL;
-
- delete mMouseVelocityStat;
}
@@ -3247,7 +3246,7 @@ void LLViewerWindow::updateMouseDelta()
mouse_vel.setVec((F32) dx, (F32) dy);
}
- mMouseVelocityStat->addValue(mouse_vel.magVec());
+ sMouseVelocityStat.sample(mouse_vel.magVec());
}
void LLViewerWindow::updateKeyboardFocus()
diff --git a/indra/newview/llviewerwindow.h b/indra/newview/llviewerwindow.h
index 5f475fe145..be2d6d885e 100644
--- a/indra/newview/llviewerwindow.h
+++ b/indra/newview/llviewerwindow.h
@@ -44,12 +44,12 @@
#include "llmousehandler.h"
#include "llhandle.h"
#include "llinitparam.h"
+#include "lltrace.h"
#include <boost/function.hpp>
#include <boost/signals2.hpp>
#include <boost/scoped_ptr.hpp>
-class LLStat;
class LLView;
class LLViewerObject;
class LLUUID;
@@ -250,7 +250,7 @@ public:
S32 getCurrentMouseDX() const { return mCurrentMouseDelta.mX; }
S32 getCurrentMouseDY() const { return mCurrentMouseDelta.mY; }
LLCoordGL getCurrentMouseDelta() const { return mCurrentMouseDelta; }
- LLStat* getMouseVelocityStat() { return mMouseVelocityStat; }
+ static LLTrace::Measurement<>* getMouseVelocityStat() { return &sMouseVelocityStat; }
BOOL getLeftMouseDown() const { return mLeftMouseDown; }
BOOL getMiddleMouseDown() const { return mMiddleMouseDown; }
BOOL getRightMouseDown() const { return mRightMouseDown; }
@@ -427,7 +427,6 @@ private:
LLCoordGL mCurrentMousePoint; // last mouse position in GL coords
LLCoordGL mLastMousePoint; // Mouse point at last frame.
LLCoordGL mCurrentMouseDelta; //amount mouse moved this frame
- LLStat* mMouseVelocityStat;
BOOL mLeftMouseDown;
BOOL mMiddleMouseDown;
BOOL mRightMouseDown;
@@ -482,6 +481,8 @@ private:
// Object temporarily hovered over while dragging
LLPointer<LLViewerObject> mDragHoveredObject;
+
+ static LLTrace::Measurement<> sMouseVelocityStat;
};
//
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp
index 97c1b07ebc..3c1f8ca6b0 100755
--- a/indra/newview/llvoavatar.cpp
+++ b/indra/newview/llvoavatar.cpp
@@ -4318,8 +4318,6 @@ U32 LLVOAvatar::renderSkinned(EAvatarRenderPass pass)
//--------------------------------------------------------------------
// render all geometry attached to the skeleton
//--------------------------------------------------------------------
- static LLStat render_stat;
-
LLViewerJointMesh::sRenderPass = pass;
if (pass == AVATAR_RENDER_PASS_SINGLE)
@@ -4372,10 +4370,6 @@ U32 LLVOAvatar::renderSkinned(EAvatarRenderPass pass)
LLViewerJointMesh::sRenderPass = AVATAR_RENDER_PASS_SINGLE;
- //llinfos << "Avatar render: " << render_timer.getElapsedTimeF32() << llendl;
-
- //render_stat.addValue(render_timer.getElapsedTimeF32()*1000.f);
-
return num_indices;
}
diff --git a/indra/newview/llworld.cpp b/indra/newview/llworld.cpp
index dced5a847b..e140f3b23b 100644
--- a/indra/newview/llworld.cpp
+++ b/indra/newview/llworld.cpp
@@ -692,8 +692,10 @@ void LLWorld::updateNetStats()
{
LLViewerRegion* regionp = *iter;
regionp->updateNetStats();
- bits += regionp->mBitStat.getCurrent();
- packets += llfloor( regionp->mPacketsStat.getCurrent() );
+ bits += regionp->mBitsReceived;
+ packets += llfloor( regionp->mPacketsReceived );
+ regionp->mBitsReceived = 0.f;
+ regionp->mPacketsReceived = 0.f;
}
S32 packets_in = gMessageSystem->mPacketsIn - mLastPacketsIn;
@@ -705,26 +707,15 @@ void LLWorld::updateNetStats()
LLStatViewer::ACTUAL_IN_KBIT.add<LLTrace::Bits>(actual_in_bits);
LLStatViewer::ACTUAL_OUT_KBIT.add<LLTrace::Bits>(actual_out_bits);
- //LLViewerStats::getInstance()->mActualInKBitStat.addValue(actual_in_bits/1024.f);
- //LLViewerStats::getInstance()->mActualOutKBitStat.addValue(actual_out_bits/1024.f);
LLStatViewer::KBIT.add<LLTrace::Bits>(bits);
- //LLViewerStats::getInstance()->mKBitStat.addValue(bits/1024.f);
LLStatViewer::PACKETS_IN.add(packets_in);
LLStatViewer::PACKETS_OUT.add(packets_out);
LLStatViewer::PACKETS_LOST.add(packets_lost);
LLStatViewer::PACKETS_LOST_PERCENT.sample(100.f*((F32)packets_lost/(F32)packets_in));
- //LLViewerStats::getInstance()->mPacketsInStat.addValue(packets_in);
- //LLViewerStats::getInstance()->mPacketsOutStat.addValue(packets_out);
- //LLViewerStats::getInstance()->mPacketsLostStat.addValue(gMessageSystem->mDroppedPackets);
if (packets_in)
{
LLStatViewer::PACKETS_LOST_PERCENT.sample(100.f*((F32)packets_lost/(F32)packets_in));
- // LLViewerStats::getInstance()->mPacketsLostPercentStat.addValue(100.f*((F32)packets_lost/(F32)packets_in));
}
- //else
- //{
- // LLViewerStats::getInstance()->mPacketsLostPercentStat.addValue(0.f);
- //}
mLastPacketsIn = gMessageSystem->mPacketsIn;
mLastPacketsOut = gMessageSystem->mPacketsOut;
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index 75af605ad7..1e050d2588 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -488,7 +488,6 @@ void LLPipeline::init()
getPool(LLDrawPool::POOL_BUMP);
getPool(LLDrawPool::POOL_GLOW);
- //LLViewerStats::getInstance()->mTrianglesDrawnStat.reset();
resetFrameStats();
for (U32 i = 0; i < NUM_RENDER_TYPES; ++i)
@@ -1769,7 +1768,6 @@ void LLPipeline::resetFrameStats()
assertInitialized();
LLStatViewer::TRIANGLES_DRAWN.add(mTrianglesDrawn);
- //LLViewerStats::getInstance()->mTrianglesDrawnStat.addValue(mTrianglesDrawn/1000.f);
if (mBatchCount > 0)
{
@@ -9756,7 +9754,9 @@ void LLPipeline::generateSunShadow(LLCamera& camera)
if (gen_shadow)
{
- F32 fade_amt = gFrameIntervalSeconds.value() * llmax(LLViewerCamera::getInstance()->getVelocityStat()->getCurrentPerSec(), 1.f);
+ LLTrace::Measurement<>* velocity_stat = LLViewerCamera::getVelocityStat();
+ F32 fade_amt = gFrameIntervalSeconds.value()
+ * llmax(LLTrace::get_frame_recording().getLastRecordingPeriod().getLastValue(*velocity_stat), 1.0);
//update shadow targets
for (U32 i = 0; i < 2; i++)