summaryrefslogtreecommitdiff
path: root/indra/newview/llviewerstatsrecorder.h
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llviewerstatsrecorder.h')
-rw-r--r--indra/newview/llviewerstatsrecorder.h137
1 files changed, 84 insertions, 53 deletions
diff --git a/indra/newview/llviewerstatsrecorder.h b/indra/newview/llviewerstatsrecorder.h
index c974bea49d..b9fe02e54d 100644
--- a/indra/newview/llviewerstatsrecorder.h
+++ b/indra/newview/llviewerstatsrecorder.h
@@ -31,10 +31,6 @@
// This is a diagnostic class used to record information from the viewer
// for analysis.
-// This is normally 0. Set to 1 to enable viewer stats recording
-#define LL_RECORD_VIEWER_STATS 0
-
-
#include "llframetimer.h"
#include "llviewerobject.h"
#include "llviewerregion.h"
@@ -49,97 +45,132 @@ class LLViewerStatsRecorder : public LLSingleton<LLViewerStatsRecorder>
~LLViewerStatsRecorder();
public:
- void objectUpdateFailure(U32 local_id, const EObjectUpdateType update_type, S32 msg_size)
- {
-#if LL_RECORD_VIEWER_STATS
- recordObjectUpdateFailure(local_id, update_type, msg_size);
-#endif
+ // Enable/disable stats recording. This is broken down into two
+ // flags so we can record stats without writing them to the log
+ // file. This is useful to analyzing updates for scene loading.
+ void enableObjectStatsRecording(bool enable, bool logging = false);
+
+ bool isEnabled() const { return mEnableStatsRecording; }
+ bool isLogging() const { return mEnableStatsLogging; }
+
+ void objectUpdateFailure()
+ {
+ if (mEnableStatsRecording)
+ {
+ mObjectUpdateFailures++;
+ }
}
- void cacheMissEvent(U32 local_id, const EObjectUpdateType update_type, U8 cache_miss_type, S32 msg_size)
+ void cacheMissEvent(U8 cache_miss_type)
{
-#if LL_RECORD_VIEWER_STATS
- recordCacheMissEvent(local_id, update_type, cache_miss_type, msg_size);
-#endif
+ if (mEnableStatsRecording)
+ {
+ recordCacheMissEvent(cache_miss_type);
+ }
+ }
+
+ void cacheHitEvent()
+ {
+ if (mEnableStatsRecording)
+ {
+ mObjectCacheHitCount++;
+ }
+ }
+
+ void objectUpdateEvent(const EObjectUpdateType update_type)
+ {
+ if (mEnableStatsRecording)
+ {
+ recordObjectUpdateEvent(update_type);
+ }
}
- void objectUpdateEvent(U32 local_id, const EObjectUpdateType update_type, LLViewerObject * objectp, S32 msg_size)
- {
-#if LL_RECORD_VIEWER_STATS
- recordObjectUpdateEvent(local_id, update_type, objectp, msg_size);
-#endif
+ void cacheFullUpdate(LLViewerRegion::eCacheUpdateResult update_result)
+ {
+ if (mEnableStatsRecording)
+ {
+ recordCacheFullUpdate(update_result);
+ }
}
- void cacheFullUpdate(U32 local_id, const EObjectUpdateType update_type, LLViewerRegion::eCacheUpdateResult update_result, LLViewerObject* objectp, S32 msg_size)
+ void requestCacheMissesEvent(S32 count)
{
-#if LL_RECORD_VIEWER_STATS
- recordCacheFullUpdate(local_id, update_type, update_result, objectp, msg_size);
-#endif
+ if (mEnableStatsRecording)
+ {
+ mObjectCacheMissRequests += count;
+ }
}
- void requestCacheMissesEvent(S32 count)
+ void textureFetch()
{
-#if LL_RECORD_VIEWER_STATS
- recordRequestCacheMissesEvent(count);
-#endif
+ if (mEnableStatsRecording)
+ {
+ mTextureFetchCount += 1;
+ }
}
- void textureFetch(S32 msg_size)
+ void meshLoaded()
{
-#if LL_RECORD_VIEWER_STATS
- recordTextureFetch(msg_size);
-#endif
+ if (mEnableStatsRecording)
+ {
+ mMeshLoadedCount += 1;
+ }
}
- void log(F32 interval)
+ void recordObjectKills(S32 num_objects)
+ {
+ if (mEnableStatsRecording)
+ {
+ mObjectKills += num_objects;
+ }
+ }
+
+ void idle()
{
-#if LL_RECORD_VIEWER_STATS
- writeToLog(interval);
-#endif
+ writeToLog(mInterval);
}
F32 getTimeSinceStart();
private:
- void recordObjectUpdateFailure(U32 local_id, const EObjectUpdateType update_type, S32 msg_size);
- void recordCacheMissEvent(U32 local_id, const EObjectUpdateType update_type, U8 cache_miss_type, S32 msg_size);
- void recordObjectUpdateEvent(U32 local_id, const EObjectUpdateType update_type, LLViewerObject * objectp, S32 msg_size);
- void recordCacheFullUpdate(U32 local_id, const EObjectUpdateType update_type, LLViewerRegion::eCacheUpdateResult update_result, LLViewerObject* objectp, S32 msg_size);
- void recordRequestCacheMissesEvent(S32 count);
- void recordTextureFetch(S32 msg_size);
+ void recordCacheMissEvent(U8 cache_miss_type);
+ void recordObjectUpdateEvent(const EObjectUpdateType update_type);
+ void recordCacheFullUpdate(LLViewerRegion::eCacheUpdateResult update_result);
void writeToLog(F32 interval);
+ void closeStatsFile();
+ void makeStatsFileName();
static LLViewerStatsRecorder* sInstance;
- LLFILE * mObjectCacheFile; // File to write data into
+ LLFILE * mStatsFile; // File to write data into
+ std::string mStatsFileName;
+
LLFrameTimer mTimer;
- F64 mStartTime;
+ F64 mFileOpenTime;
F64 mLastSnapshotTime;
+ F32 mInterval; // Interval between data log writes
+ F32 mMaxDuration; // Time limit on file
+
+ bool mEnableStatsRecording; // Set to true to enable recording stats data
+ bool mEnableStatsLogging; // Set true to write stats to log file
+ bool mSkipSaveIfZeros; // Set true to skip saving stats if all values are zero
S32 mObjectCacheHitCount;
- S32 mObjectCacheHitSize;
S32 mObjectCacheMissFullCount;
- S32 mObjectCacheMissFullSize;
S32 mObjectCacheMissCrcCount;
- S32 mObjectCacheMissCrcSize;
S32 mObjectFullUpdates;
- S32 mObjectFullUpdatesSize;
S32 mObjectTerseUpdates;
- S32 mObjectTerseUpdatesSize;
S32 mObjectCacheMissRequests;
- S32 mObjectCacheMissResponses;
- S32 mObjectCacheMissResponsesSize;
S32 mObjectCacheUpdateDupes;
S32 mObjectCacheUpdateChanges;
S32 mObjectCacheUpdateAdds;
S32 mObjectCacheUpdateReplacements;
S32 mObjectUpdateFailures;
- S32 mObjectUpdateFailuresSize;
- S32 mTextureFetchSize;
-
+ S32 mTextureFetchCount;
+ S32 mMeshLoadedCount;
+ S32 mObjectKills;
void clearStats();
};
#endif // LLVIEWERSTATSRECORDER_H
-