From 40979589afc5c91cab977307a1e400315b1c8a8f Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Wed, 27 Oct 2010 23:15:22 -0700 Subject: STORM-105 : improve decompression perf gathering, allow perf name to be passed on the command line, fix crash in analysis phase --- indra/llimage/llimagej2c.cpp | 80 +++++++++++++++++++++++++++++++------------- 1 file changed, 57 insertions(+), 23 deletions(-) (limited to 'indra/llimage/llimagej2c.cpp') 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; } } -- cgit v1.2.3