diff options
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llstatusbar.cpp | 33 | ||||
-rwxr-xr-x | indra/newview/llviewerstats.cpp | 38 | ||||
-rwxr-xr-x | indra/newview/llviewerstats.h | 20 | ||||
-rw-r--r-- | indra/newview/llviewertexturelist.cpp | 4 | ||||
-rw-r--r-- | indra/newview/llworld.cpp | 3 |
5 files changed, 60 insertions, 38 deletions
diff --git a/indra/newview/llstatusbar.cpp b/indra/newview/llstatusbar.cpp index 4892de9da0..9f499ef4ef 100644 --- a/indra/newview/llstatusbar.cpp +++ b/indra/newview/llstatusbar.cpp @@ -198,10 +198,10 @@ BOOL LLStatusBar::postBuild() sgp.rect(r); sgp.follows.flags(FOLLOWS_BOTTOM | FOLLOWS_RIGHT); sgp.mouse_opaque(false); + sgp.stat.f32_stat(&STAT_KBIT); + sgp.units("Kbps"); + sgp.precision(0); mSGBandwidth = LLUICtrlFactory::create<LLStatGraph>(sgp); - mSGBandwidth->setStat(&LLViewerStats::getInstance()->mKBitStat); - mSGBandwidth->setUnits("Kbps"); - mSGBandwidth->setPrecision(0); addChild(mSGBandwidth); x -= SIM_STAT_WIDTH + 2; @@ -212,17 +212,20 @@ BOOL LLStatusBar::postBuild() pgp.rect(r); pgp.follows.flags(FOLLOWS_BOTTOM | FOLLOWS_RIGHT); pgp.mouse_opaque(false); + pgp.stat.legacy_stat(&LLViewerStats::getInstance()->mPacketsLostPercentStat); + pgp.units("%"); + pgp.min(0.f); + pgp.max(5.f); + pgp.precision(1); + pgp.per_sec(false); + LLStatGraph::Thresholds thresholds; + thresholds.threshold.add(LLStatGraph::ThresholdParams().value(0.1).color(LLColor4::green)) + .add(LLStatGraph::ThresholdParams().value(0.25f).color(LLColor4::yellow)) + .add(LLStatGraph::ThresholdParams().value(0.6f).color(LLColor4::red)); + + pgp.thresholds(thresholds); mSGPacketLoss = LLUICtrlFactory::create<LLStatGraph>(pgp); - mSGPacketLoss->setStat(&LLViewerStats::getInstance()->mPacketsLostPercentStat); - mSGPacketLoss->setUnits("%"); - mSGPacketLoss->setMin(0.f); - mSGPacketLoss->setMax(5.f); - mSGPacketLoss->setThreshold(0, 0.5f); - mSGPacketLoss->setThreshold(1, 1.f); - mSGPacketLoss->setThreshold(2, 3.f); - mSGPacketLoss->setPrecision(1); - mSGPacketLoss->mPerSec = FALSE; addChild(mSGPacketLoss); mPanelVolumePulldown = new LLPanelVolumePulldown(); @@ -252,9 +255,9 @@ void LLStatusBar::refresh() F32 bwtotal = gViewerThrottle.getMaxBandwidth() / 1000.f; mSGBandwidth->setMin(0.f); mSGBandwidth->setMax(bwtotal*1.25f); - mSGBandwidth->setThreshold(0, bwtotal*0.75f); - mSGBandwidth->setThreshold(1, bwtotal); - mSGBandwidth->setThreshold(2, bwtotal); + //mSGBandwidth->setThreshold(0, bwtotal*0.75f); + //mSGBandwidth->setThreshold(1, bwtotal); + //mSGBandwidth->setThreshold(2, bwtotal); } // update clock every 10 seconds diff --git a/indra/newview/llviewerstats.cpp b/indra/newview/llviewerstats.cpp index da87cc2673..b1aeaef91d 100755 --- a/indra/newview/llviewerstats.cpp +++ b/indra/newview/llviewerstats.cpp @@ -62,6 +62,13 @@ #include "llmeshrepository.h" //for LLMeshRepository::sBytesReceived +LLTrace::Stat<F32> STAT_KBIT("kbitstat"), + STAT_LAYERS_KBIT("layerskbitstat"), + STAT_OBJECT_KBIT("objectkbitstat"), + STAT_ASSET_KBIT("assetkbitstat"), + STAT_TEXTURE_KBIT("texturekbitstat"); + + class StatAttributes { public: @@ -198,11 +205,6 @@ const StatAttributes STAT_INFO[LLViewerStats::ST_COUNT] = }; LLViewerStats::LLViewerStats() : - mKBitStat("kbitstat"), - mLayersKBitStat("layerskbitstat"), - mObjectKBitStat("objectkbitstat"), - mAssetKBitStat("assetkbitstat"), - mTextureKBitStat("texturekbitstat"), mVFSPendingOperations("vfspendingoperations"), mFPSStat("fpsstat"), mPacketsInStat("packetsinstat"), @@ -261,7 +263,8 @@ LLViewerStats::LLViewerStats() : mNumNewObjectsStat("numnewobjectsstat"), mNumSizeCulledStat("numsizeculledstat"), mNumVisCulledStat("numvisculledstat"), - mLastTimeDiff(0.0) + mLastTimeDiff(0.0), + mSampler(LLThread::getTraceData()->createSampler()) { for (S32 i = 0; i < ST_COUNT; i++) { @@ -274,17 +277,18 @@ LLViewerStats::LLViewerStats() : } mAgentPositionSnaps.reset(); + mSampler->start(); +} + +LLViewerStats::~LLViewerStats() +{ + delete mSampler; } void LLViewerStats::resetStats() { LLViewerStats& stats = LLViewerStats::instance(); - stats.mKBitStat.reset(); - stats.mLayersKBitStat.reset(); - stats.mObjectKBitStat.reset(); - stats.mTextureKBitStat.reset(); stats.mVFSPendingOperations.reset(); - stats.mAssetKBitStat.reset(); stats.mPacketsInStat.reset(); stats.mPacketsLostStat.reset(); stats.mPacketsOutStat.reset(); @@ -463,10 +467,13 @@ void update_statistics() stats.mFPSStat.addValue(1); F32 layer_bits = (F32)(gVLManager.getLandBits() + gVLManager.getWindBits() + gVLManager.getCloudBits()); - stats.mLayersKBitStat.addValue(layer_bits/1024.f); - stats.mObjectKBitStat.addValue(gObjectBits/1024.f); + STAT_LAYERS_KBIT.sample(layer_bits/1024.f); + //stats.mLayersKBitStat.addValue(layer_bits/1024.f); + STAT_OBJECT_KBIT.sample(gObjectBits/1024.f); + //stats.mObjectKBitStat.addValue(gObjectBits/1024.f); stats.mVFSPendingOperations.addValue(LLVFile::getVFSThread()->getPending()); - stats.mAssetKBitStat.addValue(gTransferManager.getTransferBitsIn(LLTCT_ASSET)/1024.f); + STAT_ASSET_KBIT.sample(gTransferManager.getTransferBitsIn(LLTCT_ASSET)/1024.f); + //stats.mAssetKBitStat.addValue(gTransferManager.getTransferBitsIn(LLTCT_ASSET)/1024.f); gTransferManager.resetTransferBitsIn(LLTCT_ASSET); if (LLAppViewer::getTextureFetch()->getNumRequests() == 0) @@ -503,7 +510,8 @@ void update_statistics() static LLFrameTimer texture_stats_timer; if (texture_stats_timer.getElapsedTimeF32() >= texture_stats_freq) { - stats.mTextureKBitStat.addValue(LLViewerTextureList::sTextureBits/1024.f); + STAT_TEXTURE_KBIT.sample(LLViewerTextureList::sTextureBits/1024.f); + //stats.mTextureKBitStat.addValue(LLViewerTextureList::sTextureBits/1024.f); stats.mTexturePacketsStat.addValue(LLViewerTextureList::sTexturePackets); gTotalTextureBytes += LLViewerTextureList::sTextureBits / 8; LLViewerTextureList::sTextureBits = 0; diff --git a/indra/newview/llviewerstats.h b/indra/newview/llviewerstats.h index 0d8f2a45c0..ca70660ce9 100755 --- a/indra/newview/llviewerstats.h +++ b/indra/newview/llviewerstats.h @@ -29,16 +29,18 @@ #include "llstat.h" #include "lltextureinfo.h" +#include "lltracesampler.h" + +extern LLTrace::Stat<F32> STAT_KBIT, + STAT_LAYERS_KBIT, + STAT_OBJECT_KBIT, + STAT_ASSET_KBIT, + STAT_TEXTURE_KBIT; class LLViewerStats : public LLSingleton<LLViewerStats> { public: - LLStat mKBitStat, - mLayersKBitStat, - mObjectKBitStat, - mAssetKBitStat, - mTextureKBitStat, - mVFSPendingOperations, + LLStat mVFSPendingOperations, mFPSStat, mPacketsInStat, mPacketsLostStat, @@ -110,7 +112,9 @@ public: mNumVisCulledStat; void resetStats(); + public: + // If you change this, please also add a corresponding text label in llviewerstats.cpp enum EStatType { @@ -177,6 +181,7 @@ public: }; LLViewerStats(); + ~LLViewerStats(); // all return latest value of given stat F64 getStat(EStatType type) const; @@ -292,8 +297,11 @@ public: static void recordPhaseStat(const std::string& phase_name, F32 value); }; + LLTrace::Sampler* getSampler() { return mSampler; } + private: F64 mStats[ST_COUNT]; + LLTrace::Sampler* mSampler; F64 mLastTimeDiff; // used for time stat updates }; diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp index 17d8e5e4fa..034f8edf24 100644 --- a/indra/newview/llviewertexturelist.cpp +++ b/indra/newview/llviewertexturelist.cpp @@ -622,7 +622,9 @@ void LLViewerTextureList::updateImages(F32 max_time) } cleared = FALSE; - LLAppViewer::getTextureFetch()->setTextureBandwidth(LLViewerStats::getInstance()->mTextureKBitStat.getMeanPerSec()); + LLTrace::Sampler* sampler = LLThread::getTraceData()->getPrimarySampler(); + + LLAppViewer::getTextureFetch()->setTextureBandwidth(sampler->getMean(STAT_TEXTURE_KBIT) / sampler->getSampleTime()); LLViewerStats::getInstance()->mNumImagesStat.addValue(sNumImages); LLViewerStats::getInstance()->mNumRawImagesStat.addValue(LLImageRaw::sRawImageCount); diff --git a/indra/newview/llworld.cpp b/indra/newview/llworld.cpp index 43152c9025..97079e0588 100644 --- a/indra/newview/llworld.cpp +++ b/indra/newview/llworld.cpp @@ -704,7 +704,8 @@ void LLWorld::updateNetStats() 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); - LLViewerStats::getInstance()->mKBitStat.addValue(bits/1024.f); + STAT_KBIT.sample(bits/1024.f); + //LLViewerStats::getInstance()->mKBitStat.addValue(bits/1024.f); LLViewerStats::getInstance()->mPacketsInStat.addValue(packets_in); LLViewerStats::getInstance()->mPacketsOutStat.addValue(packets_out); LLViewerStats::getInstance()->mPacketsLostStat.addValue(gMessageSystem->mDroppedPackets); |