/indra/newview/llviewerstatsrecorder.h

https://bitbucket.org/lindenlab/viewer-beta/ · C++ Header · 97 lines · 50 code · 19 blank · 28 comment · 0 complexity · 6fc8f6317b25f8bdb493091c79a80f55 MD5 · raw file

  1. /**
  2. * @file llviewerstatsrecorder.h
  3. * @brief record info about viewer events to a metrics log file
  4. *
  5. * $LicenseInfo:firstyear=2010&license=viewerlgpl$
  6. * Second Life Viewer Source Code
  7. * Copyright (C) 2010, Linden Research, Inc.
  8. *
  9. * This library is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU Lesser General Public
  11. * License as published by the Free Software Foundation;
  12. * version 2.1 of the License only.
  13. *
  14. * This library is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. * Lesser General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Lesser General Public
  20. * License along with this library; if not, write to the Free Software
  21. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  22. *
  23. * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
  24. * $/LicenseInfo$
  25. */
  26. #ifndef LLVIEWERSTATSRECORDER_H
  27. #define LLVIEWERSTATSRECORDER_H
  28. // This is a diagnostic class used to record information from the viewer
  29. // for analysis.
  30. // This is normally 0. Set to 1 to enable viewer stats recording
  31. #define LL_RECORD_VIEWER_STATS 0
  32. #if LL_RECORD_VIEWER_STATS
  33. #include "llframetimer.h"
  34. #include "llviewerobject.h"
  35. #include "llviewerregion.h"
  36. class LLMutex;
  37. class LLViewerRegion;
  38. class LLViewerObject;
  39. class LLViewerStatsRecorder
  40. {
  41. public:
  42. LLViewerStatsRecorder();
  43. ~LLViewerStatsRecorder();
  44. static void initClass();
  45. static void cleanupClass();
  46. static LLViewerStatsRecorder* instance() {return sInstance; }
  47. void initStatsRecorder(LLViewerRegion *regionp);
  48. void beginObjectUpdateEvents(LLViewerRegion *regionp);
  49. void recordObjectUpdateFailure(U32 local_id, const EObjectUpdateType update_type);
  50. void recordCacheMissEvent(U32 local_id, const EObjectUpdateType update_type, U8 cache_miss_type);
  51. void recordObjectUpdateEvent(U32 local_id, const EObjectUpdateType update_type, LLViewerObject * objectp);
  52. void recordCacheFullUpdate(U32 local_id, const EObjectUpdateType update_type, LLViewerRegion::eCacheUpdateResult update_result, LLViewerObject* objectp);
  53. void recordRequestCacheMissesEvent(S32 count);
  54. void endObjectUpdateEvents();
  55. F32 getTimeSinceStart();
  56. private:
  57. static LLViewerStatsRecorder* sInstance;
  58. LLFILE * mObjectCacheFile; // File to write data into
  59. LLFrameTimer mTimer;
  60. LLViewerRegion* mRegionp;
  61. F64 mStartTime;
  62. F64 mProcessingTime;
  63. S32 mObjectCacheHitCount;
  64. S32 mObjectCacheMissFullCount;
  65. S32 mObjectCacheMissCrcCount;
  66. S32 mObjectFullUpdates;
  67. S32 mObjectTerseUpdates;
  68. S32 mObjectCacheMissRequests;
  69. S32 mObjectCacheMissResponses;
  70. S32 mObjectCacheUpdateDupes;
  71. S32 mObjectCacheUpdateChanges;
  72. S32 mObjectCacheUpdateAdds;
  73. S32 mObjectCacheUpdateReplacements;
  74. S32 mObjectUpdateFailures;
  75. void clearStats();
  76. };
  77. #endif // LL_RECORD_VIEWER_STATS
  78. #endif // LLVIEWERSTATSRECORDER_H