aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Monitoring/SimExtraStatsCollector.cs
diff options
context:
space:
mode:
authorDavid Walter Seikel2016-11-03 21:44:39 +1000
committerDavid Walter Seikel2016-11-03 21:44:39 +1000
commit134f86e8d5c414409631b25b8c6f0ee45fbd8631 (patch)
tree216b89d3fb89acfb81be1e440c25c41ab09fa96d /OpenSim/Framework/Monitoring/SimExtraStatsCollector.cs
parentMore changing to production grid. Double oops. (diff)
downloadopensim-SC-134f86e8d5c414409631b25b8c6f0ee45fbd8631.zip
opensim-SC-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.gz
opensim-SC-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.bz2
opensim-SC-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.xz
Initial update to OpenSim 0.8.2.1 source code.
Diffstat (limited to '')
-rwxr-xr-x[-rw-r--r--]OpenSim/Framework/Monitoring/SimExtraStatsCollector.cs106
1 files changed, 82 insertions, 24 deletions
diff --git a/OpenSim/Framework/Monitoring/SimExtraStatsCollector.cs b/OpenSim/Framework/Monitoring/SimExtraStatsCollector.cs
index aa86202..e4df7ee 100644..100755
--- a/OpenSim/Framework/Monitoring/SimExtraStatsCollector.cs
+++ b/OpenSim/Framework/Monitoring/SimExtraStatsCollector.cs
@@ -27,6 +27,8 @@
27 27
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Diagnostics;
31using System.Linq;
30using System.Text; 32using System.Text;
31using OpenMetaverse; 33using OpenMetaverse;
32using OpenMetaverse.StructuredData; 34using OpenMetaverse.StructuredData;
@@ -39,8 +41,6 @@ namespace OpenSim.Framework.Monitoring
39 /// </summary> 41 /// </summary>
40 public class SimExtraStatsCollector : BaseStatsCollector 42 public class SimExtraStatsCollector : BaseStatsCollector
41 { 43 {
42 private long abnormalClientThreadTerminations;
43
44// private long assetsInCache; 44// private long assetsInCache;
45// private long texturesInCache; 45// private long texturesInCache;
46// private long assetCacheMemoryUsage; 46// private long assetCacheMemoryUsage;
@@ -72,11 +72,11 @@ namespace OpenSim.Framework.Monitoring
72 private volatile float pendingUploads; 72 private volatile float pendingUploads;
73 private volatile float activeScripts; 73 private volatile float activeScripts;
74 private volatile float scriptLinesPerSecond; 74 private volatile float scriptLinesPerSecond;
75 75 private volatile float m_frameDilation;
76 /// <summary> 76 private volatile float m_usersLoggingIn;
77 /// Number of times that a client thread terminated because of an exception 77 private volatile float m_totalGeoPrims;
78 /// </summary> 78 private volatile float m_totalMeshes;
79 public long AbnormalClientThreadTerminations { get { return abnormalClientThreadTerminations; } } 79 private volatile float m_inUseThreads;
80 80
81// /// <summary> 81// /// <summary>
82// /// These statistics are being collected by push rather than pull. Pull would be simpler, but I had the 82// /// These statistics are being collected by push rather than pull. Pull would be simpler, but I had the
@@ -166,11 +166,6 @@ namespace OpenSim.Framework.Monitoring
166 private IDictionary<UUID, PacketQueueStatsCollector> packetQueueStatsCollectors 166 private IDictionary<UUID, PacketQueueStatsCollector> packetQueueStatsCollectors
167 = new Dictionary<UUID, PacketQueueStatsCollector>(); 167 = new Dictionary<UUID, PacketQueueStatsCollector>();
168 168
169 public void AddAbnormalClientThreadTermination()
170 {
171 abnormalClientThreadTerminations++;
172 }
173
174// public void AddAsset(AssetBase asset) 169// public void AddAsset(AssetBase asset)
175// { 170// {
176// assetsInCache++; 171// assetsInCache++;
@@ -260,6 +255,10 @@ namespace OpenSim.Framework.Monitoring
260 { 255 {
261 // FIXME: SimStats shouldn't allow an arbitrary stat packing order (which is inherited from the original 256 // FIXME: SimStats shouldn't allow an arbitrary stat packing order (which is inherited from the original
262 // SimStatsPacket that was being used). 257 // SimStatsPacket that was being used).
258
259 // For an unknown reason the original designers decided not to
260 // include the spare MS statistic inside of this class, this is
261 // located inside the StatsBlock at location 21, thus it is skipped
263 timeDilation = stats.StatsBlock[0].StatValue; 262 timeDilation = stats.StatsBlock[0].StatValue;
264 simFps = stats.StatsBlock[1].StatValue; 263 simFps = stats.StatsBlock[1].StatValue;
265 physicsFps = stats.StatsBlock[2].StatValue; 264 physicsFps = stats.StatsBlock[2].StatValue;
@@ -281,6 +280,11 @@ namespace OpenSim.Framework.Monitoring
281 pendingUploads = stats.StatsBlock[18].StatValue; 280 pendingUploads = stats.StatsBlock[18].StatValue;
282 activeScripts = stats.StatsBlock[19].StatValue; 281 activeScripts = stats.StatsBlock[19].StatValue;
283 scriptLinesPerSecond = stats.StatsBlock[20].StatValue; 282 scriptLinesPerSecond = stats.StatsBlock[20].StatValue;
283 m_frameDilation = stats.StatsBlock[22].StatValue;
284 m_usersLoggingIn = stats.StatsBlock[23].StatValue;
285 m_totalGeoPrims = stats.StatsBlock[24].StatValue;
286 m_totalMeshes = stats.StatsBlock[25].StatValue;
287 m_inUseThreads = stats.StatsBlock[26].StatValue;
284 } 288 }
285 289
286 /// <summary> 290 /// <summary>
@@ -324,10 +328,12 @@ Asset service request failures: {3}" + Environment.NewLine,
324 sb.Append(Environment.NewLine); 328 sb.Append(Environment.NewLine);
325 sb.Append("CONNECTION STATISTICS"); 329 sb.Append("CONNECTION STATISTICS");
326 sb.Append(Environment.NewLine); 330 sb.Append(Environment.NewLine);
327 sb.Append( 331
328 string.Format( 332 List<Stat> stats = StatsManager.GetStatsFromEachContainer("clientstack", "ClientLogoutsDueToNoReceives");
329 "Abnormal client thread terminations: {0}" + Environment.NewLine, 333
330 abnormalClientThreadTerminations)); 334 sb.AppendFormat(
335 "Client logouts due to no data receive timeout: {0}\n\n",
336 stats != null ? stats.Sum(s => s.Value).ToString() : "unknown");
331 337
332// sb.Append(Environment.NewLine); 338// sb.Append(Environment.NewLine);
333// sb.Append("INVENTORY STATISTICS"); 339// sb.Append("INVENTORY STATISTICS");
@@ -338,7 +344,7 @@ Asset service request failures: {3}" + Environment.NewLine,
338// InventoryServiceRetrievalFailures)); 344// InventoryServiceRetrievalFailures));
339 345
340 sb.Append(Environment.NewLine); 346 sb.Append(Environment.NewLine);
341 sb.Append("FRAME STATISTICS"); 347 sb.Append("SAMPLE FRAME STATISTICS");
342 sb.Append(Environment.NewLine); 348 sb.Append(Environment.NewLine);
343 sb.Append("Dilatn SimFPS PhyFPS AgntUp RootAg ChldAg Prims AtvPrm AtvScr ScrLPS"); 349 sb.Append("Dilatn SimFPS PhyFPS AgntUp RootAg ChldAg Prims AtvPrm AtvScr ScrLPS");
344 sb.Append(Environment.NewLine); 350 sb.Append(Environment.NewLine);
@@ -359,11 +365,12 @@ Asset service request failures: {3}" + Environment.NewLine,
359 inPacketsPerSecond, outPacketsPerSecond, pendingDownloads, pendingUploads, unackedBytes, totalFrameTime, 365 inPacketsPerSecond, outPacketsPerSecond, pendingDownloads, pendingUploads, unackedBytes, totalFrameTime,
360 netFrameTime, physicsFrameTime, otherFrameTime, agentFrameTime, imageFrameTime)); 366 netFrameTime, physicsFrameTime, otherFrameTime, agentFrameTime, imageFrameTime));
361 367
362 Dictionary<string, Dictionary<string, Stat>> sceneStats; 368 /* 20130319 RA: For the moment, disable the dump of 'scene' catagory as they are mostly output by
363 369 * the two formatted printouts above.
370 SortedDictionary<string, SortedDictionary<string, Stat>> sceneStats;
364 if (StatsManager.TryGetStats("scene", out sceneStats)) 371 if (StatsManager.TryGetStats("scene", out sceneStats))
365 { 372 {
366 foreach (KeyValuePair<string, Dictionary<string, Stat>> kvp in sceneStats) 373 foreach (KeyValuePair<string, SortedDictionary<string, Stat>> kvp in sceneStats)
367 { 374 {
368 foreach (Stat stat in kvp.Value.Values) 375 foreach (Stat stat in kvp.Value.Values)
369 { 376 {
@@ -374,6 +381,7 @@ Asset service request failures: {3}" + Environment.NewLine,
374 } 381 }
375 } 382 }
376 } 383 }
384 */
377 385
378 /* 386 /*
379 sb.Append(Environment.NewLine); 387 sb.Append(Environment.NewLine);
@@ -405,6 +413,36 @@ Asset service request failures: {3}" + Environment.NewLine,
405 /// <returns></returns> 413 /// <returns></returns>
406 public override string XReport(string uptime, string version) 414 public override string XReport(string uptime, string version)
407 { 415 {
416 return OSDParser.SerializeJsonString(OReport(uptime, version));
417 }
418
419 /// <summary>
420 /// Report back collected statistical information as an OSDMap
421 /// </summary>
422 /// <returns></returns>
423 public override OSDMap OReport(string uptime, string version)
424 {
425 // Get the amount of physical memory, allocated with the instance of this program, in kilobytes;
426 // the working set is the set of memory pages currently visible to this program in physical RAM
427 // memory and includes both shared (e.g. system libraries) and private data
428 double memUsage = Process.GetCurrentProcess().WorkingSet64 / 1024.0;
429
430 // Get the number of threads from the system that are currently
431 // running
432 int numberThreadsRunning = 0;
433 foreach (ProcessThread currentThread in
434 Process.GetCurrentProcess().Threads)
435 {
436 // A known issue with the current process .Threads property is
437 // that it can return null threads, thus don't count those as
438 // running threads and prevent the program function from failing
439 if (currentThread != null &&
440 currentThread.ThreadState == ThreadState.Running)
441 {
442 numberThreadsRunning++;
443 }
444 }
445
408 OSDMap args = new OSDMap(30); 446 OSDMap args = new OSDMap(30);
409// args["AssetsInCache"] = OSD.FromString (String.Format ("{0:0.##}", AssetsInCache)); 447// args["AssetsInCache"] = OSD.FromString (String.Format ("{0:0.##}", AssetsInCache));
410// args["TimeAfterCacheMiss"] = OSD.FromString (String.Format ("{0:0.##}", 448// args["TimeAfterCacheMiss"] = OSD.FromString (String.Format ("{0:0.##}",
@@ -441,14 +479,28 @@ Asset service request failures: {3}" + Environment.NewLine,
441 args["Memory"] = OSD.FromString (base.XReport (uptime, version)); 479 args["Memory"] = OSD.FromString (base.XReport (uptime, version));
442 args["Uptime"] = OSD.FromString (uptime); 480 args["Uptime"] = OSD.FromString (uptime);
443 args["Version"] = OSD.FromString (version); 481 args["Version"] = OSD.FromString (version);
444
445 string strBuffer = "";
446 strBuffer = OSDParser.SerializeJsonString(args);
447 482
448 return strBuffer; 483 args["FrameDilatn"] = OSD.FromString(String.Format("{0:0.##}", m_frameDilation));
484 args["Logging in Users"] = OSD.FromString(String.Format("{0:0.##}",
485 m_usersLoggingIn));
486 args["GeoPrims"] = OSD.FromString(String.Format("{0:0.##}",
487 m_totalGeoPrims));
488 args["Mesh Objects"] = OSD.FromString(String.Format("{0:0.##}",
489 m_totalMeshes));
490 args["XEngine Thread Count"] = OSD.FromString(String.Format("{0:0.##}",
491 m_inUseThreads));
492 args["Util Thread Count"] = OSD.FromString(String.Format("{0:0.##}",
493 Util.GetSmartThreadPoolInfo().InUseThreads));
494 args["System Thread Count"] = OSD.FromString(String.Format(
495 "{0:0.##}", numberThreadsRunning));
496 args["ProcMem"] = OSD.FromString(String.Format("{0:#,###,###.##}",
497 memUsage));
498
499 return args;
449 } 500 }
450 } 501 }
451 502
503
452 /// <summary> 504 /// <summary>
453 /// Pull packet queue stats from packet queues and report 505 /// Pull packet queue stats from packet queues and report
454 /// </summary> 506 /// </summary>
@@ -474,5 +526,11 @@ Asset service request failures: {3}" + Environment.NewLine,
474 { 526 {
475 return ""; 527 return "";
476 } 528 }
529
530 public OSDMap OReport(string uptime, string version)
531 {
532 OSDMap ret = new OSDMap();
533 return ret;
534 }
477 } 535 }
478} 536}