diff options
author | Justin Clark-Casey (justincc) | 2013-07-29 23:18:29 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2013-07-29 23:18:29 +0100 |
commit | 8efe4bfc2ed7086e9fdf4812297e6525f955f6ac (patch) | |
tree | 4899da4147d32f79654aab32f33e7f0754b6144f /OpenSim/Framework/Monitoring/StatsManager.cs | |
parent | Groups: Better warning messages to the user. (diff) | |
download | opensim-SC-8efe4bfc2ed7086e9fdf4812297e6525f955f6ac.zip opensim-SC-8efe4bfc2ed7086e9fdf4812297e6525f955f6ac.tar.gz opensim-SC-8efe4bfc2ed7086e9fdf4812297e6525f955f6ac.tar.bz2 opensim-SC-8efe4bfc2ed7086e9fdf4812297e6525f955f6ac.tar.xz |
Make "abnormal thread terminations" into "ClientLogoutsDueToNoReceives" and add this to the StatsManager
This reflects the actual use of this stat - it hasn't recorded general exceptions for some time.
Make the sim extra stats collector draw the data from the stats manager rather than maintaing this data itself.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Framework/Monitoring/StatsManager.cs | 65 |
1 files changed, 60 insertions, 5 deletions
diff --git a/OpenSim/Framework/Monitoring/StatsManager.cs b/OpenSim/Framework/Monitoring/StatsManager.cs index a5b54c9..e6a2304 100644 --- a/OpenSim/Framework/Monitoring/StatsManager.cs +++ b/OpenSim/Framework/Monitoring/StatsManager.cs | |||
@@ -271,7 +271,7 @@ namespace OpenSim.Framework.Monitoring | |||
271 | // Stat name is not unique across category/container/shortname key. | 271 | // Stat name is not unique across category/container/shortname key. |
272 | // XXX: For now just return false. This is to avoid problems in regression tests where all tests | 272 | // XXX: For now just return false. This is to avoid problems in regression tests where all tests |
273 | // in a class are run in the same instance of the VM. | 273 | // in a class are run in the same instance of the VM. |
274 | if (TryGetStat(stat, out category, out container)) | 274 | if (TryGetStatParents(stat, out category, out container)) |
275 | return false; | 275 | return false; |
276 | 276 | ||
277 | // We take a copy-on-write approach here of replacing dictionaries when keys are added or removed. | 277 | // We take a copy-on-write approach here of replacing dictionaries when keys are added or removed. |
@@ -307,7 +307,7 @@ namespace OpenSim.Framework.Monitoring | |||
307 | 307 | ||
308 | lock (RegisteredStats) | 308 | lock (RegisteredStats) |
309 | { | 309 | { |
310 | if (!TryGetStat(stat, out category, out container)) | 310 | if (!TryGetStatParents(stat, out category, out container)) |
311 | return false; | 311 | return false; |
312 | 312 | ||
313 | newContainer = new SortedDictionary<string, Stat>(container); | 313 | newContainer = new SortedDictionary<string, Stat>(container); |
@@ -323,12 +323,67 @@ namespace OpenSim.Framework.Monitoring | |||
323 | } | 323 | } |
324 | } | 324 | } |
325 | 325 | ||
326 | public static bool TryGetStats(string category, out SortedDictionary<string, SortedDictionary<string, Stat>> stats) | 326 | public static bool TryGetStat(string category, string container, string statShortName, out Stat stat) |
327 | { | 327 | { |
328 | return RegisteredStats.TryGetValue(category, out stats); | 328 | stat = null; |
329 | SortedDictionary<string, SortedDictionary<string, Stat>> categoryStats; | ||
330 | |||
331 | lock (RegisteredStats) | ||
332 | { | ||
333 | if (!TryGetStatsForCategory(category, out categoryStats)) | ||
334 | return false; | ||
335 | |||
336 | SortedDictionary<string, Stat> containerStats; | ||
337 | |||
338 | if (!categoryStats.TryGetValue(container, out containerStats)) | ||
339 | return false; | ||
340 | |||
341 | return containerStats.TryGetValue(statShortName, out stat); | ||
342 | } | ||
343 | } | ||
344 | |||
345 | public static bool TryGetStatsForCategory( | ||
346 | string category, out SortedDictionary<string, SortedDictionary<string, Stat>> stats) | ||
347 | { | ||
348 | lock (RegisteredStats) | ||
349 | return RegisteredStats.TryGetValue(category, out stats); | ||
350 | } | ||
351 | |||
352 | /// <summary> | ||
353 | /// Get the same stat for each container in a given category. | ||
354 | /// </summary> | ||
355 | /// <returns> | ||
356 | /// The stats if there were any to fetch. Otherwise null. | ||
357 | /// </returns> | ||
358 | /// <param name='category'></param> | ||
359 | /// <param name='statShortName'></param> | ||
360 | public static List<Stat> GetStatsFromEachContainer(string category, string statShortName) | ||
361 | { | ||
362 | SortedDictionary<string, SortedDictionary<string, Stat>> categoryStats; | ||
363 | |||
364 | lock (RegisteredStats) | ||
365 | { | ||
366 | if (!RegisteredStats.TryGetValue(category, out categoryStats)) | ||
367 | return null; | ||
368 | |||
369 | List<Stat> stats = null; | ||
370 | |||
371 | foreach (SortedDictionary<string, Stat> containerStats in categoryStats.Values) | ||
372 | { | ||
373 | if (containerStats.ContainsKey(statShortName)) | ||
374 | { | ||
375 | if (stats == null) | ||
376 | stats = new List<Stat>(); | ||
377 | |||
378 | stats.Add(containerStats[statShortName]); | ||
379 | } | ||
380 | } | ||
381 | |||
382 | return stats; | ||
383 | } | ||
329 | } | 384 | } |
330 | 385 | ||
331 | public static bool TryGetStat( | 386 | public static bool TryGetStatParents( |
332 | Stat stat, | 387 | Stat stat, |
333 | out SortedDictionary<string, SortedDictionary<string, Stat>> category, | 388 | out SortedDictionary<string, SortedDictionary<string, Stat>> category, |
334 | out SortedDictionary<string, Stat> container) | 389 | out SortedDictionary<string, Stat> container) |