summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorandreykproductengine <andreykproductengine@lindenlab.com>2017-08-17 15:32:01 +0300
committerandreykproductengine <andreykproductengine@lindenlab.com>2017-08-17 15:32:01 +0300
commitcbd4c0196fc32f94c6f9a41d161b65f4609985d4 (patch)
treecff7496793f34cf0df2b8fec502bc4bf2bd0f34f /indra/newview
parent2c02c89b5805fc63b09e5a5215a771b43b59ce8e (diff)
SL-683 Instrument viewer cache
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/lltextureinfo.cpp48
-rw-r--r--indra/newview/lltexturestats.cpp3
-rw-r--r--indra/newview/llviewerregion.cpp6
-rw-r--r--indra/newview/llviewerregion.h6
-rw-r--r--indra/newview/llvocache.h3
5 files changed, 63 insertions, 3 deletions
diff --git a/indra/newview/lltextureinfo.cpp b/indra/newview/lltextureinfo.cpp
index 473d8ce709..5f1e14e406 100644
--- a/indra/newview/lltextureinfo.cpp
+++ b/indra/newview/lltextureinfo.cpp
@@ -26,10 +26,19 @@
#include "llviewerprecompiledheaders.h"
+#include "llagent.h"
+#include "llmeshrepository.h"
+#include "llsdutil.h"
#include "lltextureinfo.h"
+#include "lltexturecache.h"
+#include "lltexturefetch.h"
#include "lltexturestats.h"
-#include "llviewercontrol.h"
#include "lltrace.h"
+#include "llviewercontrol.h"
+#include "llviewerregion.h"
+#include "llviewerstats.h"
+#include "llvocache.h"
+#include "llworld.h"
static LLTrace::CountStatHandle<S32> sTextureDownloadsStarted("texture_downloads_started", "number of texture downloads initiated");
static LLTrace::CountStatHandle<S32> sTextureDownloadsCompleted("texture_downloads_completed", "number of texture downloads completed");
@@ -175,6 +184,43 @@ void LLTextureInfo::setRequestCompleteTimeAndLog(const LLUUID& id, U64Microsecon
endTime << completeTime;
texture_data["end_time"] = endTime.str();
texture_data["averages"] = getAverages();
+
+ // Texture cache
+ LLSD texture_cache;
+ U32 cache_read = 0, cache_write = 0, res_wait = 0;
+ F64 cache_hit_rate = 0;
+ LLAppViewer::getTextureFetch()->getStateStats(&cache_read, &cache_write, &res_wait);
+ if (cache_read > 0 || cache_write > 0)
+ {
+ cache_hit_rate = cache_read / (cache_read + cache_write);
+ }
+ texture_cache["cache_read"] = LLSD::Integer(cache_read);
+ texture_cache["cache_write"] = LLSD::Integer(cache_write);
+ texture_cache["hit_rate"] = LLSD::Real(cache_hit_rate);
+ texture_cache["entries"] = LLSD::Integer(LLAppViewer::getTextureCache()->getEntries());
+ texture_cache["space_max"] = ll_sd_from_U64((U64)LLAppViewer::getTextureCache()->getMaxUsage().value()); // bytes
+ texture_cache["space_used"] = ll_sd_from_U64((U64)LLAppViewer::getTextureCache()->getUsage().value()); // bytes
+ texture_data["texture_cache"] = texture_cache;
+
+ // VO and mesh cache
+ LLSD object_cache;
+ object_cache["vo_entries_max"] = LLSD::Integer(LLVOCache::getInstance()->getCacheEntriesMax());
+ object_cache["vo_entries_curent"] = LLSD::Integer(LLVOCache::getInstance()->getCacheEntries());
+ object_cache["vo_active_entries"] = LLSD::Integer(LLWorld::getInstance()->getNumOfActiveCachedObjects());
+ U64 region_hit_count = gAgent.getRegion() != NULL ? gAgent.getRegion()->getRegionCacheHitCount() : 0;
+ U64 region_miss_count = gAgent.getRegion() != NULL ? gAgent.getRegion()->getRegionCacheMissCount() : 0;
+ F64 region_vocache_hit_rate = 0;
+ if (region_hit_count > 0 || region_miss_count > 0)
+ {
+ region_vocache_hit_rate = region_hit_count / (region_hit_count + region_miss_count);
+ }
+ object_cache["vo_region_hitcount"] = ll_sd_from_U64(region_hit_count);
+ object_cache["vo_region_misscount"] = ll_sd_from_U64(region_miss_count);
+ object_cache["vo_region_hitrate"] = LLSD::Real(region_vocache_hit_rate);
+ object_cache["mesh_reads"] = LLSD::Integer(LLMeshRepository::sCacheReads);
+ object_cache["mesh_writes"] = LLSD::Integer(LLMeshRepository::sCacheWrites);
+ texture_data["object_cache"] = object_cache;
+
send_texture_stats_to_sim(texture_data);
resetTextureStatistics();
}
diff --git a/indra/newview/lltexturestats.cpp b/indra/newview/lltexturestats.cpp
index 8ded148e17..b55b4d9ca4 100644
--- a/indra/newview/lltexturestats.cpp
+++ b/indra/newview/lltexturestats.cpp
@@ -30,6 +30,7 @@
#include "llagent.h"
#include "lltexturefetch.h"
#include "lltexturestats.h"
+#include "llversioninfo.h"
#include "llviewerregion.h"
#include "llcorehttputil.h"
@@ -45,6 +46,8 @@ void send_texture_stats_to_sim(const LLSD &texture_stats)
LLUUID agent_id = gAgent.getID();
texture_stats_report["agent_id"] = agent_id;
texture_stats_report["region_id"] = gAgent.getRegion()->getRegionID();
+ texture_stats_report["viewer_channel"] = LLVersionInfo::getChannel();
+ texture_stats_report["viewer_version"] = LLVersionInfo::getVersion();
texture_stats_report["stats_data"] = texture_stats;
std::string texture_cap_url = gAgent.getRegion()->getCapability("TextureStats");
diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp
index eb37613c95..3fd2af87de 100644
--- a/indra/newview/llviewerregion.cpp
+++ b/indra/newview/llviewerregion.cpp
@@ -532,7 +532,9 @@ LLViewerRegion::LLViewerRegion(const U64 &handle,
mDead(FALSE),
mLastVisitedEntry(NULL),
mInvisibilityCheckHistory(-1),
- mPaused(FALSE)
+ mPaused(FALSE),
+ mRegionCacheHitCount(0),
+ mRegionCacheMissCount(0)
{
mWidth = region_width_meters;
mImpl->mOriginGlobal = from_region_handle(handle);
@@ -2440,6 +2442,7 @@ LLVOCacheEntry* LLViewerRegion::getCacheEntry(U32 local_id, bool valid)
void LLViewerRegion::addCacheMiss(U32 id, LLViewerRegion::eCacheMissType miss_type)
{
+ mRegionCacheMissCount++;
#if 0
mCacheMissList.insert(CacheMissItem(id, miss_type));
#else
@@ -2491,6 +2494,7 @@ bool LLViewerRegion::probeCache(U32 local_id, U32 crc, U32 flags, U8 &cache_miss
if (entry->getCRC() == crc)
{
// Record a hit
+ mRegionCacheHitCount++;
entry->recordHit();
cache_miss_type = CACHE_MISS_TYPE_NONE;
entry->setUpdateFlags(flags);
diff --git a/indra/newview/llviewerregion.h b/indra/newview/llviewerregion.h
index 61ce5b454d..69fb9c4d4e 100644
--- a/indra/newview/llviewerregion.h
+++ b/indra/newview/llviewerregion.h
@@ -338,6 +338,8 @@ public:
LLVOCacheEntry* getCacheEntryForOctree(U32 local_id);
LLVOCacheEntry* getCacheEntry(U32 local_id, bool valid = true);
bool probeCache(U32 local_id, U32 crc, U32 flags, U8 &cache_miss_type);
+ U64 getRegionCacheHitCount() { return mRegionCacheHitCount; }
+ U64 getRegionCacheMissCount() { return mRegionCacheMissCount; }
void requestCacheMisses();
void addCacheMissFull(const U32 local_id);
//update object cache if the object receives a full-update or terse update
@@ -534,7 +536,9 @@ private:
typedef std::list<CacheMissItem> cache_miss_list_t;
};
CacheMissItem::cache_miss_list_t mCacheMissList;
-
+ U64 mRegionCacheHitCount;
+ U64 mRegionCacheMissCount;
+
caps_received_signal_t mCapabilitiesReceivedSignal;
caps_received_signal_t mSimulatorFeaturesReceivedSignal;
diff --git a/indra/newview/llvocache.h b/indra/newview/llvocache.h
index 230a81fb76..7d450c5231 100644
--- a/indra/newview/llvocache.h
+++ b/indra/newview/llvocache.h
@@ -268,6 +268,9 @@ public:
void setReadOnly(bool read_only) {mReadOnly = read_only;}
+ U32 getCacheEntries() { return mNumEntries; }
+ U32 getCacheEntriesMax() { return mCacheSize; }
+
private:
void setDirNames(ELLPath location);
// determine the cache filename for the region from the region handle