aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r--OpenSim/Framework/Monitoring/StatsManager.cs87
-rw-r--r--OpenSim/Framework/Pool.cs15
-rw-r--r--OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs12
3 files changed, 87 insertions, 27 deletions
diff --git a/OpenSim/Framework/Monitoring/StatsManager.cs b/OpenSim/Framework/Monitoring/StatsManager.cs
index 31989e5..4844336 100644
--- a/OpenSim/Framework/Monitoring/StatsManager.cs
+++ b/OpenSim/Framework/Monitoring/StatsManager.cs
@@ -207,7 +207,7 @@ namespace OpenSim.Framework.Monitoring
207 return false; 207 return false;
208 208
209 newContainer = new Dictionary<string, Stat>(container); 209 newContainer = new Dictionary<string, Stat>(container);
210 newContainer.Remove(stat.UniqueName); 210 newContainer.Remove(stat.ShortName);
211 211
212 newCategory = new Dictionary<string, Dictionary<string, Stat>>(category); 212 newCategory = new Dictionary<string, Dictionary<string, Stat>>(category);
213 newCategory.Remove(stat.Container); 213 newCategory.Remove(stat.Container);
@@ -249,6 +249,19 @@ namespace OpenSim.Framework.Monitoring
249 } 249 }
250 250
251 /// <summary> 251 /// <summary>
252 /// Stat type.
253 /// </summary>
254 /// <remarks>
255 /// A push stat is one which is continually updated and so it's value can simply by read.
256 /// A pull stat is one where reading the value triggers a collection method - the stat is not continually updated.
257 /// </remarks>
258 public enum StatType
259 {
260 Push,
261 Pull
262 }
263
264 /// <summary>
252 /// Verbosity of stat. 265 /// Verbosity of stat.
253 /// </summary> 266 /// </summary>
254 /// <remarks> 267 /// <remarks>
@@ -266,11 +279,6 @@ namespace OpenSim.Framework.Monitoring
266 public class Stat 279 public class Stat
267 { 280 {
268 /// <summary> 281 /// <summary>
269 /// Unique stat name used for indexing. Each ShortName in a Category must be unique.
270 /// </summary>
271 public string UniqueName { get; private set; }
272
273 /// <summary>
274 /// Category of this stat (e.g. cache, scene, etc). 282 /// Category of this stat (e.g. cache, scene, etc).
275 /// </summary> 283 /// </summary>
276 public string Category { get; private set; } 284 public string Category { get; private set; }
@@ -285,29 +293,65 @@ namespace OpenSim.Framework.Monitoring
285 /// </value> 293 /// </value>
286 public string Container { get; private set; } 294 public string Container { get; private set; }
287 295
296 public StatType StatType { get; private set; }
297
298 /// <summary>
299 /// Action used to update this stat when the value is requested if it's a pull type.
300 /// </summary>
301 public Action<Stat> PullAction { get; private set; }
302
288 public StatVerbosity Verbosity { get; private set; } 303 public StatVerbosity Verbosity { get; private set; }
289 public string ShortName { get; private set; } 304 public string ShortName { get; private set; }
290 public string Name { get; private set; } 305 public string Name { get; private set; }
291 public string Description { get; private set; } 306 public string Description { get; private set; }
292 public virtual string UnitName { get; private set; } 307 public virtual string UnitName { get; private set; }
293 308
294 public virtual double Value { get; set; } 309 public virtual double Value
310 {
311 get
312 {
313 // Asking for an update here means that the updater cannot access this value without infinite recursion.
314 // XXX: A slightly messy but simple solution may be to flick a flag so we can tell if this is being
315 // called by the pull action and just return the value.
316 if (StatType == StatType.Pull)
317 PullAction(this);
318
319 return m_value;
320 }
321
322 set
323 {
324 m_value = value;
325 }
326 }
327
328 private double m_value;
295 329
296 /// <summary> 330 /// <summary>
297 /// Constructor 331 /// Constructor
298 /// </summary> 332 /// </summary>
299 /// <param name='shortName'>Short name for the stat. Must not contain spaces. e.g. "LongFrames"</param> 333 /// <param name='shortName'>Short name for the stat. Must not contain spaces. e.g. "LongFrames"</param>
300 /// <param name='name'>Human readable name for the stat. e.g. "Long frames"</param> 334 /// <param name='name'>Human readable name for the stat. e.g. "Long frames"</param>
335 /// <param name='description'>Description of stat</param>
301 /// <param name='unitName'> 336 /// <param name='unitName'>
302 /// Unit name for the stat. Should be preceeded by a space if the unit name isn't normally appeneded immediately to the value. 337 /// Unit name for the stat. Should be preceeded by a space if the unit name isn't normally appeneded immediately to the value.
303 /// e.g. " frames" 338 /// e.g. " frames"
304 /// </param> 339 /// </param>
305 /// <param name='category'>Category under which this stat should appear, e.g. "scene". Do not capitalize.</param> 340 /// <param name='category'>Category under which this stat should appear, e.g. "scene". Do not capitalize.</param>
306 /// <param name='container'>Entity to which this stat relates. e.g. scene name if this is a per scene stat.</param> 341 /// <param name='container'>Entity to which this stat relates. e.g. scene name if this is a per scene stat.</param>
342 /// <param name='type'>Push or pull</param>
343 /// <param name='pullAction'>Pull stats need an action to update the stat on request. Push stats should set null here.</param>
307 /// <param name='verbosity'>Verbosity of stat. Controls whether it will appear in short stat display or only full display.</param> 344 /// <param name='verbosity'>Verbosity of stat. Controls whether it will appear in short stat display or only full display.</param>
308 /// <param name='description'>Description of stat</param>
309 public Stat( 345 public Stat(
310 string shortName, string name, string unitName, string category, string container, StatVerbosity verbosity, string description) 346 string shortName,
347 string name,
348 string description,
349 string unitName,
350 string category,
351 string container,
352 StatType type,
353 Action<Stat> pullAction,
354 StatVerbosity verbosity)
311 { 355 {
312 if (StatsManager.SubCommands.Contains(category)) 356 if (StatsManager.SubCommands.Contains(category))
313 throw new Exception( 357 throw new Exception(
@@ -315,18 +359,18 @@ namespace OpenSim.Framework.Monitoring
315 359
316 ShortName = shortName; 360 ShortName = shortName;
317 Name = name; 361 Name = name;
362 Description = description;
318 UnitName = unitName; 363 UnitName = unitName;
319 Category = category; 364 Category = category;
320 Container = container; 365 Container = container;
321 Verbosity = verbosity; 366 StatType = type;
322 Description = description;
323 367
324 UniqueName = GenUniqueName(Container, Category, ShortName); 368 if (StatType == StatType.Push && pullAction != null)
325 } 369 throw new Exception("A push stat cannot have a pull action");
370 else
371 PullAction = pullAction;
326 372
327 public static string GenUniqueName(string container, string category, string shortName) 373 Verbosity = verbosity;
328 {
329 return string.Format("{0}+{1}+{2}", container, category, shortName);
330 } 374 }
331 375
332 public virtual string ToConsoleString() 376 public virtual string ToConsoleString()
@@ -361,8 +405,15 @@ namespace OpenSim.Framework.Monitoring
361 } 405 }
362 406
363 public PercentageStat( 407 public PercentageStat(
364 string shortName, string name, string category, string container, StatVerbosity verbosity, string description) 408 string shortName,
365 : base(shortName, name, "%", category, container, verbosity, description) {} 409 string name,
410 string description,
411 string category,
412 string container,
413 StatType type,
414 Action<Stat> pullAction,
415 StatVerbosity verbosity)
416 : base(shortName, name, description, "%", category, container, type, pullAction, verbosity) {}
366 417
367 public override string ToConsoleString() 418 public override string ToConsoleString()
368 { 419 {
diff --git a/OpenSim/Framework/Pool.cs b/OpenSim/Framework/Pool.cs
index 1ca06c3..5484f5c 100644
--- a/OpenSim/Framework/Pool.cs
+++ b/OpenSim/Framework/Pool.cs
@@ -38,8 +38,23 @@ namespace OpenSim.Framework
38 /// </remarks> 38 /// </remarks>
39 public class Pool<T> 39 public class Pool<T>
40 { 40 {
41 /// <summary>
42 /// Number of objects in the pool.
43 /// </summary>
44 public int Count
45 {
46 get
47 {
48 lock (m_pool)
49 return m_pool.Count;
50 }
51 }
52
41 private Stack<T> m_pool; 53 private Stack<T> m_pool;
42 54
55 /// <summary>
56 /// Maximum pool size. Beyond this, any returned objects are not pooled.
57 /// </summary>
43 private int m_maxPoolSize; 58 private int m_maxPoolSize;
44 59
45 private Func<T> m_createFunction; 60 private Func<T> m_createFunction;
diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
index b3e31a6..3198891 100644
--- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
+++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
@@ -543,11 +543,8 @@ namespace OpenSim.Framework.Servers.HttpServer
543 { 543 {
544 case null: 544 case null:
545 case "text/html": 545 case "text/html":
546
547 if (DebugLevel >= 3) 546 if (DebugLevel >= 3)
548 m_log.DebugFormat( 547 LogIncomingToContentTypeHandler(request);
549 "[BASE HTTP SERVER]: HTTP IN {0} :{1} {2} content type handler {3} {4} from {5}",
550 RequestNumber, Port, request.ContentType, request.HttpMethod, request.Url.PathAndQuery, request.RemoteIPEndPoint);
551 548
552 buffer = HandleHTTPRequest(request, response); 549 buffer = HandleHTTPRequest(request, response);
553 break; 550 break;
@@ -555,11 +552,8 @@ namespace OpenSim.Framework.Servers.HttpServer
555 case "application/llsd+xml": 552 case "application/llsd+xml":
556 case "application/xml+llsd": 553 case "application/xml+llsd":
557 case "application/llsd+json": 554 case "application/llsd+json":
558
559 if (DebugLevel >= 3) 555 if (DebugLevel >= 3)
560 m_log.DebugFormat( 556 LogIncomingToContentTypeHandler(request);
561 "[BASE HTTP SERVER]: HTTP IN {0} :{1} {2} content type handler {3} {4} from {5}",
562 RequestNumber, Port, request.ContentType, request.HttpMethod, request.Url.PathAndQuery, request.RemoteIPEndPoint);
563 557
564 buffer = HandleLLSDRequests(request, response); 558 buffer = HandleLLSDRequests(request, response);
565 break; 559 break;
@@ -694,7 +688,7 @@ namespace OpenSim.Framework.Servers.HttpServer
694 "[BASE HTTP SERVER]: HTTP IN {0} :{1} {2} content type handler {3} {4} from {5}", 688 "[BASE HTTP SERVER]: HTTP IN {0} :{1} {2} content type handler {3} {4} from {5}",
695 RequestNumber, 689 RequestNumber,
696 Port, 690 Port,
697 request.ContentType, 691 (request.ContentType == null || request.ContentType == "") ? "not set" : request.ContentType,
698 request.HttpMethod, 692 request.HttpMethod,
699 request.Url.PathAndQuery, 693 request.Url.PathAndQuery,
700 request.RemoteIPEndPoint); 694 request.RemoteIPEndPoint);