aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llcommon
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/llcommon')
-rw-r--r--linden/indra/llcommon/files.lst1
-rw-r--r--linden/indra/llcommon/llcommon.vcproj6
-rw-r--r--linden/indra/llcommon/llerror.cpp7
-rw-r--r--linden/indra/llcommon/llevent.h2
-rw-r--r--linden/indra/llcommon/llframetimer.cpp6
-rw-r--r--linden/indra/llcommon/llframetimer.h1
-rw-r--r--linden/indra/llcommon/llmetrics.cpp165
-rw-r--r--linden/indra/llcommon/llmetrics.h62
-rw-r--r--linden/indra/llcommon/llprocessor.cpp2
-rw-r--r--linden/indra/llcommon/llsdutil.cpp13
-rw-r--r--linden/indra/llcommon/llsdutil.h3
-rw-r--r--linden/indra/llcommon/llthread.h3
-rw-r--r--linden/indra/llcommon/llversion.h4
13 files changed, 270 insertions, 5 deletions
diff --git a/linden/indra/llcommon/files.lst b/linden/indra/llcommon/files.lst
index 6a48752..0474cbb 100644
--- a/linden/indra/llcommon/files.lst
+++ b/linden/indra/llcommon/files.lst
@@ -18,6 +18,7 @@ llcommon/llliveappconfig.cpp
18llcommon/lllivefile.cpp 18llcommon/lllivefile.cpp
19llcommon/llmemory.cpp 19llcommon/llmemory.cpp
20llcommon/llmemorystream.cpp 20llcommon/llmemorystream.cpp
21llcommon/llmetrics.cpp
21llcommon/llmortician.cpp 22llcommon/llmortician.cpp
22llcommon/llprocessor.cpp 23llcommon/llprocessor.cpp
23llcommon/llqueuedthread.cpp 24llcommon/llqueuedthread.cpp
diff --git a/linden/indra/llcommon/llcommon.vcproj b/linden/indra/llcommon/llcommon.vcproj
index ca91e18..399dae3 100644
--- a/linden/indra/llcommon/llcommon.vcproj
+++ b/linden/indra/llcommon/llcommon.vcproj
@@ -215,6 +215,9 @@
215 RelativePath=".\llmemorystream.cpp"> 215 RelativePath=".\llmemorystream.cpp">
216 </File> 216 </File>
217 <File 217 <File
218 RelativePath=".\llmetrics.cpp">
219 </File>
220 <File
218 RelativePath=".\llmortician.cpp"> 221 RelativePath=".\llmortician.cpp">
219 </File> 222 </File>
220 <File 223 <File
@@ -433,6 +436,9 @@
433 RelativePath=".\llmemtype.h"> 436 RelativePath=".\llmemtype.h">
434 </File> 437 </File>
435 <File 438 <File
439 RelativePath=".\llmetrics.h">
440 </File>
441 <File
436 RelativePath=".\llmortician.h"> 442 RelativePath=".\llmortician.h">
437 </File> 443 </File>
438 <File 444 <File
diff --git a/linden/indra/llcommon/llerror.cpp b/linden/indra/llcommon/llerror.cpp
index 9bcb415..714a265 100644
--- a/linden/indra/llcommon/llerror.cpp
+++ b/linden/indra/llcommon/llerror.cpp
@@ -40,6 +40,7 @@ extern apr_thread_mutex_t *gLogMutexp;
40#include "lllivefile.h" 40#include "lllivefile.h"
41#include "llsd.h" 41#include "llsd.h"
42#include "llsdserialize.h" 42#include "llsdserialize.h"
43#include "llstl.h"
43 44
44#include <algorithm> 45#include <algorithm>
45#include <cctype> 46#include <cctype>
@@ -397,6 +398,12 @@ namespace LLError
397 shouldLogCallCounter(0) 398 shouldLogCallCounter(0)
398 { } 399 { }
399 400
401 ~Settings()
402 {
403 for_each(recorders.begin(), recorders.end(),
404 DeletePointer());
405 }
406
400 static Settings*& getPtr(); 407 static Settings*& getPtr();
401 }; 408 };
402 409
diff --git a/linden/indra/llcommon/llevent.h b/linden/indra/llcommon/llevent.h
index 18b0596..cab8817 100644
--- a/linden/indra/llcommon/llevent.h
+++ b/linden/indra/llcommon/llevent.h
@@ -88,12 +88,12 @@ public:
88class LLSimpleListener : public LLEventListener 88class LLSimpleListener : public LLEventListener
89{ 89{
90public: 90public:
91 virtual ~LLSimpleListener();
92 void clearDispatchers(); 91 void clearDispatchers();
93 virtual bool handleAttach(LLEventDispatcher *dispatcher); 92 virtual bool handleAttach(LLEventDispatcher *dispatcher);
94 virtual bool handleDetach(LLEventDispatcher *dispatcher); 93 virtual bool handleDetach(LLEventDispatcher *dispatcher);
95 94
96protected: 95protected:
96 ~LLSimpleListener();
97 std::vector<LLEventDispatcher *> mDispatchers; 97 std::vector<LLEventDispatcher *> mDispatchers;
98}; 98};
99 99
diff --git a/linden/indra/llcommon/llframetimer.cpp b/linden/indra/llcommon/llframetimer.cpp
index 5ae4a6b..2b53e8c 100644
--- a/linden/indra/llcommon/llframetimer.cpp
+++ b/linden/indra/llcommon/llframetimer.cpp
@@ -70,6 +70,12 @@ void LLFrameTimer::reset()
70 mExpiry = sFrameTime; 70 mExpiry = sFrameTime;
71} 71}
72 72
73void LLFrameTimer::resetWithExpiry(F32 expiration)
74{
75 reset();
76 setTimerExpirySec(expiration);
77}
78
73// Don't combine pause/unpause with start/stop 79// Don't combine pause/unpause with start/stop
74// Useage: 80// Useage:
75// LLFrameTime foo; // starts automatically 81// LLFrameTime foo; // starts automatically
diff --git a/linden/indra/llcommon/llframetimer.h b/linden/indra/llcommon/llframetimer.h
index 0366e09..de550e2 100644
--- a/linden/indra/llcommon/llframetimer.h
+++ b/linden/indra/llcommon/llframetimer.h
@@ -75,6 +75,7 @@ public:
75 void start(); 75 void start();
76 void stop(); 76 void stop();
77 void reset(); 77 void reset();
78 void resetWithExpiry(F32 expiration);
78 void pause(); 79 void pause();
79 void unpause(); 80 void unpause();
80 void setTimerExpirySec(F32 expiration); 81 void setTimerExpirySec(F32 expiration);
diff --git a/linden/indra/llcommon/llmetrics.cpp b/linden/indra/llcommon/llmetrics.cpp
new file mode 100644
index 0000000..583f840
--- /dev/null
+++ b/linden/indra/llcommon/llmetrics.cpp
@@ -0,0 +1,165 @@
1/**
2 * @file llmetrics.cpp
3 * @author Kelly
4 * @date 2007-05-25
5 * @brief Metrics accumulation and associated functions
6 *
7 * Copyright (c) 2007-2007, Linden Research, Inc.
8 *
9 * Second Life Viewer Source Code
10 * The source code in this file ("Source Code") is provided by Linden Lab
11 * to you under the terms of the GNU General Public License, version 2.0
12 * ("GPL"), unless you have obtained a separate licensing agreement
13 * ("Other License"), formally executed by you and Linden Lab. Terms of
14 * the GPL can be found in doc/GPL-license.txt in this distribution, or
15 * online at http://secondlife.com/developers/opensource/gplv2
16 *
17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlife.com/developers/opensource/flossexception
21 *
22 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above,
24 * and agree to abide by those obligations.
25 *
26 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
27 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
28 * COMPLETENESS OR PERFORMANCE.
29 */
30
31#include "linden_common.h"
32#include "llmetrics.h"
33
34#include "llsd.h"
35#include "llsdserialize.h"
36#include "llframetimer.h"
37
38class LLMetricsImpl
39{
40public:
41 LLMetricsImpl() { }
42 ~LLMetricsImpl();
43
44 void recordEvent(const std::string& location, const std::string& mesg, bool success);
45 void printTotals(LLSD metadata);
46 void recordEventDetails(const std::string& location,
47 const std::string& mesg,
48 bool success,
49 LLSD stats);
50private:
51 LLFrameTimer mLastPrintTimer;
52 LLSD mMetricsMap;
53};
54
55LLMetricsImpl::~LLMetricsImpl()
56{
57}
58
59void LLMetricsImpl::recordEventDetails(const std::string& location,
60 const std::string& mesg,
61 bool success,
62 LLSD stats)
63{
64 recordEvent(location,mesg,success);
65
66 LLSD metrics = LLSD::emptyMap();
67 metrics["location"] = location;
68 metrics["stats"] = stats;
69
70 llinfos << "LLMETRICS: " << LLSDOStreamer<LLSDNotationFormatter>(metrics) << llendl;
71}
72
73// Store this:
74// [ {'location_1':{'mesg_1':{'success':i10, 'fail':i0},
75// 'mesg_2':{'success':i10, 'fail':i0}},
76// {'location_2',{'mesg_3':{'success':i10, 'fail':i0}} ]
77void LLMetricsImpl::recordEvent(const std::string& location, const std::string& mesg, bool success)
78{
79 LLSD& stats = mMetricsMap[location][mesg];
80 if (success)
81 {
82 stats["success"] = stats["success"].asInteger() + 1;
83 }
84 else
85 {
86 stats["fail"] = stats["fail"].asInteger() + 1;
87 }
88}
89
90// Print this:
91// { 'meta':
92// { 'elapsed_time':r3600.000 }
93// 'stats':
94// [ {'location':'location_1', 'mesg':'mesg_1', 'success':i10, 'fail':i0},
95// {'location':'location_1', 'mesg':'mesg_2', 'success':i10, 'fail':i0},
96// {'location':'location_2', 'mesg':'mesg_3', 'success':i10, 'fail':i0} ] }
97void LLMetricsImpl::printTotals(LLSD metadata)
98{
99 F32 elapsed_time = mLastPrintTimer.getElapsedTimeAndResetF32();
100 metadata["elapsed_time"] = elapsed_time;
101
102 LLSD out_sd = LLSD::emptyMap();
103 out_sd["meta"] = metadata;
104
105 LLSD stats = LLSD::emptyArray();
106
107 LLSD::map_const_iterator loc_it = mMetricsMap.beginMap();
108 LLSD::map_const_iterator loc_end = mMetricsMap.endMap();
109 for ( ; loc_it != loc_end; ++loc_it)
110 {
111 const std::string& location = (*loc_it).first;
112
113 const LLSD& loc_map = (*loc_it).second;
114 LLSD::map_const_iterator mesg_it = loc_map.beginMap();
115 LLSD::map_const_iterator mesg_end = loc_map.endMap();
116 for ( ; mesg_it != mesg_end; ++mesg_it)
117 {
118 const std::string& mesg = (*mesg_it).first;
119 const LLSD& mesg_map = (*mesg_it).second;
120
121 LLSD entry = LLSD::emptyMap();
122 entry["location"] = location;
123 entry["mesg"] = mesg;
124 entry["success"] = mesg_map["success"];
125 entry["fail"] = mesg_map["fail"];
126
127 stats.append(entry);
128 }
129 }
130
131 out_sd["stats"] = stats;
132
133 llinfos << "LLMETRICS: AGGREGATE: " << LLSDOStreamer<LLSDNotationFormatter>(out_sd) << llendl;
134}
135
136LLMetrics::LLMetrics()
137{
138 mImpl = new LLMetricsImpl();
139}
140
141LLMetrics::~LLMetrics()
142{
143 delete mImpl;
144 mImpl = NULL;
145}
146
147void LLMetrics::recordEvent(const std::string& location, const std::string& mesg, bool success)
148{
149 if (mImpl) mImpl->recordEvent(location,mesg,success);
150}
151
152void LLMetrics::printTotals(LLSD meta)
153{
154 if (mImpl) mImpl->printTotals(meta);
155}
156
157
158void LLMetrics::recordEventDetails(const std::string& location,
159 const std::string& mesg,
160 bool success,
161 LLSD stats)
162{
163 if (mImpl) mImpl->recordEventDetails(location,mesg,success,stats);
164}
165
diff --git a/linden/indra/llcommon/llmetrics.h b/linden/indra/llcommon/llmetrics.h
new file mode 100644
index 0000000..2c216c3
--- /dev/null
+++ b/linden/indra/llcommon/llmetrics.h
@@ -0,0 +1,62 @@
1/**
2 * @file llmetrics.h
3 * @author Kelly
4 * @date 2007-05-25
5 * @brief Declaration of metrics accumulation and associated functions
6 *
7 * Copyright (c) 2007-2007, Linden Research, Inc.
8 *
9 * Second Life Viewer Source Code
10 * The source code in this file ("Source Code") is provided by Linden Lab
11 * to you under the terms of the GNU General Public License, version 2.0
12 * ("GPL"), unless you have obtained a separate licensing agreement
13 * ("Other License"), formally executed by you and Linden Lab. Terms of
14 * the GPL can be found in doc/GPL-license.txt in this distribution, or
15 * online at http://secondlife.com/developers/opensource/gplv2
16 *
17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlife.com/developers/opensource/flossexception
21 *
22 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above,
24 * and agree to abide by those obligations.
25 *
26 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
27 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
28 * COMPLETENESS OR PERFORMANCE.
29 */
30
31#ifndef LL_LLMETRICS_H
32#define LL_LLMETRICS_H
33
34class LLMetricsImpl;
35class LLSD;
36
37class LLMetrics
38{
39public:
40 LLMetrics();
41 virtual ~LLMetrics();
42
43 // Adds this event to aggregate totals and records details to syslog (llinfos)
44 virtual void recordEventDetails(const std::string& location,
45 const std::string& mesg,
46 bool success,
47 LLSD stats);
48
49 // Adds this event to aggregate totals
50 virtual void recordEvent(const std::string& location, const std::string& mesg, bool success);
51
52 // Prints aggregate totals and resets the counts.
53 virtual void printTotals(LLSD meta);
54
55
56private:
57
58 LLMetricsImpl* mImpl;
59};
60
61#endif
62
diff --git a/linden/indra/llcommon/llprocessor.cpp b/linden/indra/llcommon/llprocessor.cpp
index d269e35..40dc00c 100644
--- a/linden/indra/llcommon/llprocessor.cpp
+++ b/linden/indra/llcommon/llprocessor.cpp
@@ -277,7 +277,7 @@ bool CProcessor::AnalyzeIntelProcessor()
277 277
278 // Only override the brand if we have it in the lookup table. We should 278 // Only override the brand if we have it in the lookup table. We should
279 // already have a string here from GetCPUInfo(). JC 279 // already have a string here from GetCPUInfo(). JC
280 if (CPUInfo.uiBrandID < sizeof(INTEL_BRAND)) 280 if (CPUInfo.uiBrandID < (sizeof(INTEL_BRAND)/sizeof(INTEL_BRAND[0])))
281 { 281 {
282 strcpy(CPUInfo.strBrandID, INTEL_BRAND[CPUInfo.uiBrandID]); 282 strcpy(CPUInfo.strBrandID, INTEL_BRAND[CPUInfo.uiBrandID]);
283 283
diff --git a/linden/indra/llcommon/llsdutil.cpp b/linden/indra/llcommon/llsdutil.cpp
index d30afc7..85718ba 100644
--- a/linden/indra/llcommon/llsdutil.cpp
+++ b/linden/indra/llcommon/llsdutil.cpp
@@ -285,3 +285,16 @@ char* ll_print_sd(const LLSD& sd)
285 buffer[bufferSize - 1] = '\0'; 285 buffer[bufferSize - 1] = '\0';
286 return buffer; 286 return buffer;
287} 287}
288
289char* ll_pretty_print_sd(const LLSD& sd)
290{
291 const U32 bufferSize = 10 * 1024;
292 static char buffer[bufferSize];
293 std::ostringstream stream;
294 //stream.rdbuf()->pubsetbuf(buffer, bufferSize);
295 stream << LLSDOStreamer<LLSDXMLFormatter>(sd, LLSDFormatter::OPTIONS_PRETTY);
296 stream << std::ends;
297 strncpy(buffer, stream.str().c_str(), bufferSize);
298 buffer[bufferSize - 1] = '\0';
299 return buffer;
300} \ No newline at end of file
diff --git a/linden/indra/llcommon/llsdutil.h b/linden/indra/llcommon/llsdutil.h
index 6344c50..38a7b83 100644
--- a/linden/indra/llcommon/llsdutil.h
+++ b/linden/indra/llcommon/llsdutil.h
@@ -85,4 +85,7 @@ LLSD ll_binary_from_string(const LLSD& sd);
85// Serializes sd to static buffer and returns pointer, useful for gdb debugging. 85// Serializes sd to static buffer and returns pointer, useful for gdb debugging.
86char* ll_print_sd(const LLSD& sd); 86char* ll_print_sd(const LLSD& sd);
87 87
88// Serializes sd to static buffer and returns pointer, using "pretty printing" mode.
89char* ll_pretty_print_sd(const LLSD& sd);
90
88#endif // LL_LLSDUTIL_H 91#endif // LL_LLSDUTIL_H
diff --git a/linden/indra/llcommon/llthread.h b/linden/indra/llcommon/llthread.h
index adb04a5..c863322 100644
--- a/linden/indra/llcommon/llthread.h
+++ b/linden/indra/llcommon/llthread.h
@@ -239,8 +239,9 @@ private:
239// Pure virtual class 239// Pure virtual class
240class LLResponder : public LLThreadSafeRefCount 240class LLResponder : public LLThreadSafeRefCount
241{ 241{
242public: 242protected:
243 virtual ~LLResponder(); 243 virtual ~LLResponder();
244public:
244 virtual void completed(bool success) = 0; 245 virtual void completed(bool success) = 0;
245}; 246};
246 247
diff --git a/linden/indra/llcommon/llversion.h b/linden/indra/llcommon/llversion.h
index f2ea20d..57b1512 100644
--- a/linden/indra/llcommon/llversion.h
+++ b/linden/indra/llcommon/llversion.h
@@ -30,8 +30,8 @@
30#define LL_LLVERSION_H 30#define LL_LLVERSION_H
31 31
32const S32 LL_VERSION_MAJOR = 1; 32const S32 LL_VERSION_MAJOR = 1;
33const S32 LL_VERSION_MINOR = 16; 33const S32 LL_VERSION_MINOR = 17;
34const S32 LL_VERSION_PATCH = 0; 34const S32 LL_VERSION_PATCH = 0;
35const S32 LL_VERSION_BUILD = 5; 35const S32 LL_VERSION_BUILD = 12;
36 36
37#endif 37#endif