diff options
Diffstat (limited to 'indra/llimage')
-rw-r--r-- | indra/llimage/llimagej2c.cpp | 80 | ||||
-rw-r--r-- | indra/llimage/llimagej2c.h | 4 |
2 files changed, 60 insertions, 24 deletions
diff --git a/indra/llimage/llimagej2c.cpp b/indra/llimage/llimagej2c.cpp index 207728d4d9..08a5912c57 100644 --- a/indra/llimage/llimagej2c.cpp +++ b/indra/llimage/llimagej2c.cpp @@ -31,6 +31,7 @@ #include "llimagej2c.h" #include "llmemtype.h" #include "lltimer.h" +#include "llmath.h" typedef LLImageJ2CImpl* (*CreateLLImageJ2CFunction)(); typedef void (*DestroyLLImageJ2CFunction)(LLImageJ2CImpl*); @@ -54,6 +55,7 @@ const char* fallbackEngineInfoLLImageJ2CImpl(); // Test data gathering handle LLImageCompressionTester* LLImageJ2C::sTesterp = NULL ; +const std::string sTesterName("ImageCompressionTester"); //static //Loads the required "create", "destroy" and "engineinfo" functions needed @@ -200,7 +202,7 @@ LLImageJ2C::LLImageJ2C() : LLImageFormatted(IMG_CODEC_J2C), mDataSizes[i] = 0; } - if (LLFastTimer::sMetricLog && !LLImageJ2C::sTesterp) + if (LLFastTimer::sMetricLog && !LLImageJ2C::sTesterp && ((LLFastTimer::sLogName == sTesterName) || (LLFastTimer::sLogName == "metric"))) { LLImageJ2C::sTesterp = new LLImageCompressionTester() ; if (!LLImageJ2C::sTesterp->isValid()) @@ -590,16 +592,23 @@ LLImageJ2CImpl::~LLImageJ2CImpl() //---------------------------------------------------------------------------------------------- // Start of LLImageCompressionTester //---------------------------------------------------------------------------------------------- -LLImageCompressionTester::LLImageCompressionTester() : LLMetricPerformanceTesterBasic("ImageCompressionTester") +LLImageCompressionTester::LLImageCompressionTester() : LLMetricPerformanceTesterBasic(sTesterName) { + addMetric("TotalTimeDecompression"); addMetric("TotalBytesInDecompression"); addMetric("TotalBytesOutDecompression"); + addMetric("RateDecompression"); + addMetric("PerfDecompression"); + + addMetric("TotalTimeCompression"); addMetric("TotalBytesInCompression"); addMetric("TotalBytesOutCompression"); - - addMetric("TimeTimeDecompression"); - addMetric("TimeTimeCompression"); - + addMetric("RateCompression"); + addMetric("PerfCompression"); + + mRunBytesInDecompression = 0; + mRunBytesInCompression = 0; + mTotalBytesInDecompression = 0; mTotalBytesOutDecompression = 0; mTotalBytesInCompression = 0; @@ -618,13 +627,40 @@ LLImageCompressionTester::~LLImageCompressionTester() 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; + + F32 decompressionPerf = 0.0f; + F32 compressionPerf = 0.0f; + F32 decompressionRate = 0.0f; + F32 compressionRate = 0.0f; + + if (!is_approx_zero(mTotalTimeDecompression)) + { + decompressionPerf = (F32)(mTotalBytesInDecompression) / mTotalTimeDecompression; + } + if (mTotalBytesOutDecompression > 0) + { + decompressionRate = (F32)(mTotalBytesInDecompression) / (F32)(mTotalBytesOutDecompression); + } + if (!is_approx_zero(mTotalTimeCompression)) + { + compressionPerf = (F32)(mTotalBytesInCompression) / mTotalTimeCompression; + } + if (mTotalBytesOutCompression > 0) + { + compressionRate = (F32)(mTotalBytesInCompression) / (F32)(mTotalBytesOutCompression); + } + + (*sd)[currentLabel]["TotalTimeDecompression"] = (LLSD::Real)mTotalTimeDecompression; + (*sd)[currentLabel]["TotalBytesInDecompression"] = (LLSD::Integer)mTotalBytesInDecompression; + (*sd)[currentLabel]["TotalBytesOutDecompression"] = (LLSD::Integer)mTotalBytesOutDecompression; + (*sd)[currentLabel]["RateDecompression"] = (LLSD::Real)decompressionRate; + (*sd)[currentLabel]["PerfDecompression"] = (LLSD::Real)decompressionPerf; + + (*sd)[currentLabel]["TotalTimeCompression"] = (LLSD::Real)mTotalTimeCompression; + (*sd)[currentLabel]["TotalBytesInCompression"] = (LLSD::Integer)mTotalBytesInCompression; + (*sd)[currentLabel]["TotalBytesOutCompression"] = (LLSD::Integer)mTotalBytesOutCompression; + (*sd)[currentLabel]["RateCompression"] = (LLSD::Real)compressionRate; + (*sd)[currentLabel]["PerfCompression"] = (LLSD::Real)compressionPerf; } void LLImageCompressionTester::updateCompressionStats(const F32 deltaTime) @@ -635,15 +671,14 @@ void LLImageCompressionTester::updateCompressionStats(const F32 deltaTime) void LLImageCompressionTester::updateCompressionStats(const S32 bytesCompress, const S32 bytesRaw) { mTotalBytesInCompression += bytesRaw; + mRunBytesInCompression += bytesRaw; mTotalBytesOutCompression += bytesCompress; - if (mTotalBytesInCompression > (1000000)) + if (mRunBytesInCompression > (1000000)) { // Output everything outputTestResults(); - // Reset only the compression data - mTotalBytesInCompression = 0; - mTotalBytesOutCompression = 0; - mTotalTimeCompression = 0.0f; + // Reset the compression data of the run + mRunBytesInCompression = 0; } } @@ -655,15 +690,14 @@ void LLImageCompressionTester::updateDecompressionStats(const F32 deltaTime) void LLImageCompressionTester::updateDecompressionStats(const S32 bytesIn, const S32 bytesOut) { mTotalBytesInDecompression += bytesIn; + mRunBytesInDecompression += bytesIn; mTotalBytesOutDecompression += bytesOut; - if (mTotalBytesInDecompression > (5*1000000)) + if (mRunBytesInDecompression > (1000000)) { // Output everything outputTestResults(); - // Reset only the decompression data - mTotalBytesInDecompression = 0; - mTotalBytesOutDecompression = 0; - mTotalTimeDecompression = 0.0f; + // Reset the decompression data of the run + mRunBytesInDecompression = 0; } } diff --git a/indra/llimage/llimagej2c.h b/indra/llimage/llimagej2c.h index adbfb9cdb3..3933c9236f 100644 --- a/indra/llimage/llimagej2c.h +++ b/indra/llimage/llimagej2c.h @@ -127,7 +127,7 @@ protected: // // This class is used for performance data gathering only. // Tracks the image compression / decompression data, -// records and outputs them to metric.slp log files. +// records and outputs them to the log file. // class LLImageCompressionTester : public LLMetricPerformanceTesterBasic { @@ -151,6 +151,8 @@ class LLImageCompressionTester : public LLMetricPerformanceTesterBasic U32 mTotalBytesOutDecompression; // Total bytes produced by decompressor U32 mTotalBytesInCompression; // Total bytes fed to compressor U32 mTotalBytesOutCompression; // Total bytes produced by compressor + U32 mRunBytesInDecompression; // Bytes fed to decompressor in this run + U32 mRunBytesInCompression; // Bytes fed to compressor in this run // // Time // |