summaryrefslogtreecommitdiff
path: root/indra/llimage/llimagej2c.cpp
diff options
context:
space:
mode:
authorMerov Linden <merov@lindenlab.com>2010-09-17 19:17:12 -0700
committerMerov Linden <merov@lindenlab.com>2010-09-17 19:17:12 -0700
commit88e33d00cd189aec6ef9b5aa481d4d9a2777b1fb (patch)
tree75cc642383dcb84862f0794efcd80f2de915c4cc /indra/llimage/llimagej2c.cpp
parent8ada6ed3cf562d33cc66f2a5d664b5e1f40e1f0c (diff)
STORM-105 : Add compression data gathering, took partial decompression into account in stats
Diffstat (limited to 'indra/llimage/llimagej2c.cpp')
-rw-r--r--indra/llimage/llimagej2c.cpp67
1 files changed, 56 insertions, 11 deletions
diff --git a/indra/llimage/llimagej2c.cpp b/indra/llimage/llimagej2c.cpp
index 72aa253568..207728d4d9 100644
--- a/indra/llimage/llimagej2c.cpp
+++ b/indra/llimage/llimagej2c.cpp
@@ -294,6 +294,7 @@ BOOL LLImageJ2C::decode(LLImageRaw *raw_imagep, F32 decode_time)
// Returns TRUE to mean done, whether successful or not.
BOOL LLImageJ2C::decodeChannels(LLImageRaw *raw_imagep, F32 decode_time, S32 first_channel, S32 max_channel_count )
{
+ LLTimer elapsed;
LLMemType mt1(mMemType);
BOOL res = TRUE;
@@ -311,12 +312,7 @@ 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)
@@ -337,6 +333,20 @@ BOOL LLImageJ2C::decodeChannels(LLImageRaw *raw_imagep, F32 decode_time, S32 fir
LLImage::setLastError(mLastError);
}
+ if (LLImageJ2C::sTesterp)
+ {
+ // Decompression stat gathering
+ // Note that we *do not* take into account the decompression failures data so we night overestimate the time spent processing
+
+ // Always add the decompression time to the stat
+ LLImageJ2C::sTesterp->updateDecompressionStats(elapsed.getElapsedTimeF32()) ;
+ if (res)
+ {
+ // The whole data stream is finally decompressed when res is returned as TRUE
+ LLImageJ2C::sTesterp->updateDecompressionStats(this->getDataSize(), raw_imagep->getDataSize()) ;
+ }
+ }
+
return res;
}
@@ -349,6 +359,7 @@ BOOL LLImageJ2C::encode(const LLImageRaw *raw_imagep, F32 encode_time)
BOOL LLImageJ2C::encode(const LLImageRaw *raw_imagep, const char* comment_text, F32 encode_time)
{
+ LLTimer elapsed;
LLMemType mt1(mMemType);
resetLastError();
BOOL res = mImpl->encodeImpl(*this, *raw_imagep, comment_text, encode_time, mReversible);
@@ -356,6 +367,22 @@ BOOL LLImageJ2C::encode(const LLImageRaw *raw_imagep, const char* comment_text,
{
LLImage::setLastError(mLastError);
}
+
+ if (LLImageJ2C::sTesterp)
+ {
+ // Compression stat gathering
+ // Note that we *do not* take into account the compression failures cases so we night overestimate the time spent processing
+
+ // Always add the compression time to the stat
+ LLImageJ2C::sTesterp->updateCompressionStats(elapsed.getElapsedTimeF32()) ;
+ if (res)
+ {
+ // The whole data stream is finally compressed when res is returned as TRUE
+ LLImageJ2C::sTesterp->updateCompressionStats(this->getDataSize(), raw_imagep->getDataSize()) ;
+ }
+ }
+
+
return res;
}
@@ -578,7 +605,6 @@ LLImageCompressionTester::LLImageCompressionTester() : LLMetricPerformanceTester
mTotalBytesInCompression = 0;
mTotalBytesOutCompression = 0;
-
mTotalTimeDecompression = 0.0f;
mTotalTimeCompression = 0.0f;
}
@@ -601,21 +627,40 @@ void LLImageCompressionTester::outputTestRecord(LLSD *sd)
(*sd)[currentLabel]["TimeTimeCompression"] = (LLSD::Real)mTotalTimeCompression;
}
-void LLImageCompressionTester::updateCompressionStats(const S32 bytesIn, const S32 bytesOut, const F32 deltaTime)
+void LLImageCompressionTester::updateCompressionStats(const F32 deltaTime)
{
- mTotalBytesInCompression += bytesIn;
- mTotalBytesOutCompression += bytesOut;
mTotalTimeCompression += deltaTime;
}
-void LLImageCompressionTester::updateDecompressionStats(const S32 bytesIn, const S32 bytesOut, const F32 deltaTime)
+void LLImageCompressionTester::updateCompressionStats(const S32 bytesCompress, const S32 bytesRaw)
+{
+ mTotalBytesInCompression += bytesRaw;
+ mTotalBytesOutCompression += bytesCompress;
+ if (mTotalBytesInCompression > (1000000))
+ {
+ // Output everything
+ outputTestResults();
+ // Reset only the compression data
+ mTotalBytesInCompression = 0;
+ mTotalBytesOutCompression = 0;
+ mTotalTimeCompression = 0.0f;
+ }
+}
+
+void LLImageCompressionTester::updateDecompressionStats(const F32 deltaTime)
+{
+ mTotalTimeDecompression += deltaTime;
+}
+
+void LLImageCompressionTester::updateDecompressionStats(const S32 bytesIn, const S32 bytesOut)
{
mTotalBytesInDecompression += bytesIn;
mTotalBytesOutDecompression += bytesOut;
- mTotalTimeDecompression += deltaTime;
if (mTotalBytesInDecompression > (5*1000000))
{
+ // Output everything
outputTestResults();
+ // Reset only the decompression data
mTotalBytesInDecompression = 0;
mTotalBytesOutDecompression = 0;
mTotalTimeDecompression = 0.0f;