From 57d5744f2c064ccb7bf8dd3dca2a24f6755297ac Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Fri, 28 Jul 2017 14:07:25 -0700 Subject: MAINT-7634: Move StatsAccumulator into llcommon, collect data sent and error codes from core. --- indra/newview/llappcorehttp.cpp | 3 ++ indra/newview/llfasttimerview.cpp | 4 +- indra/newview/llviewerstats.h | 86 ++------------------------------------- 3 files changed, 8 insertions(+), 85 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llappcorehttp.cpp b/indra/newview/llappcorehttp.cpp index c1f898284a..261a7b5ad9 100644 --- a/indra/newview/llappcorehttp.cpp +++ b/indra/newview/llappcorehttp.cpp @@ -39,6 +39,7 @@ #include #include "llcorehttputil.h" +#include "httpstats.h" // Here is where we begin to get our connection usage under control. // This establishes llcorehttp policy classes that, among other @@ -313,6 +314,8 @@ void LLAppCoreHttp::requestStop() void LLAppCoreHttp::cleanup() { + LLCore::HTTPStats::instance().dumpStats(); + if (LLCORE_HTTP_HANDLE_INVALID == mStopHandle) { // Should have been started already... diff --git a/indra/newview/llfasttimerview.cpp b/indra/newview/llfasttimerview.cpp index a69b3b7dc7..91501ccb1f 100644 --- a/indra/newview/llfasttimerview.cpp +++ b/indra/newview/llfasttimerview.cpp @@ -796,13 +796,13 @@ LLSD LLFastTimerView::analyzePerformanceLogDefault(std::istream& is) for(stats_map_t::iterator it = time_stats.begin(); it != time_stats.end(); ++it) { std::string label = it->first; - ret[label]["TotalTime"] = time_stats[label].mSum; + ret[label]["TotalTime"] = time_stats[label].getSum(); ret[label]["MeanTime"] = time_stats[label].getMean(); ret[label]["MaxTime"] = time_stats[label].getMaxValue(); ret[label]["MinTime"] = time_stats[label].getMinValue(); ret[label]["StdDevTime"] = time_stats[label].getStdDev(); - ret[label]["Samples"] = sample_stats[label].mSum; + ret[label]["Samples"] = sample_stats[label].getSum(); ret[label]["MaxSamples"] = sample_stats[label].getMaxValue(); ret[label]["MinSamples"] = sample_stats[label].getMinValue(); ret[label]["StdDevSamples"] = sample_stats[label].getStdDev(); diff --git a/indra/newview/llviewerstats.h b/indra/newview/llviewerstats.h index 97a060d95e..d8d92d61d3 100644 --- a/indra/newview/llviewerstats.h +++ b/indra/newview/llviewerstats.h @@ -30,7 +30,7 @@ #include "lltextureinfo.h" #include "lltracerecording.h" #include "lltrace.h" - +#include "llstatsaccumulator.h" enum ESimStatID { @@ -256,89 +256,9 @@ public: void addToMessage(LLSD &body); - struct StatsAccumulator - { - S32 mCount; - F32 mSum; - F32 mSumOfSquares; - F32 mMinValue; - F32 mMaxValue; - U32 mCountOfNextUpdatesToIgnore; - - inline StatsAccumulator() - { - reset(); - } - - inline void push( F32 val ) - { - if ( mCountOfNextUpdatesToIgnore > 0 ) - { - mCountOfNextUpdatesToIgnore--; - return; - } - - mCount++; - mSum += val; - mSumOfSquares += val * val; - if (mCount == 1 || val > mMaxValue) - { - mMaxValue = val; - } - if (mCount == 1 || val < mMinValue) - { - mMinValue = val; - } - } - - inline F32 getMean() const - { - return (mCount == 0) ? 0.f : ((F32)mSum)/mCount; - } - - inline F32 getMinValue() const - { - return mMinValue; - } - - inline F32 getMaxValue() const - { - return mMaxValue; - } - - inline F32 getStdDev() const - { - const F32 mean = getMean(); - return (mCount < 2) ? 0.f : sqrt(llmax(0.f,mSumOfSquares/mCount - (mean * mean))); - } - - inline U32 getCount() const - { - return mCount; - } - - inline void reset() - { - mCount = 0; - mSum = mSumOfSquares = 0.f; - mMinValue = 0.0f; - mMaxValue = 0.0f; - mCountOfNextUpdatesToIgnore = 0; - } - - inline LLSD asLLSD() const - { - LLSD data; - data["mean"] = getMean(); - data["std_dev"] = getStdDev(); - data["count"] = (S32)mCount; - data["min"] = getMinValue(); - data["max"] = getMaxValue(); - return data; - } - }; + typedef LLStatsAccumulator StatsAccumulator; - // Phase tracking (originally put in for avatar rezzing), tracking + // Phase tracking (originally put in for avatar rezzing), tracking // progress of active/completed phases for activities like outfit changing. typedef std::map phase_map_t; typedef std::map phase_stats_t; -- cgit v1.2.3