PageRenderTime 20ms CodeModel.GetById 1ms app.highlight 14ms RepoModel.GetById 1ms app.codeStats 1ms

/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
27#ifndef LLVIEWERSTATSRECORDER_H
28#define LLVIEWERSTATSRECORDER_H
29
30
31// This is a diagnostic class used to record information from the viewer
32// for analysis.
33
34// This is normally 0.  Set to 1 to enable viewer stats recording
35#define LL_RECORD_VIEWER_STATS	0
36
37
38#if LL_RECORD_VIEWER_STATS
39#include "llframetimer.h"
40#include "llviewerobject.h"
41#include "llviewerregion.h"
42
43class LLMutex;
44class LLViewerRegion;
45class LLViewerObject;
46
47class LLViewerStatsRecorder
48{
49 public:
50	LLViewerStatsRecorder();
51	~LLViewerStatsRecorder();
52
53	static void initClass();
54	static void cleanupClass();
55	static LLViewerStatsRecorder* instance() {return sInstance; }
56
57	void initStatsRecorder(LLViewerRegion *regionp);
58
59	void beginObjectUpdateEvents(LLViewerRegion *regionp);
60	void recordObjectUpdateFailure(U32 local_id, const EObjectUpdateType update_type);
61	void recordCacheMissEvent(U32 local_id, const EObjectUpdateType update_type, U8 cache_miss_type);
62	void recordObjectUpdateEvent(U32 local_id, const EObjectUpdateType update_type, LLViewerObject * objectp);
63	void recordCacheFullUpdate(U32 local_id, const EObjectUpdateType update_type, LLViewerRegion::eCacheUpdateResult update_result, LLViewerObject* objectp);
64	void recordRequestCacheMissesEvent(S32 count);
65	void endObjectUpdateEvents();
66
67	F32 getTimeSinceStart();
68
69private:
70	static LLViewerStatsRecorder* sInstance;
71
72	LLFILE *	mObjectCacheFile;		// File to write data into
73	LLFrameTimer	mTimer;
74	LLViewerRegion*	mRegionp;
75	F64			mStartTime;
76	F64			mProcessingTime;
77
78	S32			mObjectCacheHitCount;
79	S32			mObjectCacheMissFullCount;
80	S32			mObjectCacheMissCrcCount;
81	S32			mObjectFullUpdates;
82	S32			mObjectTerseUpdates;
83	S32			mObjectCacheMissRequests;
84	S32			mObjectCacheMissResponses;
85	S32			mObjectCacheUpdateDupes;
86	S32			mObjectCacheUpdateChanges;
87	S32			mObjectCacheUpdateAdds;
88	S32			mObjectCacheUpdateReplacements;
89	S32			mObjectUpdateFailures;
90
91
92	void	clearStats();
93};
94#endif	// LL_RECORD_VIEWER_STATS
95
96#endif // LLVIEWERSTATSRECORDER_H
97