added stats tracking for texture/object cache hit rates and texture cache read latency

meow-7.2.2
Richard Linden 2012-03-15 11:57:29 -07:00
parent 8efce456af
commit 3672956f0d
6 changed files with 66 additions and 4 deletions

View File

@ -272,7 +272,7 @@ LLRect LLStatBar::getRequiredRect()
{
if (mDisplayHistory)
{
rect.mTop = 67;
rect.mTop = 35 + mStatp->getNumBins();
}
else
{

View File

@ -53,6 +53,9 @@
#include "llviewerassetstats.h"
#include "llworld.h"
LLStat LLTextureFetch::sCacheHitRate("texture_cache_hits", 128);
LLStat LLTextureFetch::sCacheReadLatency("texture_cache_read_latency", 128);
//////////////////////////////////////////////////////////////////////////////
class LLTextureFetchWorker : public LLWorkerClass
{
@ -242,6 +245,8 @@ private:
S32 mDecodedDiscard;
LLFrameTimer mRequestedTimer;
LLFrameTimer mFetchTimer;
LLTimer mCacheReadTimer;
F32 mCacheReadTime;
LLTextureCache::handle_t mCacheReadHandle;
LLTextureCache::handle_t mCacheWriteHandle;
U8* mBuffer;
@ -653,6 +658,7 @@ LLTextureFetchWorker::LLTextureFetchWorker(LLTextureFetch* fetcher,
mRequestedDiscard(-1),
mLoadedDiscard(-1),
mDecodedDiscard(-1),
mCacheReadTime(0.f),
mCacheReadHandle(LLTextureCache::nullHandle()),
mCacheWriteHandle(LLTextureCache::nullHandle()),
mBuffer(NULL),
@ -926,6 +932,7 @@ bool LLTextureFetchWorker::doWork(S32 param)
CacheReadResponder* responder = new CacheReadResponder(mFetcher, mID, mFormattedImage);
mCacheReadHandle = mFetcher->mTextureCache->readFromCache(filename, mID, cache_priority,
offset, size, responder);
mCacheReadTimer.reset();
}
else if (mUrl.empty())
{
@ -934,6 +941,7 @@ bool LLTextureFetchWorker::doWork(S32 param)
CacheReadResponder* responder = new CacheReadResponder(mFetcher, mID, mFormattedImage);
mCacheReadHandle = mFetcher->mTextureCache->readFromCache(mID, cache_priority,
offset, size, responder);
mCacheReadTimer.reset();
}
else if(mCanUseHTTP)
{
@ -986,7 +994,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;
// fall through
LLTextureFetch::sCacheHitRate.addValue(100.f);
}
else
{
@ -1002,6 +1010,7 @@ bool LLTextureFetchWorker::doWork(S32 param)
mState = LOAD_FROM_NETWORK;
}
// fall through
LLTextureFetch::sCacheHitRate.addValue(0.f);
}
}
@ -1780,6 +1789,7 @@ void LLTextureFetchWorker::callbackDecoded(bool success, LLImageRaw* raw, LLImag
mDecoded = TRUE;
// llinfos << mID << " : DECODE COMPLETE " << llendl;
setPriority(LLWorkerThread::PRIORITY_HIGH | mWorkPriority);
mCacheReadTime = mCacheReadTimer.getElapsedTimeF32();
}
//////////////////////////////////////////////////////////////////////////////
@ -2092,6 +2102,11 @@ bool LLTextureFetch::getRequestFinished(const LLUUID& id, S32& discard_level,
discard_level = worker->mDecodedDiscard;
raw = worker->mRawImage;
aux = worker->mAuxImage;
F32 cache_read_time = worker->mCacheReadTime;
if (cache_read_time != 0.f)
{
sCacheReadLatency.addValue(cache_read_time * 1000.f);
}
res = true;
LL_DEBUGS("Texture") << id << ": Request Finished. State: " << worker->mState << " Discard: " << discard_level << LL_ENDL;
worker->unlockWorkMutex();

View File

@ -164,6 +164,9 @@ private:
LLMutex mQueueMutex; //to protect mRequestMap and mCommands only
LLMutex mNetworkQueueMutex; //to protect mNetworkQueue, mHTTPTextureQueue and mCancelQueue.
static LLStat sCacheHitRate;
static LLStat sCacheReadLatency;
LLTextureCache* mTextureCache;
LLImageDecodeThread* mImageDecodeThread;
LLCurlRequest* mCurlGetRequest;

View File

@ -91,8 +91,9 @@ extern LLPipeline gPipeline;
// Statics for object lookup tables.
U32 LLViewerObjectList::sSimulatorMachineIndex = 1; // Not zero deliberately, to speed up index check.
std::map<U64, U32> LLViewerObjectList::sIPAndPortToIndex;
std::map<U64, U32> LLViewerObjectList::sIPAndPortToIndex;
std::map<U64, LLUUID> LLViewerObjectList::sIndexAndLocalIDToUUID;
LLStat LLViewerObjectList::sCacheHitRate("object_cache_hits", 128);
LLViewerObjectList::LLViewerObjectList()
{
@ -542,6 +543,8 @@ void LLViewerObjectList::processObjectUpdate(LLMessageSystem *mesgsys,
}
justCreated = TRUE;
mNumNewObjects++;
sCacheHitRate.addValue(cached ? 100.f : 0.f);
}

View File

@ -192,6 +192,8 @@ protected:
std::vector<OrphanInfo> mOrphanChildren; // UUID's of orphaned objects
S32 mNumOrphans;
static LLStat sCacheHitRate;
typedef std::vector<LLPointer<LLViewerObject> > vobj_list_t;
vobj_list_t mObjects;

View File

@ -149,13 +149,52 @@
show_per_sec="true"
show_bar="false">
</stat_bar>
<stat_bar
name="object_cache_hits"
label="Object Cache Hit Rate"
stat="object_cache_hits"
bar_min="0"
bar_max="100"
unit_label="%"
tick_spacing="20"
label_spacing="20"
show_history="true"
show_per_sec="false"
show_bar="false">
</stat_bar>
</stat_view>
<!--Texture Stats-->
<stat_view
name="texture"
label="Texture"
show_label="true">
<stat_bar
<stat_bar
name="texture_cache_hits"
label="Cache Hit Rate"
stat="texture_cache_hits"
bar_min="0.f"
bar_max="100.f"
unit_label="%"
tick_spacing="20"
label_spacing="20"
show_history="true"
show_per_sec="false"
show_bar="false">
</stat_bar>
<stat_bar
name="texture_cache_read_latency"
label="Cache Read Latency"
unit_label="msec"
stat="texture_cache_read_latency"
bar_min="0.f"
bar_max="1000.f"
tick_spacing="100"
label_spacing="200"
show_history="true"
show_per_sec="false"
show_bar="false">
</stat_bar>
<stat_bar
name="numimagesstat"
label="Count"
stat="numimagesstat"