mirror of
https://github.com/opensim/opensim.git
synced 2026-08-06 17:32:42 +08:00
Moved over metrics from previous OpenSim 0.8.0.3 repository (this new repository is now the master branch from OpenSim).
This commit is contained in:
47
OpenSim/Framework/Monitoring/SimExtraStatsCollector.cs
Normal file → Executable file
47
OpenSim/Framework/Monitoring/SimExtraStatsCollector.cs
Normal file → Executable file
@@ -27,6 +27,7 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using OpenMetaverse;
|
||||
@@ -71,6 +72,10 @@ namespace OpenSim.Framework.Monitoring
|
||||
private volatile float pendingUploads;
|
||||
private volatile float activeScripts;
|
||||
private volatile float scriptLinesPerSecond;
|
||||
private volatile float m_usersLoggingIn;
|
||||
private volatile float m_totalGeoPrims;
|
||||
private volatile float m_totalMeshes;
|
||||
private volatile float m_inUseThreads;
|
||||
|
||||
// /// <summary>
|
||||
// /// These statistics are being collected by push rather than pull. Pull would be simpler, but I had the
|
||||
@@ -249,6 +254,10 @@ namespace OpenSim.Framework.Monitoring
|
||||
{
|
||||
// FIXME: SimStats shouldn't allow an arbitrary stat packing order (which is inherited from the original
|
||||
// SimStatsPacket that was being used).
|
||||
|
||||
// For an unknown reason the original designers decided not to
|
||||
// include the spare MS statistic inside of this class, this is
|
||||
// located inside the StatsBlock at location 21 thus it is skipped
|
||||
timeDilation = stats.StatsBlock[0].StatValue;
|
||||
simFps = stats.StatsBlock[1].StatValue;
|
||||
physicsFps = stats.StatsBlock[2].StatValue;
|
||||
@@ -270,6 +279,10 @@ namespace OpenSim.Framework.Monitoring
|
||||
pendingUploads = stats.StatsBlock[18].StatValue;
|
||||
activeScripts = stats.StatsBlock[19].StatValue;
|
||||
scriptLinesPerSecond = stats.StatsBlock[20].StatValue;
|
||||
m_usersLoggingIn = stats.StatsBlock[22].StatValue;
|
||||
m_totalGeoPrims = stats.StatsBlock[23].StatValue;
|
||||
m_totalMeshes = stats.StatsBlock[24].StatValue;
|
||||
m_inUseThreads = stats.StatsBlock[25].StatValue;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -407,6 +420,23 @@ Asset service request failures: {3}" + Environment.NewLine,
|
||||
/// <returns></returns>
|
||||
public override OSDMap OReport(string uptime, string version)
|
||||
{
|
||||
// Get the amount of physical memory, allocated with the instance of this program, in kilobytes;
|
||||
// the working set is the set of memory pages currently visible to this program in physical RAM
|
||||
// memory and includes both shared (e.g. system libraries) and private data
|
||||
double memUsage = Process.GetCurrentProcess().WorkingSet64 / 1024.0;
|
||||
|
||||
// Get the number of threads from the system that are currently
|
||||
// running
|
||||
int numberThreadsRunning = 0;
|
||||
foreach (ProcessThread currentThread in
|
||||
Process.GetCurrentProcess().Threads)
|
||||
{
|
||||
if (currentThread.ThreadState == ThreadState.Running)
|
||||
{
|
||||
numberThreadsRunning++;
|
||||
}
|
||||
}
|
||||
|
||||
OSDMap args = new OSDMap(30);
|
||||
// args["AssetsInCache"] = OSD.FromString (String.Format ("{0:0.##}", AssetsInCache));
|
||||
// args["TimeAfterCacheMiss"] = OSD.FromString (String.Format ("{0:0.##}",
|
||||
@@ -443,6 +473,23 @@ Asset service request failures: {3}" + Environment.NewLine,
|
||||
args["Memory"] = OSD.FromString (base.XReport (uptime, version));
|
||||
args["Uptime"] = OSD.FromString (uptime);
|
||||
args["Version"] = OSD.FromString (version);
|
||||
|
||||
args["Logging in Users"] = OSD.FromString(String.Format("{0:0.##}",
|
||||
m_usersLoggingIn));
|
||||
args["GeoPrims"] = OSD.FromString(String.Format("{0:0.##}",
|
||||
m_totalGeoPrims));
|
||||
args["Mesh Objects"] = OSD.FromString(String.Format("{0:0.##}",
|
||||
m_totalMeshes));
|
||||
args["Polygon Count"] = OSD.FromString(String.Format("{0:0.##}", 0));
|
||||
args["Texture Count"] = OSD.FromString(String.Format("{0:0.##}", 0));
|
||||
args["XEngine Thread Count"] = OSD.FromString(String.Format("{0:0.##}",
|
||||
m_inUseThreads));
|
||||
args["Util Thread Count"] = OSD.FromString(String.Format("{0:0.##}",
|
||||
Util.GetSmartThreadPoolInfo().InUseThreads));
|
||||
args["System Thread Count"] = OSD.FromString(String.Format(
|
||||
"{0:0.##}", numberThreadsRunning));
|
||||
args["ProcMem"] = OSD.FromString(String.Format("{0:#,###,###.##}",
|
||||
memUsage));
|
||||
|
||||
return args;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user