summaryrefslogtreecommitdiff
path: root/indra/newview/llviewerstatsrecorder.cpp
diff options
context:
space:
mode:
authorAndrey Lihatskiy <alihatskiy@productengine.com>2024-05-15 11:16:27 +0300
committerAndrey Lihatskiy <alihatskiy@productengine.com>2024-05-15 11:16:27 +0300
commitbccc10db9a90d365c353baebf443fde2030ce970 (patch)
tree2c2e1fd94b29667a809f8d7285d049f5ff5d424d /indra/newview/llviewerstatsrecorder.cpp
parent531cd34f670170ade57f8813fe48012b61a1d3c2 (diff)
parentbb3c36f5cbc0c3b542045fd27255eee24e03da22 (diff)
Merge branch 'main' into marchcat/x-b-merge
# Conflicts: # autobuild.xml # indra/cmake/ConfigurePkgConfig.cmake # indra/cmake/ICU4C.cmake # indra/media_plugins/gstreamer010/llmediaimplgstreamer_syms.cpp # indra/media_plugins/gstreamer010/llmediaimplgstreamer_syms.h # indra/media_plugins/gstreamer010/llmediaimplgstreamertriviallogging.h # indra/media_plugins/gstreamer010/llmediaimplgstreamervidplug.cpp # indra/media_plugins/gstreamer010/llmediaimplgstreamervidplug.h # indra/media_plugins/gstreamer010/media_plugin_gstreamer010.cpp # indra/newview/llappviewerlinux_api.h # indra/newview/llappviewerlinux_api_dbus.cpp # indra/newview/llappviewerlinux_api_dbus.h # indra/newview/llfloateremojipicker.cpp # indra/newview/lloutfitslist.cpp
Diffstat (limited to 'indra/newview/llviewerstatsrecorder.cpp')
-rw-r--r--indra/newview/llviewerstatsrecorder.cpp304
1 files changed, 152 insertions, 152 deletions
diff --git a/indra/newview/llviewerstatsrecorder.cpp b/indra/newview/llviewerstatsrecorder.cpp
index aa55c9791e..2e4002479d 100644
--- a/indra/newview/llviewerstatsrecorder.cpp
+++ b/indra/newview/llviewerstatsrecorder.cpp
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2010&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -38,47 +38,47 @@ extern LLControlGroup gSavedSettings;
LLViewerStatsRecorder* LLViewerStatsRecorder::sInstance = NULL;
LLViewerStatsRecorder::LLViewerStatsRecorder() :
- mStatsFile(NULL),
- mTimer(),
- mFileOpenTime(0.0),
- mLastSnapshotTime(0.0),
+ mStatsFile(NULL),
+ mTimer(),
+ mFileOpenTime(0.0),
+ mLastSnapshotTime(0.0),
mEnableStatsRecording(false),
mEnableStatsLogging(false),
mInterval(0.2),
mMaxDuration(300.f),
mSkipSaveIfZeros(false)
{
- if (NULL != sInstance)
- {
- LL_ERRS() << "Attempted to create multiple instances of LLViewerStatsRecorder!" << LL_ENDL;
- }
- sInstance = this;
- clearStats();
+ if (NULL != sInstance)
+ {
+ LL_ERRS() << "Attempted to create multiple instances of LLViewerStatsRecorder!" << LL_ENDL;
+ }
+ sInstance = this;
+ clearStats();
}
LLViewerStatsRecorder::~LLViewerStatsRecorder()
{
- if (mStatsFile)
- {
+ if (mStatsFile)
+ {
writeToLog(0.f); // Save last data
closeStatsFile();
- }
+ }
}
void LLViewerStatsRecorder::clearStats()
{
- mObjectCacheHitCount = 0;
- mObjectCacheMissFullCount = 0;
- mObjectCacheMissCrcCount = 0;
- mObjectFullUpdates = 0;
- mObjectTerseUpdates = 0;
- mObjectCacheMissRequests = 0;
- mObjectCacheUpdateDupes = 0;
- mObjectCacheUpdateChanges = 0;
- mObjectCacheUpdateAdds = 0;
- mObjectCacheUpdateReplacements = 0;
- mObjectUpdateFailures = 0;
- mTextureFetchCount = 0;
+ mObjectCacheHitCount = 0;
+ mObjectCacheMissFullCount = 0;
+ mObjectCacheMissCrcCount = 0;
+ mObjectFullUpdates = 0;
+ mObjectTerseUpdates = 0;
+ mObjectCacheMissRequests = 0;
+ mObjectCacheUpdateDupes = 0;
+ mObjectCacheUpdateChanges = 0;
+ mObjectCacheUpdateAdds = 0;
+ mObjectCacheUpdateReplacements = 0;
+ mObjectUpdateFailures = 0;
+ mTextureFetchCount = 0;
mMeshLoadedCount = 0;
mObjectKills = 0;
}
@@ -88,12 +88,12 @@ void LLViewerStatsRecorder::enableObjectStatsRecording(bool enable, bool logging
{
mEnableStatsRecording = enable;
- // if logging is stopping, close the file
+ // if logging is stopping, close the file
if (mStatsFile && !logging)
- {
+ {
writeToLog(0.f); // Save last data
closeStatsFile();
- }
+ }
mEnableStatsLogging = logging;
}
@@ -101,54 +101,54 @@ void LLViewerStatsRecorder::enableObjectStatsRecording(bool enable, bool logging
void LLViewerStatsRecorder::recordCacheMissEvent(U8 cache_miss_type)
{
- if (LLViewerRegion::CACHE_MISS_TYPE_TOTAL == cache_miss_type)
- {
- mObjectCacheMissFullCount++;
- }
- else
- {
- mObjectCacheMissCrcCount++;
- }
+ if (LLViewerRegion::CACHE_MISS_TYPE_TOTAL == cache_miss_type)
+ {
+ mObjectCacheMissFullCount++;
+ }
+ else
+ {
+ mObjectCacheMissCrcCount++;
+ }
}
void LLViewerStatsRecorder::recordObjectUpdateEvent(const EObjectUpdateType update_type)
{
switch (update_type)
- {
- case OUT_FULL:
- case OUT_FULL_COMPRESSED:
+ {
+ case OUT_FULL:
+ case OUT_FULL_COMPRESSED:
mObjectFullUpdates++;
- break;
- case OUT_TERSE_IMPROVED:
- mObjectTerseUpdates++;
- break;
- default:
- LL_WARNS() << "Unknown update_type" << LL_ENDL;
- break;
- };
+ break;
+ case OUT_TERSE_IMPROVED:
+ mObjectTerseUpdates++;
+ break;
+ default:
+ LL_WARNS() << "Unknown update_type" << LL_ENDL;
+ break;
+ };
}
void LLViewerStatsRecorder::recordCacheFullUpdate(LLViewerRegion::eCacheUpdateResult update_result)
{
switch (update_result)
- {
- case LLViewerRegion::CACHE_UPDATE_DUPE:
- mObjectCacheUpdateDupes++;
- break;
- case LLViewerRegion::CACHE_UPDATE_CHANGED:
- mObjectCacheUpdateChanges++;
- break;
- case LLViewerRegion::CACHE_UPDATE_ADDED:
- mObjectCacheUpdateAdds++;
- break;
- case LLViewerRegion::CACHE_UPDATE_REPLACED:
- mObjectCacheUpdateReplacements++;
- break;
- default:
+ {
+ case LLViewerRegion::CACHE_UPDATE_DUPE:
+ mObjectCacheUpdateDupes++;
+ break;
+ case LLViewerRegion::CACHE_UPDATE_CHANGED:
+ mObjectCacheUpdateChanges++;
+ break;
+ case LLViewerRegion::CACHE_UPDATE_ADDED:
+ mObjectCacheUpdateAdds++;
+ break;
+ case LLViewerRegion::CACHE_UPDATE_REPLACED:
+ mObjectCacheUpdateReplacements++;
+ break;
+ default:
LL_WARNS() << "Unknown update_result type " << (S32) update_result << LL_ENDL;
- break;
- };
+ break;
+ };
}
void LLViewerStatsRecorder::writeToLog( F32 interval )
@@ -175,110 +175,110 @@ void LLViewerStatsRecorder::writeToLog( F32 interval )
}
}
- mLastSnapshotTime = LLFrameTimer::getTotalSeconds();
+ mLastSnapshotTime = LLFrameTimer::getTotalSeconds();
LL_DEBUGS("ILX") << "ILX: "
- << mObjectCacheHitCount << " hits, "
- << mObjectCacheMissFullCount << " full misses, "
- << mObjectCacheMissCrcCount << " crc misses, "
- << mObjectFullUpdates << " full updates, "
- << mObjectTerseUpdates << " terse updates, "
- << mObjectCacheMissRequests << " cache miss requests, "
- << mObjectCacheUpdateDupes << " cache update dupes, "
- << mObjectCacheUpdateChanges << " cache update changes, "
- << mObjectCacheUpdateAdds << " cache update adds, "
- << mObjectCacheUpdateReplacements << " cache update replacements,"
- << mObjectUpdateFailures << " update failures,"
- << mTextureFetchCount << " texture fetches, "
- << mMeshLoadedCount << " mesh loads, "
+ << mObjectCacheHitCount << " hits, "
+ << mObjectCacheMissFullCount << " full misses, "
+ << mObjectCacheMissCrcCount << " crc misses, "
+ << mObjectFullUpdates << " full updates, "
+ << mObjectTerseUpdates << " terse updates, "
+ << mObjectCacheMissRequests << " cache miss requests, "
+ << mObjectCacheUpdateDupes << " cache update dupes, "
+ << mObjectCacheUpdateChanges << " cache update changes, "
+ << mObjectCacheUpdateAdds << " cache update adds, "
+ << mObjectCacheUpdateReplacements << " cache update replacements,"
+ << mObjectUpdateFailures << " update failures,"
+ << mTextureFetchCount << " texture fetches, "
+ << mMeshLoadedCount << " mesh loads, "
<< mObjectKills << " object kills"
- << LL_ENDL;
-
- if (mStatsFile == NULL)
- {
- // Refresh settings
+ << LL_ENDL;
+
+ if (mStatsFile == NULL)
+ {
+ // Refresh settings
mInterval = gSavedSettings.getF32("StatsReportFileInterval");
mSkipSaveIfZeros = gSavedSettings.getBOOL("StatsReportSkipZeroDataSaves");
- mMaxDuration = gSavedSettings.getF32("StatsReportMaxDuration");
+ mMaxDuration = gSavedSettings.getF32("StatsReportMaxDuration");
- // Open the data file
+ // Open the data file
makeStatsFileName();
mStatsFile = LLFile::fopen(mStatsFileName, "wb");
- if (mStatsFile)
- {
+ if (mStatsFile)
+ {
LL_INFOS("ILX") << "ILX: Writing update information to " << mStatsFileName << LL_ENDL;
mFileOpenTime = LLFrameTimer::getTotalSeconds();
// Write column headers
- std::ostringstream col_headers;
- col_headers << "Time (sec),"
- << "Regions,"
- << "Active Cached Objects,"
- << "Cache Hits,"
- << "Cache Full Misses,"
- << "Cache Crc Misses,"
- << "Full Updates,"
- << "Terse Updates,"
- << "Cache Miss Requests," // Normally results in a Full Update from simulator
- << "Cache Update Dupes,"
- << "Cache Update Changes,"
- << "Cache Update Adds,"
- << "Cache Update Replacements,"
- << "Update Failures,"
- << "Texture Count,"
+ std::ostringstream col_headers;
+ col_headers << "Time (sec),"
+ << "Regions,"
+ << "Active Cached Objects,"
+ << "Cache Hits,"
+ << "Cache Full Misses,"
+ << "Cache Crc Misses,"
+ << "Full Updates,"
+ << "Terse Updates,"
+ << "Cache Miss Requests," // Normally results in a Full Update from simulator
+ << "Cache Update Dupes,"
+ << "Cache Update Changes,"
+ << "Cache Update Adds,"
+ << "Cache Update Replacements,"
+ << "Update Failures,"
+ << "Texture Count,"
<< "Mesh Load Count,"
<< "Object Kills"
<< "\n";
- data_size = col_headers.str().size();
- if (fwrite(col_headers.str().c_str(), 1, data_size, mStatsFile ) != data_size)
- {
- LL_WARNS() << "failed to write full headers to " << mStatsFileName << LL_ENDL;
- // Close the file and turn off stats logging
+ data_size = col_headers.str().size();
+ if (fwrite(col_headers.str().c_str(), 1, data_size, mStatsFile ) != data_size)
+ {
+ LL_WARNS() << "failed to write full headers to " << mStatsFileName << LL_ENDL;
+ // Close the file and turn off stats logging
closeStatsFile();
- return;
- }
- }
- else
- { // Failed to open file
- LL_WARNS() << "Couldn't open " << mStatsFileName << " for logging, turning off stats recording." << LL_ENDL;
+ return;
+ }
+ }
+ else
+ { // Failed to open file
+ LL_WARNS() << "Couldn't open " << mStatsFileName << " for logging, turning off stats recording." << LL_ENDL;
mEnableStatsLogging = false;
- return;
- }
- }
-
- std::ostringstream stats_data;
-
- stats_data << getTimeSinceStart()
- << "," << LLWorld::getInstance()->getRegionList().size()
- << "," << LLWorld::getInstance()->getNumOfActiveCachedObjects()
- << "," << mObjectCacheHitCount
- << "," << mObjectCacheMissFullCount
- << "," << mObjectCacheMissCrcCount
- << "," << mObjectFullUpdates
- << "," << mObjectTerseUpdates
- << "," << mObjectCacheMissRequests
- << "," << mObjectCacheUpdateDupes
- << "," << mObjectCacheUpdateChanges
- << "," << mObjectCacheUpdateAdds
- << "," << mObjectCacheUpdateReplacements
- << "," << mObjectUpdateFailures
- << "," << mTextureFetchCount
- << "," << mMeshLoadedCount
- << "," << mObjectKills
- << "\n";
-
- data_size = stats_data.str().size();
- if ( data_size != fwrite(stats_data.str().c_str(), 1, data_size, mStatsFile ))
- {
- LL_WARNS() << "Unable to write complete column data to " << mStatsFileName << LL_ENDL;
+ return;
+ }
+ }
+
+ std::ostringstream stats_data;
+
+ stats_data << getTimeSinceStart()
+ << "," << LLWorld::getInstance()->getRegionList().size()
+ << "," << LLWorld::getInstance()->getNumOfActiveCachedObjects()
+ << "," << mObjectCacheHitCount
+ << "," << mObjectCacheMissFullCount
+ << "," << mObjectCacheMissCrcCount
+ << "," << mObjectFullUpdates
+ << "," << mObjectTerseUpdates
+ << "," << mObjectCacheMissRequests
+ << "," << mObjectCacheUpdateDupes
+ << "," << mObjectCacheUpdateChanges
+ << "," << mObjectCacheUpdateAdds
+ << "," << mObjectCacheUpdateReplacements
+ << "," << mObjectUpdateFailures
+ << "," << mTextureFetchCount
+ << "," << mMeshLoadedCount
+ << "," << mObjectKills
+ << "\n";
+
+ data_size = stats_data.str().size();
+ if ( data_size != fwrite(stats_data.str().c_str(), 1, data_size, mStatsFile ))
+ {
+ LL_WARNS() << "Unable to write complete column data to " << mStatsFileName << LL_ENDL;
closeStatsFile();
}
- clearStats();
+ clearStats();
- if (getTimeSinceStart() >= mMaxDuration)
+ if (getTimeSinceStart() >= mMaxDuration)
{ // If file recording has been running for too long, stop it.
closeStatsFile();
}
@@ -286,12 +286,12 @@ void LLViewerStatsRecorder::writeToLog( F32 interval )
void LLViewerStatsRecorder::closeStatsFile()
{
- if (mStatsFile)
- {
+ if (mStatsFile)
+ {
LL_INFOS("ILX") << "ILX: Stopped writing update information to " << mStatsFileName << " after " << getTimeSinceStart()
<< " seconds." << LL_ENDL;
LLFile::close(mStatsFile);
- mStatsFile = NULL;
+ mStatsFile = NULL;
}
mEnableStatsLogging = false;
}
@@ -315,5 +315,5 @@ void LLViewerStatsRecorder::makeStatsFileName()
F32 LLViewerStatsRecorder::getTimeSinceStart()
{
- return (F32) (LLFrameTimer::getTotalSeconds() - mFileOpenTime);
+ return (F32) (LLFrameTimer::getTotalSeconds() - mFileOpenTime);
}