diff options
Diffstat (limited to 'indra')
-rw-r--r-- | indra/llcommon/CMakeLists.txt | 4 | ||||
-rw-r--r-- | indra/llcommon/llmetricperformancetester.cpp | 142 | ||||
-rw-r--r-- | indra/llcommon/llmetricperformancetester.h | 172 | ||||
-rw-r--r-- | indra/llimage/llimagej2c.cpp | 155 | ||||
-rw-r--r-- | indra/llimage/llimagej2c.h | 8 | ||||
-rw-r--r-- | indra/newview/llappviewer.cpp | 30 | ||||
-rw-r--r-- | indra/newview/llappviewer.h | 4 | ||||
-rw-r--r-- | indra/newview/llfasttimerview.cpp | 12 | ||||
-rw-r--r-- | indra/newview/llfasttimerview.h | 2 | ||||
-rw-r--r-- | indra/newview/llviewertexture.cpp | 40 | ||||
-rw-r--r-- | indra/newview/llviewertexture.h | 1 |
11 files changed, 292 insertions, 278 deletions
diff --git a/indra/llcommon/CMakeLists.txt b/indra/llcommon/CMakeLists.txt index a6f07f9600..478f2fedbd 100644 --- a/indra/llcommon/CMakeLists.txt +++ b/indra/llcommon/CMakeLists.txt @@ -55,7 +55,6 @@ set(llcommon_SOURCE_FILES llevents.cpp lleventtimer.cpp llfasttimer_class.cpp - llmetricperformancetester.cpp llfile.cpp llfindlocale.cpp llfixedbuffer.cpp @@ -71,6 +70,7 @@ set(llcommon_SOURCE_FILES llmemorystream.cpp llmemtype.cpp llmetrics.cpp + llmetricperformancetester.cpp llmortician.cpp lloptioninterface.cpp llptrto.cpp @@ -161,7 +161,6 @@ set(llcommon_HEADER_FILES llextendedstatus.h llfasttimer.h llfasttimer_class.h - llmetricperformancetester.h llfile.h llfindlocale.h llfixedbuffer.h @@ -188,6 +187,7 @@ set(llcommon_HEADER_FILES llmemorystream.h llmemtype.h llmetrics.h + llmetricperformancetester.h llmortician.h llnametable.h lloptioninterface.h diff --git a/indra/llcommon/llmetricperformancetester.cpp b/indra/llcommon/llmetricperformancetester.cpp index bd548f199a..2110192fbc 100644 --- a/indra/llcommon/llmetricperformancetester.cpp +++ b/indra/llcommon/llmetricperformancetester.cpp @@ -52,7 +52,7 @@ void LLMetricPerformanceTesterBasic::cleanClass() /*static*/ BOOL LLMetricPerformanceTesterBasic::addTester(LLMetricPerformanceTesterBasic* tester) { - llassert_always(tester != NULL); + llassert_always(tester != NULL); std::string name = tester->getTesterName() ; if (getTester(name)) { @@ -80,7 +80,7 @@ LLMetricPerformanceTesterBasic* LLMetricPerformanceTesterBasic::getTester(std::s //---------------------------------------------------------------------------------------------- LLMetricPerformanceTesterBasic::LLMetricPerformanceTesterBasic(std::string name) : - mName(name), + mName(name), mCount(0) { if (mName == std::string()) @@ -110,7 +110,7 @@ void LLMetricPerformanceTesterBasic::postOutputTestResults(LLSD* sd) void LLMetricPerformanceTesterBasic::outputTestResults() { LLSD sd; - + preOutputTestResults(&sd) ; outputTestRecord(&sd) ; postOutputTestResults(&sd) ; @@ -124,43 +124,43 @@ void LLMetricPerformanceTesterBasic::addMetric(std::string str) /*virtual*/ void LLMetricPerformanceTesterBasic::analyzePerformance(std::ofstream* os, LLSD* base, LLSD* current) { - resetCurrentCount() ; - - std::string currentLabel = getCurrentLabelName(); - BOOL in_base = (*base).has(currentLabel) ; - BOOL in_current = (*current).has(currentLabel) ; - - while(in_base || in_current) - { - LLSD::String label = currentLabel ; - - if(in_base && in_current) - { - *os << llformat("%s\n", label.c_str()) ; - - for(U32 index = 0 ; index < mMetricStrings.size() ; index++) - { - switch((*current)[label][ mMetricStrings[index] ].type()) - { - case LLSD::TypeInteger: - compareTestResults(os, mMetricStrings[index], - (S32)((*base)[label][ mMetricStrings[index] ].asInteger()), (S32)((*current)[label][ mMetricStrings[index] ].asInteger())) ; - break ; - case LLSD::TypeReal: - compareTestResults(os, mMetricStrings[index], - (F32)((*base)[label][ mMetricStrings[index] ].asReal()), (F32)((*current)[label][ mMetricStrings[index] ].asReal())) ; - break; - default: - llerrs << "unsupported metric " << mMetricStrings[index] << " LLSD type: " << (S32)(*current)[label][ mMetricStrings[index] ].type() << llendl ; - } - } - } - - incrementCurrentCount(); - currentLabel = getCurrentLabelName(); - in_base = (*base).has(currentLabel) ; - in_current = (*current).has(currentLabel) ; - } + resetCurrentCount() ; + + std::string currentLabel = getCurrentLabelName(); + BOOL in_base = (*base).has(currentLabel) ; + BOOL in_current = (*current).has(currentLabel) ; + + while(in_base || in_current) + { + LLSD::String label = currentLabel ; + + if(in_base && in_current) + { + *os << llformat("%s\n", label.c_str()) ; + + for(U32 index = 0 ; index < mMetricStrings.size() ; index++) + { + switch((*current)[label][ mMetricStrings[index] ].type()) + { + case LLSD::TypeInteger: + compareTestResults(os, mMetricStrings[index], + (S32)((*base)[label][ mMetricStrings[index] ].asInteger()), (S32)((*current)[label][ mMetricStrings[index] ].asInteger())) ; + break ; + case LLSD::TypeReal: + compareTestResults(os, mMetricStrings[index], + (F32)((*base)[label][ mMetricStrings[index] ].asReal()), (F32)((*current)[label][ mMetricStrings[index] ].asReal())) ; + break; + default: + llerrs << "unsupported metric " << mMetricStrings[index] << " LLSD type: " << (S32)(*current)[label][ mMetricStrings[index] ].type() << llendl ; + } + } + } + + incrementCurrentCount(); + currentLabel = getCurrentLabelName(); + in_base = (*base).has(currentLabel) ; + in_current = (*current).has(currentLabel) ; + } } /*virtual*/ @@ -182,12 +182,12 @@ void LLMetricPerformanceTesterBasic::compareTestResults(std::ofstream* os, std:: //---------------------------------------------------------------------------------------------- LLMetricPerformanceTesterWithSession::LLMetricPerformanceTesterWithSession(std::string name) : - LLMetricPerformanceTesterBasic(name), - mBaseSessionp(NULL), - mCurrentSessionp(NULL) + LLMetricPerformanceTesterBasic(name), + mBaseSessionp(NULL), + mCurrentSessionp(NULL) { } - + LLMetricPerformanceTesterWithSession::~LLMetricPerformanceTesterWithSession() { if (mBaseSessionp) @@ -205,33 +205,33 @@ LLMetricPerformanceTesterWithSession::~LLMetricPerformanceTesterWithSession() /*virtual*/ void LLMetricPerformanceTesterWithSession::analyzePerformance(std::ofstream* os, LLSD* base, LLSD* current) { - // Load the base session - resetCurrentCount() ; - mBaseSessionp = loadTestSession(base) ; - - // Load the current session - resetCurrentCount() ; - mCurrentSessionp = loadTestSession(current) ; - - if (!mBaseSessionp || !mCurrentSessionp) - { - llerrs << "Error loading test sessions." << llendl ; - } - - // Compare - compareTestSessions(os) ; - - // Release memory - if (mBaseSessionp) - { - delete mBaseSessionp ; - mBaseSessionp = NULL ; - } - if (mCurrentSessionp) - { - delete mCurrentSessionp ; - mCurrentSessionp = NULL ; - } + // Load the base session + resetCurrentCount() ; + mBaseSessionp = loadTestSession(base) ; + + // Load the current session + resetCurrentCount() ; + mCurrentSessionp = loadTestSession(current) ; + + if (!mBaseSessionp || !mCurrentSessionp) + { + llerrs << "Error loading test sessions." << llendl ; + } + + // Compare + compareTestSessions(os) ; + + // Release memory + if (mBaseSessionp) + { + delete mBaseSessionp ; + mBaseSessionp = NULL ; + } + if (mCurrentSessionp) + { + delete mCurrentSessionp ; + mCurrentSessionp = NULL ; + } } diff --git a/indra/llcommon/llmetricperformancetester.h b/indra/llcommon/llmetricperformancetester.h index 82d579b188..6fd1d41daa 100644 --- a/indra/llcommon/llmetricperformancetester.h +++ b/indra/llcommon/llmetricperformancetester.h @@ -35,114 +35,114 @@ class LL_COMMON_API LLMetricPerformanceTesterBasic { public: /** - * @brief Creates a basic tester instance. - * @param[in] name - Unique string identifying this tester instance. - */ + * @brief Creates a basic tester instance. + * @param[in] name - Unique string identifying this tester instance. + */ LLMetricPerformanceTesterBasic(std::string name); virtual ~LLMetricPerformanceTesterBasic(); /** - * @return Returns true if the instance has been added to the tester map. - * Need to be tested after creation of a tester instance so to know if the tester is correctly handled. - * A tester might not be added to the map if another tester with the same name already exists. - */ - BOOL isValid() const { return mValidInstance; } + * @return Returns true if the instance has been added to the tester map. + * Need to be tested after creation of a tester instance so to know if the tester is correctly handled. + * A tester might not be added to the map if another tester with the same name already exists. + */ + BOOL isValid() const { return mValidInstance; } /** - * @brief Write a set of test results to the log LLSD. - */ + * @brief Write a set of test results to the log LLSD. + */ void outputTestResults() ; - + /** - * @brief Compare the test results. - * By default, compares the test results against the baseline one by one, item by item, - * in the increasing order of the LLSD record counter, starting from the first one. - */ + * @brief Compare the test results. + * By default, compares the test results against the baseline one by one, item by item, + * in the increasing order of the LLSD record counter, starting from the first one. + */ virtual void analyzePerformance(std::ofstream* os, LLSD* base, LLSD* current) ; - + /** - * @return Returns the number of the test metrics in this tester instance. - */ + * @return Returns the number of the test metrics in this tester instance. + */ S32 getNumberOfMetrics() const { return mMetricStrings.size() ;} /** - * @return Returns the metric name at index - * @param[in] index - Index on the list of metrics managed by this tester instance. - */ + * @return Returns the metric name at index + * @param[in] index - Index on the list of metrics managed by this tester instance. + */ std::string getMetricName(S32 index) const { return mMetricStrings[index] ;} - + protected: /** - * @return Returns the name of this tester instance. - */ + * @return Returns the name of this tester instance. + */ std::string getTesterName() const { return mName ;} - + /** - * @brief Insert a new metric to be managed by this tester instance. - * @param[in] str - Unique string identifying the new metric. - */ + * @brief Insert a new metric to be managed by this tester instance. + * @param[in] str - Unique string identifying the new metric. + */ void addMetric(std::string str) ; /** - * @brief Compare test results, provided in 2 flavors: compare integers and compare floats. - * @param[out] os - Formatted output string holding the compared values. - * @param[in] metric_string - Name of the metric. - * @param[in] v_base - Base value of the metric. - * @param[in] v_current - Current value of the metric. - */ + * @brief Compare test results, provided in 2 flavors: compare integers and compare floats. + * @param[out] os - Formatted output string holding the compared values. + * @param[in] metric_string - Name of the metric. + * @param[in] v_base - Base value of the metric. + * @param[in] v_current - Current value of the metric. + */ virtual void compareTestResults(std::ofstream* os, std::string metric_string, S32 v_base, S32 v_current) ; virtual void compareTestResults(std::ofstream* os, std::string metric_string, F32 v_base, F32 v_current) ; - + /** - * @brief Reset internal record count. Count starts with 1. - */ + * @brief Reset internal record count. Count starts with 1. + */ void resetCurrentCount() { mCount = 1; } /** - * @brief Increment internal record count. - */ + * @brief Increment internal record count. + */ void incrementCurrentCount() { mCount++; } /** - * @return Returns the label to be used for the current count. It's "TesterName"-"Count". - */ - std::string getCurrentLabelName() const { return llformat("%s-%d", mName.c_str(), mCount) ;} - - /** - * @brief Write a test record to the LLSD. Implementers need to overload this method. - * @param[out] sd - The LLSD record to store metric data into. - */ + * @return Returns the label to be used for the current count. It's "TesterName"-"Count". + */ + std::string getCurrentLabelName() const { return llformat("%s-%d", mName.c_str(), mCount) ;} + + /** + * @brief Write a test record to the LLSD. Implementers need to overload this method. + * @param[out] sd - The LLSD record to store metric data into. + */ virtual void outputTestRecord(LLSD* sd) = 0 ; private: void preOutputTestResults(LLSD* sd) ; void postOutputTestResults(LLSD* sd) ; - std::string mName ; // Name of this tester instance - S32 mCount ; // Current record count - BOOL mValidInstance; // TRUE if the instance is managed by the map + std::string mName ; // Name of this tester instance + S32 mCount ; // Current record count + BOOL mValidInstance; // TRUE if the instance is managed by the map std::vector< std::string > mMetricStrings ; // Metrics strings // Static members managing the collection of testers public: - // Map of all the tester instances in use + // Map of all the tester instances in use typedef std::map< std::string, LLMetricPerformanceTesterBasic* > name_tester_map_t; static name_tester_map_t sTesterMap ; /** - * @return Returns a pointer to the tester - * @param[in] name - Name of the tester instance queried. - */ + * @return Returns a pointer to the tester + * @param[in] name - Name of the tester instance queried. + */ static LLMetricPerformanceTesterBasic* getTester(std::string name) ; /** - * @return Returns TRUE if there's a tester defined, FALSE otherwise. - */ + * @return Returns TRUE if there's a tester defined, FALSE otherwise. + */ static BOOL hasMetricPerformanceTesters() { return !sTesterMap.empty() ;} /** - * @brief Delete all testers and reset the tester map - */ + * @brief Delete all testers and reset the tester map + */ static void cleanClass() ; private: - // Add a tester to the map. Returns false if adding fails. - static BOOL addTester(LLMetricPerformanceTesterBasic* tester) ; + // Add a tester to the map. Returns false if adding fails. + static BOOL addTester(LLMetricPerformanceTesterBasic* tester) ; }; /** @@ -153,42 +153,42 @@ class LL_COMMON_API LLMetricPerformanceTesterWithSession : public LLMetricPerfor { public: /** - * @param[in] name - Unique string identifying this tester instance. - */ + * @param[in] name - Unique string identifying this tester instance. + */ LLMetricPerformanceTesterWithSession(std::string name); virtual ~LLMetricPerformanceTesterWithSession(); /** - * @brief Compare the test results. - * This will be loading the base and current sessions and compare them using the virtual - * abstract methods loadTestSession() and compareTestSessions() - */ + * @brief Compare the test results. + * This will be loading the base and current sessions and compare them using the virtual + * abstract methods loadTestSession() and compareTestSessions() + */ virtual void analyzePerformance(std::ofstream* os, LLSD* base, LLSD* current) ; protected: - /** - * @class LLMetricPerformanceTesterWithSession::LLTestSession - * @brief Defines an interface for the two abstract virtual functions loadTestSession() and compareTestSessions() - */ - class LLTestSession - { - public: - virtual ~LLTestSession() ; - }; - - /** - * @brief Convert an LLSD log into a test session. - * @param[in] log - The LLSD record - * @return Returns the record as a test session - */ + /** + * @class LLMetricPerformanceTesterWithSession::LLTestSession + * @brief Defines an interface for the two abstract virtual functions loadTestSession() and compareTestSessions() + */ + class LL_COMMON_API LLTestSession + { + public: + virtual ~LLTestSession() ; + }; + + /** + * @brief Convert an LLSD log into a test session. + * @param[in] log - The LLSD record + * @return Returns the record as a test session + */ virtual LLMetricPerformanceTesterWithSession::LLTestSession* loadTestSession(LLSD* log) = 0; - + /** - * @brief Compare the base session and the target session. Assumes base and current sessions have been loaded. - * @param[out] os - The comparison result as a standard stream - */ + * @brief Compare the base session and the target session. Assumes base and current sessions have been loaded. + * @param[out] os - The comparison result as a standard stream + */ virtual void compareTestSessions(std::ofstream* os) = 0; - + LLTestSession* mBaseSessionp; LLTestSession* mCurrentSessionp; }; diff --git a/indra/llimage/llimagej2c.cpp b/indra/llimage/llimagej2c.cpp index 22610817e4..9173a331b3 100644 --- a/indra/llimage/llimagej2c.cpp +++ b/indra/llimage/llimagej2c.cpp @@ -77,8 +77,8 @@ void LLImageJ2C::openDSO() #endif dso_path = gDirUtilp->findFile(dso_name, - gDirUtilp->getAppRODataDir(), - gDirUtilp->getExecutableDir()); + gDirUtilp->getAppRODataDir(), + gDirUtilp->getExecutableDir()); j2cimpl_dso_handle = NULL; j2cimpl_dso_memory_pool = NULL; @@ -108,7 +108,7 @@ void LLImageJ2C::openDSO() //so lets check for a destruction function rv = apr_dso_sym((apr_dso_handle_sym_t*)&dest_func, j2cimpl_dso_handle, - "destroyLLImageJ2CKDU"); + "destroyLLImageJ2CKDU"); if ( rv == APR_SUCCESS ) { //we've loaded the destroy function ok @@ -174,6 +174,12 @@ std::string LLImageJ2C::getEngineInfo() return j2cimpl_engineinfo_func(); } +//static +bool LLImageJ2C::perfStatsEnabled() +{ + return (sTesterp != NULL); +} + LLImageJ2C::LLImageJ2C() : LLImageFormatted(IMG_CODEC_J2C), mMaxBytes(0), mRawDiscardLevel(-1), @@ -202,14 +208,14 @@ LLImageJ2C::LLImageJ2C() : LLImageFormatted(IMG_CODEC_J2C), mDataSizes[i] = 0; } - if (LLFastTimer::sMetricLog && !LLImageJ2C::sTesterp && ((LLFastTimer::sLogName == sTesterName) || (LLFastTimer::sLogName == "metric"))) + if (LLFastTimer::sMetricLog && !perfStatsEnabled() && ((LLFastTimer::sLogName == sTesterName) || (LLFastTimer::sLogName == "metric"))) { - LLImageJ2C::sTesterp = new LLImageCompressionTester() ; - if (!LLImageJ2C::sTesterp->isValid()) - { - delete LLImageJ2C::sTesterp; - LLImageJ2C::sTesterp = NULL; - } + sTesterp = new LLImageCompressionTester() ; + if (!sTesterp->isValid()) + { + delete sTesterp; + sTesterp = NULL; + } } } @@ -296,7 +302,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; + LLTimer elapsed; LLMemType mt1(mMemType); BOOL res = TRUE; @@ -335,19 +341,19 @@ 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()) ; - } - } + if (perfStatsEnabled()) + { + // Decompression stat gathering + // Note that we *do not* take into account the decompression failures data so we might overestimate the time spent processing + + // Always add the decompression time to the stat + sTesterp->updateDecompressionStats(elapsed.getElapsedTimeF32()) ; + if (res) + { + // The whole data stream is finally decompressed when res is returned as TRUE + sTesterp->updateDecompressionStats(this->getDataSize(), raw_imagep->getDataSize()) ; + } + } return res; } @@ -361,7 +367,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; + LLTimer elapsed; LLMemType mt1(mMemType); resetLastError(); BOOL res = mImpl->encodeImpl(*this, *raw_imagep, comment_text, encode_time, mReversible); @@ -370,21 +376,20 @@ 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()) ; - } - } - - + if (perfStatsEnabled()) + { + // 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 + sTesterp->updateCompressionStats(elapsed.getElapsedTimeF32()) ; + if (res) + { + // The whole data stream is finally compressed when res is returned as TRUE + sTesterp->updateCompressionStats(this->getDataSize(), raw_imagep->getDataSize()) ; + } + } + return res; } @@ -607,15 +612,15 @@ LLImageCompressionTester::LLImageCompressionTester() : LLMetricPerformanceTester addMetric("Perf Compression (kB/s)"); mRunBytesInDecompression = 0; - mRunBytesInCompression = 0; + mRunBytesInCompression = 0; - mTotalBytesInDecompression = 0; - mTotalBytesOutDecompression = 0; - mTotalBytesInCompression = 0; - mTotalBytesOutCompression = 0; + mTotalBytesInDecompression = 0; + mTotalBytesOutDecompression = 0; + mTotalBytesInCompression = 0; + mTotalBytesOutCompression = 0; - mTotalTimeDecompression = 0.0f; - mTotalTimeCompression = 0.0f; + mTotalTimeDecompression = 0.0f; + mTotalTimeCompression = 0.0f; } LLImageCompressionTester::~LLImageCompressionTester() @@ -626,13 +631,13 @@ LLImageCompressionTester::~LLImageCompressionTester() //virtual void LLImageCompressionTester::outputTestRecord(LLSD *sd) { - std::string currentLabel = getCurrentLabelName(); - + std::string currentLabel = getCurrentLabelName(); + F32 decompressionPerf = 0.0f; F32 compressionPerf = 0.0f; F32 decompressionRate = 0.0f; F32 compressionRate = 0.0f; - + F32 totalkBInDecompression = (F32)(mTotalBytesInDecompression) / 1000.0; F32 totalkBOutDecompression = (F32)(mTotalBytesOutDecompression) / 1000.0; F32 totalkBInCompression = (F32)(mTotalBytesInCompression) / 1000.0; @@ -654,56 +659,56 @@ void LLImageCompressionTester::outputTestRecord(LLSD *sd) { compressionRate = totalkBInCompression / totalkBOutCompression; } - + (*sd)[currentLabel]["Time Decompression (s)"] = (LLSD::Real)mTotalTimeDecompression; (*sd)[currentLabel]["Volume In Decompression (kB)"] = (LLSD::Real)totalkBInDecompression; (*sd)[currentLabel]["Volume Out Decompression (kB)"]= (LLSD::Real)totalkBOutDecompression; (*sd)[currentLabel]["Decompression Ratio (x:1)"] = (LLSD::Real)decompressionRate; (*sd)[currentLabel]["Perf Decompression (kB/s)"] = (LLSD::Real)decompressionPerf; - + (*sd)[currentLabel]["Time Compression (s)"] = (LLSD::Real)mTotalTimeCompression; (*sd)[currentLabel]["Volume In Compression (kB)"] = (LLSD::Real)totalkBInCompression; (*sd)[currentLabel]["Volume Out Compression (kB)"] = (LLSD::Real)totalkBOutCompression; - (*sd)[currentLabel]["Compression Ratio (x:1)"] = (LLSD::Real)compressionRate; + (*sd)[currentLabel]["Compression Ratio (x:1)"] = (LLSD::Real)compressionRate; (*sd)[currentLabel]["Perf Compression (kB/s)"] = (LLSD::Real)compressionPerf; } void LLImageCompressionTester::updateCompressionStats(const F32 deltaTime) { - mTotalTimeCompression += deltaTime; + mTotalTimeCompression += deltaTime; } void LLImageCompressionTester::updateCompressionStats(const S32 bytesCompress, const S32 bytesRaw) { - mTotalBytesInCompression += bytesRaw; - mRunBytesInCompression += bytesRaw; - mTotalBytesOutCompression += bytesCompress; - if (mRunBytesInCompression > (1000000)) - { - // Output everything - outputTestResults(); - // Reset the compression data of the run - mRunBytesInCompression = 0; - } + mTotalBytesInCompression += bytesRaw; + mRunBytesInCompression += bytesRaw; + mTotalBytesOutCompression += bytesCompress; + if (mRunBytesInCompression > (1000000)) + { + // Output everything + outputTestResults(); + // Reset the compression data of the run + mRunBytesInCompression = 0; + } } void LLImageCompressionTester::updateDecompressionStats(const F32 deltaTime) { - mTotalTimeDecompression += deltaTime; + mTotalTimeDecompression += deltaTime; } void LLImageCompressionTester::updateDecompressionStats(const S32 bytesIn, const S32 bytesOut) { - mTotalBytesInDecompression += bytesIn; - mRunBytesInDecompression += bytesIn; - mTotalBytesOutDecompression += bytesOut; - if (mRunBytesInDecompression > (1000000)) - { - // Output everything - outputTestResults(); - // Reset the decompression data of the run - mRunBytesInDecompression = 0; - } + mTotalBytesInDecompression += bytesIn; + mRunBytesInDecompression += bytesIn; + mTotalBytesOutDecompression += bytesOut; + if (mRunBytesInDecompression > (1000000)) + { + // Output everything + outputTestResults(); + // Reset the decompression data of the run + mRunBytesInDecompression = 0; + } } //---------------------------------------------------------------------------------------------- diff --git a/indra/llimage/llimagej2c.h b/indra/llimage/llimagej2c.h index 3933c9236f..7333f0370f 100644 --- a/indra/llimage/llimagej2c.h +++ b/indra/llimage/llimagej2c.h @@ -76,13 +76,11 @@ public: static void closeDSO(); static std::string getEngineInfo(); - // Image compression/decompression tester - static LLImageCompressionTester* sTesterp ; - protected: friend class LLImageJ2CImpl; friend class LLImageJ2COJ; friend class LLImageJ2CKDU; + friend class LLImageCompressionTester; void decodeFailed(); void updateRawDiscardLevel(); @@ -96,6 +94,10 @@ protected: BOOL mReversible; LLImageJ2CImpl *mImpl; std::string mLastError; + + // Image compression/decompression tester + static LLImageCompressionTester* sTesterp; + static bool perfStatsEnabled(); }; // Derive from this class to implement JPEG2000 decoding diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 6db9807861..5b69fd80af 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -510,10 +510,10 @@ class LLFastTimerLogThread : public LLThread public: std::string mFile; - LLFastTimerLogThread(std::string& testName) : LLThread("fast timer log") + LLFastTimerLogThread(std::string& test_name) : LLThread("fast timer log") { - std::string fileName = testName + std::string(".slp"); - mFile = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, fileName); + std::string file_name = test_name + std::string(".slp"); + mFile = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, file_name); } void run() @@ -1303,7 +1303,7 @@ bool LLAppViewer::cleanup() { // workaround for DEV-35406 crash on shutdown LLEventPumps::instance().reset(); - + // remove any old breakpad minidump files from the log directory if (! isError()) { @@ -1641,7 +1641,7 @@ bool LLAppViewer::cleanup() std::string baselineName = LLFastTimer::sLogName + "_baseline.slp"; std::string currentName = LLFastTimer::sLogName + ".slp"; std::string reportName = LLFastTimer::sLogName + "_report.csv"; - + LLFastTimerView::doAnalysis( gDirUtilp->getExpandedFilename(LL_PATH_LOGS, baselineName), gDirUtilp->getExpandedFilename(LL_PATH_LOGS, currentName), @@ -2113,16 +2113,16 @@ bool LLAppViewer::initConfiguration() LLFastTimer::sMetricLog = TRUE ; // '--logmetrics' can be specified with a named test metric argument so the data gathering is done only on that test // In the absence of argument, every metric is gathered (makes for a rather slow run and hard to decipher report...) - std::string testName = clp.getOption("logmetrics")[0]; - llinfos << "'--logmetrics' argument : " << testName << llendl; - if (testName == "") - { - llwarns << "No '--logmetrics' argument given, will output all metrics." << llendl; + std::string test_name = clp.getOption("logmetrics")[0]; + llinfos << "'--logmetrics' argument : " << test_name << llendl; + if (test_name == "") + { + llwarns << "No '--logmetrics' argument given, will output all metrics." << llendl; LLFastTimer::sLogName = std::string("metric"); - } - else - { - LLFastTimer::sLogName = testName; + } + else + { + LLFastTimer::sLogName = test_name; } } @@ -2164,7 +2164,7 @@ bool LLAppViewer::initConfiguration() { LLFastTimerView::sAnalyzePerformance = TRUE; } - + if (clp.hasOption("replaysession")) { LLAgentPilot::sReplaySession = TRUE; diff --git a/indra/newview/llappviewer.h b/indra/newview/llappviewer.h index 3bdc6325c1..a14ab4362f 100644 --- a/indra/newview/llappviewer.h +++ b/indra/newview/llappviewer.h @@ -167,7 +167,7 @@ public: // mute/unmute the system's master audio virtual void setMasterSystemAudioMute(bool mute); virtual bool getMasterSystemAudioMute(); - + protected: virtual bool initWindow(); // Initialize the viewer's window. virtual bool initLogging(); // Initialize log files, logging system, return false on failure. @@ -253,7 +253,7 @@ private: // For performance and metric gathering LLThread* mFastTimerLogThread; - + // for tracking viewer<->region circuit death bool mAgentRegionLastAlive; LLUUID mAgentRegionLastID; diff --git a/indra/newview/llfasttimerview.cpp b/indra/newview/llfasttimerview.cpp index 5b6a25a041..92a3b9b2f5 100644 --- a/indra/newview/llfasttimerview.cpp +++ b/indra/newview/llfasttimerview.cpp @@ -1184,12 +1184,12 @@ void LLFastTimerView::outputAllMetrics() { if (LLMetricPerformanceTesterBasic::hasMetricPerformanceTesters()) { - for (LLMetricPerformanceTesterBasic::name_tester_map_t::iterator iter = LLMetricPerformanceTesterBasic::sTesterMap.begin(); - iter != LLMetricPerformanceTesterBasic::sTesterMap.end(); ++iter) - { - LLMetricPerformanceTesterBasic* tester = ((LLMetricPerformanceTesterBasic*)iter->second); - tester->outputTestResults(); - } + for (LLMetricPerformanceTesterBasic::name_tester_map_t::iterator iter = LLMetricPerformanceTesterBasic::sTesterMap.begin(); + iter != LLMetricPerformanceTesterBasic::sTesterMap.end(); ++iter) + { + LLMetricPerformanceTesterBasic* tester = ((LLMetricPerformanceTesterBasic*)iter->second); + tester->outputTestResults(); + } } } diff --git a/indra/newview/llfasttimerview.h b/indra/newview/llfasttimerview.h index 1d844454c8..1a54a53f09 100644 --- a/indra/newview/llfasttimerview.h +++ b/indra/newview/llfasttimerview.h @@ -37,7 +37,7 @@ public: static BOOL sAnalyzePerformance; - static void outputAllMetrics(); + static void outputAllMetrics(); static void doAnalysis(std::string baseline, std::string target, std::string output); private: diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index aba52cda4f..2b27f308df 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -288,6 +288,12 @@ LLViewerFetchedTexture* LLViewerTextureManager::getFetchedTextureFromUrl(const s return gTextureList.getImageFromUrl(url, usemipmaps, boost_priority, texture_type, internal_format, primary_format, force_id) ; } +//static +bool LLViewerTextureManager::perfStatsEnabled() +{ + return (sTesterp != NULL); +} + LLViewerFetchedTexture* LLViewerTextureManager::getFetchedTextureFromHost(const LLUUID& image_id, LLHost host) { return gTextureList.getImageFromHost(image_id, host) ; @@ -342,14 +348,14 @@ void LLViewerTextureManager::init() LLViewerTexture::initClass() ; - if (LLFastTimer::sMetricLog && !LLViewerTextureManager::sTesterp && ((LLFastTimer::sLogName == sTesterName) || (LLFastTimer::sLogName == "metric"))) + if (LLFastTimer::sMetricLog && !perfStatsEnabled() && ((LLFastTimer::sLogName == sTesterName) || (LLFastTimer::sLogName == "metric"))) { - LLViewerTextureManager::sTesterp = new LLTexturePipelineTester() ; - if (!LLViewerTextureManager::sTesterp->isValid()) - { - delete LLViewerTextureManager::sTesterp; - LLViewerTextureManager::sTesterp = NULL; - } + sTesterp = new LLTexturePipelineTester() ; + if (!sTesterp->isValid()) + { + delete sTesterp; + sTesterp = NULL; + } } } @@ -414,7 +420,7 @@ void LLViewerTexture::updateClass(const F32 velocity, const F32 angular_velocity { sCurrentTime = gFrameTimeSeconds ; - if(LLViewerTextureManager::sTesterp) + if (LLViewerTextureManager::perfStatsEnabled()) { LLViewerTextureManager::sTesterp->update() ; } @@ -609,7 +615,7 @@ bool LLViewerTexture::bindDefaultImage(S32 stage) //check if there is cached raw image and switch to it if possible switchToCachedImage() ; - if(LLViewerTextureManager::sTesterp) + if (LLViewerTextureManager::perfStatsEnabled()) { LLViewerTextureManager::sTesterp->updateGrayTextureBinding() ; } @@ -1072,7 +1078,7 @@ BOOL LLViewerTexture::isLargeImage() //virtual void LLViewerTexture::updateBindStatsForTester() { - if(LLViewerTextureManager::sTesterp) + if (LLViewerTextureManager::perfStatsEnabled()) { LLViewerTextureManager::sTesterp->updateTextureBindingStats(this) ; } @@ -1855,7 +1861,7 @@ bool LLViewerFetchedTexture::updateFetch() // We may have data ready regardless of whether or not we are finished (e.g. waiting on write) if (mRawImage.notNull()) { - if(LLViewerTextureManager::sTesterp) + if (LLViewerTextureManager::perfStatsEnabled()) { mIsFetched = TRUE ; LLViewerTextureManager::sTesterp->updateTextureLoadingStats(this, mRawImage, LLAppViewer::getTextureFetch()->isFromLocalCache(mID)) ; @@ -3082,7 +3088,7 @@ void LLViewerLODTexture::scaleDown() { switchToCachedImage() ; - if(LLViewerTextureManager::sTesterp) + if (LLViewerTextureManager::perfStatsEnabled()) { LLViewerTextureManager::sTesterp->setStablizingTime() ; } @@ -3621,7 +3627,7 @@ LLTexturePipelineTester::LLTexturePipelineTester() : LLMetricPerformanceTesterWi LLTexturePipelineTester::~LLTexturePipelineTester() { - LLViewerTextureManager::sTesterp = NULL ; + LLViewerTextureManager::sTesterp = NULL; } void LLTexturePipelineTester::update() @@ -3687,7 +3693,7 @@ void LLTexturePipelineTester::reset() //virtual void LLTexturePipelineTester::outputTestRecord(LLSD *sd) { - std::string currentLabel = getCurrentLabelName(); + std::string currentLabel = getCurrentLabelName(); (*sd)[currentLabel]["TotalBytesLoaded"] = (LLSD::Integer)mTotalBytesLoaded ; (*sd)[currentLabel]["TotalBytesLoadedFromCache"] = (LLSD::Integer)mTotalBytesLoadedFromCache ; (*sd)[currentLabel]["TotalBytesLoadedForLargeImage"] = (LLSD::Integer)mTotalBytesLoadedForLargeImage ; @@ -3874,7 +3880,7 @@ LLMetricPerformanceTesterWithSession::LLTestSession* LLTexturePipelineTester::lo sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mTime = 0.f ; //load a session - std::string currentLabel = getCurrentLabelName(); + std::string currentLabel = getCurrentLabelName(); BOOL in_log = (*log).has(currentLabel) ; while (in_log) { @@ -3945,9 +3951,9 @@ LLMetricPerformanceTesterWithSession::LLTestSession* LLTexturePipelineTester::lo sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mAveragePercentageBytesUsedPerSecond = 0.f ; sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mTime = 0.f ; } - // Next label + // Next label incrementCurrentCount() ; - currentLabel = getCurrentLabelName(); + currentLabel = getCurrentLabelName(); in_log = (*log).has(currentLabel) ; } diff --git a/indra/newview/llviewertexture.h b/indra/newview/llviewertexture.h index b5636bbdc7..88d449e061 100644 --- a/indra/newview/llviewertexture.h +++ b/indra/newview/llviewertexture.h @@ -676,6 +676,7 @@ private: public: //texture pipeline tester static LLTexturePipelineTester* sTesterp ; + static bool perfStatsEnabled(); //returns NULL if tex is not a LLViewerFetchedTexture nor derived from LLViewerFetchedTexture. static LLViewerFetchedTexture* staticCastToFetchedTexture(LLTexture* tex, BOOL report_error = FALSE) ; |