diff options
Diffstat (limited to 'OpenSim/Framework/Monitoring/SimExtraStatsCollector.cs')
-rwxr-xr-x[-rw-r--r--] | OpenSim/Framework/Monitoring/SimExtraStatsCollector.cs | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/OpenSim/Framework/Monitoring/SimExtraStatsCollector.cs b/OpenSim/Framework/Monitoring/SimExtraStatsCollector.cs index f6f458d..e4df7ee 100644..100755 --- a/OpenSim/Framework/Monitoring/SimExtraStatsCollector.cs +++ b/OpenSim/Framework/Monitoring/SimExtraStatsCollector.cs | |||
@@ -27,6 +27,7 @@ | |||
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Diagnostics; | ||
30 | using System.Linq; | 31 | using System.Linq; |
31 | using System.Text; | 32 | using System.Text; |
32 | using OpenMetaverse; | 33 | using OpenMetaverse; |
@@ -71,6 +72,11 @@ namespace OpenSim.Framework.Monitoring | |||
71 | private volatile float pendingUploads; | 72 | private volatile float pendingUploads; |
72 | private volatile float activeScripts; | 73 | private volatile float activeScripts; |
73 | private volatile float scriptLinesPerSecond; | 74 | private volatile float scriptLinesPerSecond; |
75 | private volatile float m_frameDilation; | ||
76 | private volatile float m_usersLoggingIn; | ||
77 | private volatile float m_totalGeoPrims; | ||
78 | private volatile float m_totalMeshes; | ||
79 | private volatile float m_inUseThreads; | ||
74 | 80 | ||
75 | // /// <summary> | 81 | // /// <summary> |
76 | // /// 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 |
@@ -249,6 +255,10 @@ namespace OpenSim.Framework.Monitoring | |||
249 | { | 255 | { |
250 | // 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 |
251 | // 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 | ||
252 | timeDilation = stats.StatsBlock[0].StatValue; | 262 | timeDilation = stats.StatsBlock[0].StatValue; |
253 | simFps = stats.StatsBlock[1].StatValue; | 263 | simFps = stats.StatsBlock[1].StatValue; |
254 | physicsFps = stats.StatsBlock[2].StatValue; | 264 | physicsFps = stats.StatsBlock[2].StatValue; |
@@ -270,6 +280,11 @@ namespace OpenSim.Framework.Monitoring | |||
270 | pendingUploads = stats.StatsBlock[18].StatValue; | 280 | pendingUploads = stats.StatsBlock[18].StatValue; |
271 | activeScripts = stats.StatsBlock[19].StatValue; | 281 | activeScripts = stats.StatsBlock[19].StatValue; |
272 | 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; | ||
273 | } | 288 | } |
274 | 289 | ||
275 | /// <summary> | 290 | /// <summary> |
@@ -407,6 +422,27 @@ Asset service request failures: {3}" + Environment.NewLine, | |||
407 | /// <returns></returns> | 422 | /// <returns></returns> |
408 | public override OSDMap OReport(string uptime, string version) | 423 | public override OSDMap OReport(string uptime, string version) |
409 | { | 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 | |||
410 | OSDMap args = new OSDMap(30); | 446 | OSDMap args = new OSDMap(30); |
411 | // args["AssetsInCache"] = OSD.FromString (String.Format ("{0:0.##}", AssetsInCache)); | 447 | // args["AssetsInCache"] = OSD.FromString (String.Format ("{0:0.##}", AssetsInCache)); |
412 | // args["TimeAfterCacheMiss"] = OSD.FromString (String.Format ("{0:0.##}", | 448 | // args["TimeAfterCacheMiss"] = OSD.FromString (String.Format ("{0:0.##}", |
@@ -443,6 +479,22 @@ Asset service request failures: {3}" + Environment.NewLine, | |||
443 | args["Memory"] = OSD.FromString (base.XReport (uptime, version)); | 479 | args["Memory"] = OSD.FromString (base.XReport (uptime, version)); |
444 | args["Uptime"] = OSD.FromString (uptime); | 480 | args["Uptime"] = OSD.FromString (uptime); |
445 | args["Version"] = OSD.FromString (version); | 481 | args["Version"] = OSD.FromString (version); |
482 | |||
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)); | ||
446 | 498 | ||
447 | return args; | 499 | return args; |
448 | } | 500 | } |