Add other region stats (total frame time, physics fps, etc.) currently missing from MonitorModule
Unlike the other 3 stats mechanisms, monitor data can be queried per individual region, which makes this useful. This doesn't affect an of the existing monitored stats.0.7.2-post-fixes
parent
29a62abc6d
commit
3678b8f1f7
|
@ -29,8 +29,31 @@ namespace OpenSim.Region.CoreModules.Framework.Monitoring
|
|||
{
|
||||
interface IMonitor
|
||||
{
|
||||
double GetValue();
|
||||
/// <summary>
|
||||
/// Name of the monitor.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This is the name used in XML.
|
||||
/// </remarks>
|
||||
/// <returns></returns>
|
||||
string GetName();
|
||||
string GetFriendlyValue(); // Convert to readable numbers
|
||||
|
||||
/// <summary>
|
||||
/// Value of this monitor
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
double GetValue();
|
||||
|
||||
/// <summary>
|
||||
/// Human-readable name of the monitor
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
string GetFriendlyName();
|
||||
|
||||
/// <summary>
|
||||
/// Human readable value.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
string GetFriendlyValue();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -82,7 +82,7 @@ namespace OpenSim.Region.CoreModules.Framework.Monitoring
|
|||
{
|
||||
foreach (IMonitor monitor in m_monitors)
|
||||
{
|
||||
m_log.Info("[MonitorModule]: " + m_scene.RegionInfo.RegionName + " reports " + monitor.GetName() + " = " + monitor.GetFriendlyValue());
|
||||
m_log.Info("[MonitorModule]: " + m_scene.RegionInfo.RegionName + " reports " + monitor.GetFriendlyName() + " = " + monitor.GetFriendlyValue());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -132,11 +132,9 @@ namespace OpenSim.Region.CoreModules.Framework.Monitoring
|
|||
string xml = "<data>";
|
||||
foreach (IMonitor monitor in m_monitors)
|
||||
{
|
||||
string elemName = monitor.ToString();
|
||||
if (elemName.StartsWith(monitor.GetType().Namespace))
|
||||
elemName = elemName.Substring(monitor.GetType().Namespace.Length + 1);
|
||||
|
||||
xml += "<" + elemName + ">" + monitor.GetValue() + "</" + elemName + ">";
|
||||
string elemName = monitor.GetName();
|
||||
xml += "<" + elemName + ">" + monitor.GetValue().ToString() + "</" + elemName + ">";
|
||||
// m_log.DebugFormat("[MONITOR MODULE]: {0} = {1}", elemName, monitor.GetValue());
|
||||
}
|
||||
xml += "</data>";
|
||||
|
||||
|
@ -166,6 +164,150 @@ namespace OpenSim.Region.CoreModules.Framework.Monitoring
|
|||
m_monitors.Add(new EventFrameMonitor(m_scene));
|
||||
m_monitors.Add(new LandFrameMonitor(m_scene));
|
||||
m_monitors.Add(new LastFrameTimeMonitor(m_scene));
|
||||
|
||||
m_monitors.Add(
|
||||
new GenericMonitor(
|
||||
m_scene,
|
||||
"TimeDilationMonitor",
|
||||
"Time Dilation",
|
||||
m => m.Scene.StatsReporter.LastReportedSimStats[0],
|
||||
m => m.GetValue().ToString()));
|
||||
|
||||
m_monitors.Add(
|
||||
new GenericMonitor(
|
||||
m_scene,
|
||||
"SimFPSMonitor",
|
||||
"Sim FPS",
|
||||
m => m.Scene.StatsReporter.LastReportedSimStats[1],
|
||||
m => string.Format("{0}", m.GetValue())));
|
||||
|
||||
m_monitors.Add(
|
||||
new GenericMonitor(
|
||||
m_scene,
|
||||
"PhysicsFPSMonitor",
|
||||
"Physics FPS",
|
||||
m => m.Scene.StatsReporter.LastReportedSimStats[2],
|
||||
m => string.Format("{0}", m.GetValue())));
|
||||
|
||||
m_monitors.Add(
|
||||
new GenericMonitor(
|
||||
m_scene,
|
||||
"AgentUpdatesPerSecondMonitor",
|
||||
"Agent Updates",
|
||||
m => m.Scene.StatsReporter.LastReportedSimStats[3],
|
||||
m => string.Format("{0} per second", m.GetValue())));
|
||||
|
||||
m_monitors.Add(
|
||||
new GenericMonitor(
|
||||
m_scene,
|
||||
"ActiveObjectCountMonitor",
|
||||
"Active Objects",
|
||||
m => m.Scene.StatsReporter.LastReportedSimStats[7],
|
||||
m => string.Format("{0}", m.GetValue())));
|
||||
|
||||
m_monitors.Add(
|
||||
new GenericMonitor(
|
||||
m_scene,
|
||||
"ActiveScriptsMonitor",
|
||||
"Active Scripts",
|
||||
m => m.Scene.StatsReporter.LastReportedSimStats[19],
|
||||
m => string.Format("{0}", m.GetValue())));
|
||||
|
||||
m_monitors.Add(
|
||||
new GenericMonitor(
|
||||
m_scene,
|
||||
"ScriptEventsPerSecondMonitor",
|
||||
"Script Events",
|
||||
m => m.Scene.StatsReporter.LastReportedSimStats[20],
|
||||
m => string.Format("{0} per second", m.GetValue())));
|
||||
|
||||
m_monitors.Add(
|
||||
new GenericMonitor(
|
||||
m_scene,
|
||||
"InPacketsPerSecondMonitor",
|
||||
"In Packets",
|
||||
m => m.Scene.StatsReporter.LastReportedSimStats[13],
|
||||
m => string.Format("{0} per second", m.GetValue())));
|
||||
|
||||
m_monitors.Add(
|
||||
new GenericMonitor(
|
||||
m_scene,
|
||||
"OutPacketsPerSecondMonitor",
|
||||
"Out Packets",
|
||||
m => m.Scene.StatsReporter.LastReportedSimStats[14],
|
||||
m => string.Format("{0} per second", m.GetValue())));
|
||||
|
||||
m_monitors.Add(
|
||||
new GenericMonitor(
|
||||
m_scene,
|
||||
"UnackedBytesMonitor",
|
||||
"Unacked Bytes",
|
||||
m => m.Scene.StatsReporter.LastReportedSimStats[15],
|
||||
m => string.Format("{0}", m.GetValue())));
|
||||
|
||||
m_monitors.Add(
|
||||
new GenericMonitor(
|
||||
m_scene,
|
||||
"PendingDownloadsMonitor",
|
||||
"Pending Downloads",
|
||||
m => m.Scene.StatsReporter.LastReportedSimStats[17],
|
||||
m => string.Format("{0}", m.GetValue())));
|
||||
|
||||
m_monitors.Add(
|
||||
new GenericMonitor(
|
||||
m_scene,
|
||||
"PendingUploadsMonitor",
|
||||
"Pending Uploads",
|
||||
m => m.Scene.StatsReporter.LastReportedSimStats[18],
|
||||
m => string.Format("{0}", m.GetValue())));
|
||||
|
||||
m_monitors.Add(
|
||||
new GenericMonitor(
|
||||
m_scene,
|
||||
"TotalFrameTimeMonitor",
|
||||
"Total Frame Time",
|
||||
m => m.Scene.StatsReporter.LastReportedSimStats[8],
|
||||
m => string.Format("{0} ms", m.GetValue())));
|
||||
|
||||
m_monitors.Add(
|
||||
new GenericMonitor(
|
||||
m_scene,
|
||||
"NetFrameTimeMonitor",
|
||||
"Net Frame Time",
|
||||
m => m.Scene.StatsReporter.LastReportedSimStats[9],
|
||||
m => string.Format("{0} ms", m.GetValue())));
|
||||
|
||||
m_monitors.Add(
|
||||
new GenericMonitor(
|
||||
m_scene,
|
||||
"PhysicsFrameTimeMonitor",
|
||||
"Physics Frame Time",
|
||||
m => m.Scene.StatsReporter.LastReportedSimStats[10],
|
||||
m => string.Format("{0} ms", m.GetValue())));
|
||||
|
||||
m_monitors.Add(
|
||||
new GenericMonitor(
|
||||
m_scene,
|
||||
"SimulationFrameTimeMonitor",
|
||||
"Simulation Frame Time",
|
||||
m => m.Scene.StatsReporter.LastReportedSimStats[12],
|
||||
m => string.Format("{0} ms", m.GetValue())));
|
||||
|
||||
m_monitors.Add(
|
||||
new GenericMonitor(
|
||||
m_scene,
|
||||
"AgentFrameTimeMonitor",
|
||||
"Agent Frame Time",
|
||||
m => m.Scene.StatsReporter.LastReportedSimStats[16],
|
||||
m => string.Format("{0} ms", m.GetValue())));
|
||||
|
||||
m_monitors.Add(
|
||||
new GenericMonitor(
|
||||
m_scene,
|
||||
"ImagesFrameTimeMonitor",
|
||||
"Images Frame Time",
|
||||
m => m.Scene.StatsReporter.LastReportedSimStats[11],
|
||||
m => string.Format("{0} ms", m.GetValue())));
|
||||
|
||||
m_alerts.Add(new DeadlockAlert(m_monitors.Find(x => x is LastFrameTimeMonitor) as LastFrameTimeMonitor));
|
||||
|
||||
|
|
|
@ -40,12 +40,17 @@ namespace OpenSim.Region.CoreModules.Framework.Monitoring.Monitors
|
|||
|
||||
#region Implementation of IMonitor
|
||||
|
||||
public string GetName()
|
||||
{
|
||||
return "AgentCountMonitor";
|
||||
}
|
||||
|
||||
public double GetValue()
|
||||
{
|
||||
return m_scene.SceneGraph.GetRootAgentCount();
|
||||
}
|
||||
|
||||
public string GetName()
|
||||
public string GetFriendlyName()
|
||||
{
|
||||
return "Root Agent Count";
|
||||
}
|
||||
|
|
|
@ -40,12 +40,17 @@ namespace OpenSim.Region.CoreModules.Framework.Monitoring.Monitors
|
|||
|
||||
#region Implementation of IMonitor
|
||||
|
||||
public string GetName()
|
||||
{
|
||||
return "ChildAgentCountMonitor";
|
||||
}
|
||||
|
||||
public double GetValue()
|
||||
{
|
||||
return m_scene.SceneGraph.GetChildAgentCount();
|
||||
}
|
||||
|
||||
public string GetName()
|
||||
public string GetFriendlyName()
|
||||
{
|
||||
return "Child Agent Count";
|
||||
}
|
||||
|
|
|
@ -40,12 +40,17 @@ namespace OpenSim.Region.CoreModules.Framework.Monitoring.Monitors
|
|||
|
||||
#region Implementation of IMonitor
|
||||
|
||||
public string GetName()
|
||||
{
|
||||
return "EventFrameMonitor";
|
||||
}
|
||||
|
||||
public double GetValue()
|
||||
{
|
||||
return m_scene.MonitorEventTime;
|
||||
}
|
||||
|
||||
public string GetName()
|
||||
public string GetFriendlyName()
|
||||
{
|
||||
return "Total Event Frame Time";
|
||||
}
|
||||
|
|
|
@ -33,12 +33,17 @@ namespace OpenSim.Region.CoreModules.Framework.Monitoring.Monitors
|
|||
{
|
||||
#region Implementation of IMonitor
|
||||
|
||||
public string GetName()
|
||||
{
|
||||
return "GCMemoryMonitor";
|
||||
}
|
||||
|
||||
public double GetValue()
|
||||
{
|
||||
return GC.GetTotalMemory(false);
|
||||
}
|
||||
|
||||
public string GetName()
|
||||
public string GetFriendlyName()
|
||||
{
|
||||
return "GC Reported Memory";
|
||||
}
|
||||
|
|
|
@ -0,0 +1,80 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
|
||||
namespace OpenSim.Region.CoreModules.Framework.Monitoring.Monitors
|
||||
{
|
||||
class GenericMonitor : IMonitor
|
||||
{
|
||||
public Scene Scene { get; private set; }
|
||||
public string Name { get; private set; }
|
||||
public string FriendlyName { get; private set; }
|
||||
|
||||
private readonly Func<GenericMonitor, double> m_getValueAction;
|
||||
private readonly Func<GenericMonitor, string> m_getFriendlyValueAction;
|
||||
|
||||
public GenericMonitor(
|
||||
Scene scene,
|
||||
string name,
|
||||
string friendlyName,
|
||||
Func<GenericMonitor, double> getValueAction,
|
||||
Func<GenericMonitor, string> getFriendlyValueAction)
|
||||
{
|
||||
Scene = scene;
|
||||
Name = name;
|
||||
FriendlyName = name;
|
||||
m_getFriendlyValueAction = getFriendlyValueAction;
|
||||
m_getValueAction = getValueAction;
|
||||
}
|
||||
|
||||
public double GetValue()
|
||||
{
|
||||
return m_getValueAction(this);
|
||||
}
|
||||
|
||||
public string GetName()
|
||||
{
|
||||
return Name;
|
||||
}
|
||||
|
||||
public string GetFriendlyName()
|
||||
{
|
||||
return FriendlyName;
|
||||
}
|
||||
|
||||
public string GetFriendlyValue()
|
||||
{
|
||||
return m_getFriendlyValueAction(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
@ -40,12 +40,17 @@ namespace OpenSim.Region.CoreModules.Framework.Monitoring.Monitors
|
|||
|
||||
#region Implementation of IMonitor
|
||||
|
||||
public string GetName()
|
||||
{
|
||||
return "LandFrameMonitor";
|
||||
}
|
||||
|
||||
public double GetValue()
|
||||
{
|
||||
return m_scene.MonitorLandTime;
|
||||
}
|
||||
|
||||
public string GetName()
|
||||
public string GetFriendlyName()
|
||||
{
|
||||
return "Land Frame Time";
|
||||
}
|
||||
|
|
|
@ -41,12 +41,17 @@ namespace OpenSim.Region.CoreModules.Framework.Monitoring.Monitors
|
|||
|
||||
#region Implementation of IMonitor
|
||||
|
||||
public string GetName()
|
||||
{
|
||||
return "LastFrameTimeMonitor";
|
||||
}
|
||||
|
||||
public double GetValue()
|
||||
{
|
||||
return Environment.TickCount - m_scene.MonitorLastFrameTick;
|
||||
}
|
||||
|
||||
public string GetName()
|
||||
public string GetFriendlyName()
|
||||
{
|
||||
return "Last Completed Frame At";
|
||||
}
|
||||
|
|
|
@ -40,12 +40,17 @@ namespace OpenSim.Region.CoreModules.Framework.Monitoring.Monitors
|
|||
|
||||
#region Implementation of IMonitor
|
||||
|
||||
public string GetName()
|
||||
{
|
||||
return "ObjectCountMonitor";
|
||||
}
|
||||
|
||||
public double GetValue()
|
||||
{
|
||||
return m_scene.SceneGraph.GetTotalObjectsCount();
|
||||
}
|
||||
|
||||
public string GetName()
|
||||
public string GetFriendlyName()
|
||||
{
|
||||
return "Total Objects Count";
|
||||
}
|
||||
|
|
|
@ -33,12 +33,17 @@ namespace OpenSim.Region.CoreModules.Framework.Monitoring.Monitors
|
|||
{
|
||||
#region Implementation of IMonitor
|
||||
|
||||
public string GetName()
|
||||
{
|
||||
return "PWSMemoryMonitor";
|
||||
}
|
||||
|
||||
public double GetValue()
|
||||
{
|
||||
return System.Diagnostics.Process.GetCurrentProcess().PrivateMemorySize64;
|
||||
}
|
||||
|
||||
public string GetName()
|
||||
public string GetFriendlyName()
|
||||
{
|
||||
return "Private Working Set Memory";
|
||||
}
|
||||
|
|
|
@ -40,12 +40,17 @@ namespace OpenSim.Region.CoreModules.Framework.Monitoring.Monitors
|
|||
|
||||
#region Implementation of IMonitor
|
||||
|
||||
public string GetName()
|
||||
{
|
||||
return "PhysicsFrameMonitor";
|
||||
}
|
||||
|
||||
public double GetValue()
|
||||
{
|
||||
return m_scene.MonitorPhysicsSyncTime + m_scene.MonitorPhysicsUpdateTime;
|
||||
}
|
||||
|
||||
public string GetName()
|
||||
public string GetFriendlyName()
|
||||
{
|
||||
return "Total Physics Frame Time";
|
||||
}
|
||||
|
|
|
@ -40,12 +40,17 @@ namespace OpenSim.Region.CoreModules.Framework.Monitoring.Monitors
|
|||
|
||||
#region Implementation of IMonitor
|
||||
|
||||
public string GetName()
|
||||
{
|
||||
return "PhysicsUpdateFrameMonitor";
|
||||
}
|
||||
|
||||
public double GetValue()
|
||||
{
|
||||
return m_scene.MonitorPhysicsUpdateTime;
|
||||
}
|
||||
|
||||
public string GetName()
|
||||
public string GetFriendlyName()
|
||||
{
|
||||
return "Physics Update Frame Time";
|
||||
}
|
||||
|
|
|
@ -32,12 +32,17 @@ namespace OpenSim.Region.CoreModules.Framework.Monitoring.Monitors
|
|||
{
|
||||
#region Implementation of IMonitor
|
||||
|
||||
public string GetName()
|
||||
{
|
||||
return "ThreadCountMonitor";
|
||||
}
|
||||
|
||||
public double GetValue()
|
||||
{
|
||||
return System.Diagnostics.Process.GetCurrentProcess().Threads.Count;
|
||||
}
|
||||
|
||||
public string GetName()
|
||||
public string GetFriendlyName()
|
||||
{
|
||||
return "Total Threads";
|
||||
}
|
||||
|
|
|
@ -40,12 +40,17 @@ namespace OpenSim.Region.CoreModules.Framework.Monitoring.Monitors
|
|||
|
||||
#region Implementation of IMonitor
|
||||
|
||||
public string GetName()
|
||||
{
|
||||
return "TotalFrameMonitor";
|
||||
}
|
||||
|
||||
public double GetValue()
|
||||
{
|
||||
return m_scene.MonitorFrameTime;
|
||||
}
|
||||
|
||||
public string GetName()
|
||||
public string GetFriendlyName()
|
||||
{
|
||||
return "Total Frame Time";
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
private YourStatsAreWrong handlerStatsIncorrect = null;
|
||||
|
||||
private enum Stats : uint
|
||||
public enum Stats : uint
|
||||
{
|
||||
TimeDilation = 0,
|
||||
SimFPS = 1,
|
||||
|
|
Loading…
Reference in New Issue