diff options
author | Merov Linden <merov@lindenlab.com> | 2010-09-08 23:03:56 -0700 |
---|---|---|
committer | Merov Linden <merov@lindenlab.com> | 2010-09-08 23:03:56 -0700 |
commit | 39e5d2ecf04deceda92d6a53413298ca1c3bc0c7 (patch) | |
tree | ce5a8a34f47703f5ee564945b906e9c3f9d684e2 /indra/llimage/llimagej2c.cpp | |
parent | 63f2ddf377fa0fc6a666cdc1001289335d86258b (diff) |
VWR-22761 : Rearchitecture of llmetricperformancetester and simple (non complete) implementation in llimagej2c
Diffstat (limited to 'indra/llimage/llimagej2c.cpp')
-rw-r--r-- | indra/llimage/llimagej2c.cpp | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/indra/llimage/llimagej2c.cpp b/indra/llimage/llimagej2c.cpp index c8c866b7f2..72aa253568 100644 --- a/indra/llimage/llimagej2c.cpp +++ b/indra/llimage/llimagej2c.cpp @@ -30,6 +30,7 @@ #include "lldir.h" #include "llimagej2c.h" #include "llmemtype.h" +#include "lltimer.h" typedef LLImageJ2CImpl* (*CreateLLImageJ2CFunction)(); typedef void (*DestroyLLImageJ2CFunction)(LLImageJ2CImpl*); @@ -51,6 +52,9 @@ LLImageJ2CImpl* fallbackCreateLLImageJ2CImpl(); void fallbackDestroyLLImageJ2CImpl(LLImageJ2CImpl* impl); const char* fallbackEngineInfoLLImageJ2CImpl(); +// Test data gathering handle +LLImageCompressionTester* LLImageJ2C::sTesterp = NULL ; + //static //Loads the required "create", "destroy" and "engineinfo" functions needed void LLImageJ2C::openDSO() @@ -195,6 +199,16 @@ LLImageJ2C::LLImageJ2C() : LLImageFormatted(IMG_CODEC_J2C), { // Array size is MAX_DISCARD_LEVEL+1 mDataSizes[i] = 0; } + + if (LLFastTimer::sMetricLog && !LLImageJ2C::sTesterp) + { + LLImageJ2C::sTesterp = new LLImageCompressionTester() ; + if (!LLImageJ2C::sTesterp->isValid()) + { + delete LLImageJ2C::sTesterp; + LLImageJ2C::sTesterp = NULL; + } + } } // virtual @@ -297,7 +311,12 @@ BOOL LLImageJ2C::decodeChannels(LLImageRaw *raw_imagep, F32 decode_time, S32 fir // Update the raw discard level updateRawDiscardLevel(); mDecoding = TRUE; + LLTimer elapsed; res = mImpl->decodeImpl(*this, *raw_imagep, decode_time, first_channel, max_channel_count); + if (LLImageJ2C::sTesterp) + { + LLImageJ2C::sTesterp->updateDecompressionStats(this->getDataSize(), raw_imagep->getDataSize(), elapsed.getElapsedTimeF32()) ; + } } if (res) @@ -540,3 +559,70 @@ void LLImageJ2C::updateRawDiscardLevel() LLImageJ2CImpl::~LLImageJ2CImpl() { } + +//---------------------------------------------------------------------------------------------- +// Start of LLImageCompressionTester +//---------------------------------------------------------------------------------------------- +LLImageCompressionTester::LLImageCompressionTester() : LLMetricPerformanceTesterBasic("ImageCompressionTester") +{ + addMetric("TotalBytesInDecompression"); + addMetric("TotalBytesOutDecompression"); + addMetric("TotalBytesInCompression"); + addMetric("TotalBytesOutCompression"); + + addMetric("TimeTimeDecompression"); + addMetric("TimeTimeCompression"); + + mTotalBytesInDecompression = 0; + mTotalBytesOutDecompression = 0; + mTotalBytesInCompression = 0; + mTotalBytesOutCompression = 0; + + + mTotalTimeDecompression = 0.0f; + mTotalTimeCompression = 0.0f; +} + +LLImageCompressionTester::~LLImageCompressionTester() +{ + LLImageJ2C::sTesterp = NULL; +} + +//virtual +void LLImageCompressionTester::outputTestRecord(LLSD *sd) +{ + std::string currentLabel = getCurrentLabelName(); + (*sd)[currentLabel]["TotalBytesInDecompression"] = (LLSD::Integer)mTotalBytesInDecompression; + (*sd)[currentLabel]["TotalBytesOutDecompression"] = (LLSD::Integer)mTotalBytesOutDecompression; + (*sd)[currentLabel]["TotalBytesInCompression"] = (LLSD::Integer)mTotalBytesInCompression; + (*sd)[currentLabel]["TotalBytesOutCompression"] = (LLSD::Integer)mTotalBytesOutCompression; + + (*sd)[currentLabel]["TimeTimeDecompression"] = (LLSD::Real)mTotalTimeDecompression; + (*sd)[currentLabel]["TimeTimeCompression"] = (LLSD::Real)mTotalTimeCompression; +} + +void LLImageCompressionTester::updateCompressionStats(const S32 bytesIn, const S32 bytesOut, const F32 deltaTime) +{ + mTotalBytesInCompression += bytesIn; + mTotalBytesOutCompression += bytesOut; + mTotalTimeCompression += deltaTime; +} + +void LLImageCompressionTester::updateDecompressionStats(const S32 bytesIn, const S32 bytesOut, const F32 deltaTime) +{ + mTotalBytesInDecompression += bytesIn; + mTotalBytesOutDecompression += bytesOut; + mTotalTimeDecompression += deltaTime; + if (mTotalBytesInDecompression > (5*1000000)) + { + outputTestResults(); + mTotalBytesInDecompression = 0; + mTotalBytesOutDecompression = 0; + mTotalTimeDecompression = 0.0f; + } +} + +//---------------------------------------------------------------------------------------------- +// End of LLTexturePipelineTester +//---------------------------------------------------------------------------------------------- + |