Merge pull request #7 from gamucf/moses.metricsPhase2

Moses.metrics phase2
fsassets
Michael Heilmann 2015-05-19 14:40:49 -04:00
commit 714c082ca8
7 changed files with 1012 additions and 751 deletions

52
OpenSim/Framework/Monitoring/SimExtraStatsCollector.cs Normal file → Executable file
View File

@ -27,6 +27,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using OpenMetaverse; using OpenMetaverse;
@ -71,6 +72,11 @@ namespace OpenSim.Framework.Monitoring
private volatile float pendingUploads; private volatile float pendingUploads;
private volatile float activeScripts; private volatile float activeScripts;
private volatile float scriptLinesPerSecond; private volatile float scriptLinesPerSecond;
private volatile float m_frameDilation;
private volatile float m_usersLoggingIn;
private volatile float m_totalGeoPrims;
private volatile float m_totalMeshes;
private volatile float m_inUseThreads;
// /// <summary> // /// <summary>
// /// These statistics are being collected by push rather than pull. Pull would be simpler, but I had the // /// 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
{ {
// FIXME: SimStats shouldn't allow an arbitrary stat packing order (which is inherited from the original // FIXME: SimStats shouldn't allow an arbitrary stat packing order (which is inherited from the original
// SimStatsPacket that was being used). // 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; timeDilation = stats.StatsBlock[0].StatValue;
simFps = stats.StatsBlock[1].StatValue; simFps = stats.StatsBlock[1].StatValue;
physicsFps = stats.StatsBlock[2].StatValue; physicsFps = stats.StatsBlock[2].StatValue;
@ -270,6 +280,11 @@ namespace OpenSim.Framework.Monitoring
pendingUploads = stats.StatsBlock[18].StatValue; pendingUploads = stats.StatsBlock[18].StatValue;
activeScripts = stats.StatsBlock[19].StatValue; activeScripts = stats.StatsBlock[19].StatValue;
scriptLinesPerSecond = stats.StatsBlock[20].StatValue; scriptLinesPerSecond = stats.StatsBlock[20].StatValue;
m_frameDilation = stats.StatsBlock[22].StatValue;
m_usersLoggingIn = stats.StatsBlock[23].StatValue;
m_totalGeoPrims = stats.StatsBlock[24].StatValue;
m_totalMeshes = stats.StatsBlock[25].StatValue;
m_inUseThreads = stats.StatsBlock[26].StatValue;
} }
/// <summary> /// <summary>
@ -407,6 +422,27 @@ Asset service request failures: {3}" + Environment.NewLine,
/// <returns></returns> /// <returns></returns>
public override OSDMap OReport(string uptime, string version) 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)
{
// A known issue with the current process .Threads property is
// that it can return null threads, thus don't count those as
// running threads and prevent the program function from failing
if (currentThread != null &&
currentThread.ThreadState == ThreadState.Running)
{
numberThreadsRunning++;
}
}
OSDMap args = new OSDMap(30); OSDMap args = new OSDMap(30);
// args["AssetsInCache"] = OSD.FromString (String.Format ("{0:0.##}", AssetsInCache)); // args["AssetsInCache"] = OSD.FromString (String.Format ("{0:0.##}", AssetsInCache));
// args["TimeAfterCacheMiss"] = OSD.FromString (String.Format ("{0:0.##}", // args["TimeAfterCacheMiss"] = OSD.FromString (String.Format ("{0:0.##}",
@ -443,6 +479,22 @@ Asset service request failures: {3}" + Environment.NewLine,
args["Memory"] = OSD.FromString (base.XReport (uptime, version)); args["Memory"] = OSD.FromString (base.XReport (uptime, version));
args["Uptime"] = OSD.FromString (uptime); args["Uptime"] = OSD.FromString (uptime);
args["Version"] = OSD.FromString (version); args["Version"] = OSD.FromString (version);
args["FrameDilatn"] = OSD.FromString(String.Format("{0:0.##}", m_frameDilation));
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["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; return args;
} }

File diff suppressed because it is too large Load Diff

59
OpenSim/Region/Framework/Scenes/SceneGraph.cs Normal file → Executable file
View File

@ -67,7 +67,9 @@ namespace OpenSim.Region.Framework.Scenes
protected Scene m_parentScene; protected Scene m_parentScene;
protected Dictionary<UUID, SceneObjectGroup> m_updateList = new Dictionary<UUID, SceneObjectGroup>(); protected Dictionary<UUID, SceneObjectGroup> m_updateList = new Dictionary<UUID, SceneObjectGroup>();
protected int m_numRootAgents = 0; protected int m_numRootAgents = 0;
protected int m_numTotalPrim = 0;
protected int m_numPrim = 0; protected int m_numPrim = 0;
protected int m_numMesh = 0;
protected int m_numChildAgents = 0; protected int m_numChildAgents = 0;
protected int m_physicalPrim = 0; protected int m_physicalPrim = 0;
@ -368,7 +370,8 @@ namespace OpenSim.Region.Framework.Scenes
SceneObjectPart[] parts = sceneObject.Parts; SceneObjectPart[] parts = sceneObject.Parts;
// Clamp child prim sizes and add child prims to the m_numPrim count // Clamp the sizes (scales) of the child prims and add the child prims to the count of all primitives
// (meshes and geometric primitives) in the scene; add child prims to m_numTotalPrim count
if (m_parentScene.m_clampPrimSize) if (m_parentScene.m_clampPrimSize)
{ {
foreach (SceneObjectPart part in parts) foreach (SceneObjectPart part in parts)
@ -382,7 +385,19 @@ namespace OpenSim.Region.Framework.Scenes
part.Shape.Scale = scale; part.Shape.Scale = scale;
} }
} }
m_numPrim += parts.Length; m_numTotalPrim += parts.Length;
// Go through all parts (geometric primitives and meshes) of this Scene Object
foreach (SceneObjectPart part in parts)
{
// Keep track of the total number of meshes or geometric primitives now in the scene;
// determine which object this is based on its primitive type: sculpted (sculpt) prim refers to
// a mesh and all other prims (i.e. box, sphere, etc) are geometric primitives
if (part.GetPrimType() == PrimType.SCULPT)
m_numMesh++;
else
m_numPrim++;
}
sceneObject.AttachToScene(m_parentScene); sceneObject.AttachToScene(m_parentScene);
@ -437,7 +452,21 @@ namespace OpenSim.Region.Framework.Scenes
if (!resultOfObjectLinked) if (!resultOfObjectLinked)
{ {
m_numPrim -= grp.PrimCount; // Decrement the total number of primitives (meshes and geometric primitives)
// that are part of the Scene Object being removed
m_numTotalPrim -= grp.PrimCount;
// Go through all parts (primitives and meshes) of this Scene Object
foreach (SceneObjectPart part in grp.Parts)
{
// Keep track of the total number of meshes or geometric primitives left in the scene;
// determine which object this is based on its primitive type: sculpted (sculpt) prim refers to
// a mesh and all other prims (i.e. box, sphere, etc) are geometric primitives
if (part.GetPrimType() == PrimType.SCULPT)
m_numMesh--;
else
m_numPrim--;
}
if ((grp.RootPart.Flags & PrimFlags.Physics) == PrimFlags.Physics) if ((grp.RootPart.Flags & PrimFlags.Physics) == PrimFlags.Physics)
RemovePhysicalPrim(grp.PrimCount); RemovePhysicalPrim(grp.PrimCount);
@ -686,10 +715,20 @@ namespace OpenSim.Region.Framework.Scenes
} }
public int GetTotalObjectsCount() public int GetTotalObjectsCount()
{
return m_numTotalPrim;
}
public int GetTotalPrimObjectsCount()
{ {
return m_numPrim; return m_numPrim;
} }
public int GetTotalMeshObjectsCount()
{
return m_numMesh;
}
public int GetActiveObjectsCount() public int GetActiveObjectsCount()
{ {
return m_physicalPrim; return m_physicalPrim;
@ -1970,7 +2009,19 @@ namespace OpenSim.Region.Framework.Scenes
// think it's selected, so it will never send a deselect... // think it's selected, so it will never send a deselect...
copy.IsSelected = false; copy.IsSelected = false;
m_numPrim += copy.Parts.Length; m_numTotalPrim += copy.Parts.Length;
// Go through all parts (primitives and meshes) of this Scene Object
foreach (SceneObjectPart part in copy.Parts)
{
// Keep track of the total number of meshes or geometric primitives now in the scene;
// determine which object this is based on its primitive type: sculpted (sculpt) prim refers to
// a mesh and all other prims (i.e. box, sphere, etc) are geometric primitives
if (part.GetPrimType() == PrimType.SCULPT)
m_numMesh++;
else
m_numPrim++;
}
if (rot != Quaternion.Identity) if (rot != Quaternion.Identity)
{ {

View File

@ -61,6 +61,10 @@ namespace OpenSim.Region.Framework.Scenes
private YourStatsAreWrong handlerStatsIncorrect; private YourStatsAreWrong handlerStatsIncorrect;
// Determines the size of the array that is used to collect StatBlocks
// for sending to the SimStats and SimExtraStatsCollector
private const int m_statisticArraySize = 27;
/// <summary> /// <summary>
/// These are the IDs of stats sent in the StatsPacket to the viewer. /// These are the IDs of stats sent in the StatsPacket to the viewer.
/// </summary> /// </summary>
@ -104,7 +108,12 @@ namespace OpenSim.Region.Framework.Scenes
ScriptEps = 31, ScriptEps = 31,
SimSpareMs = 32, SimSpareMs = 32,
SimSleepMs = 33, SimSleepMs = 33,
SimIoPumpTime = 34 SimIoPumpTime = 34,
FrameDilation = 35,
UsersLoggingIn = 36,
TotalGeoPrim = 37,
TotalMesh = 38,
ThreadCount = 39
} }
/// <summary> /// <summary>
@ -175,7 +184,7 @@ namespace OpenSim.Region.Framework.Scenes
// saved last reported value so there is something available for llGetRegionFPS // saved last reported value so there is something available for llGetRegionFPS
private float lastReportedSimFPS; private float lastReportedSimFPS;
private float[] lastReportedSimStats = new float[22]; private float[] lastReportedSimStats = new float[m_statisticArraySize];
private float m_pfps; private float m_pfps;
/// <summary> /// <summary>
@ -202,6 +211,8 @@ namespace OpenSim.Region.Framework.Scenes
private int m_rootAgents; private int m_rootAgents;
private int m_childAgents; private int m_childAgents;
private int m_numPrim; private int m_numPrim;
private int m_numGeoPrim;
private int m_numMesh;
private int m_inPacketsPerSecond; private int m_inPacketsPerSecond;
private int m_outPacketsPerSecond; private int m_outPacketsPerSecond;
private int m_activePrim; private int m_activePrim;
@ -214,26 +225,33 @@ namespace OpenSim.Region.Framework.Scenes
private int m_objectCapacity = 45000; private int m_objectCapacity = 45000;
// This is the number of frames that will be stored and then averaged for // This is the number of frames that will be stored and then averaged for
// the Total, Simulation, Physics, and Network Frame Time; It is set to // the Total, Simulation, Physics, and Network Frame Time; It is set to
// 10 by default but can be changed by the OpenSim.ini configuration file // 10 by default but can be changed by the OpenSim.ini configuration file
// NumberOfFrames parameter // NumberOfFrames parameter
private int m_numberFramesStored = Scene.m_defaultNumberFramesStored; private int m_numberFramesStored = Scene.m_defaultNumberFramesStored;
// The arrays that will hold the time it took to run the past N frames, // The arrays that will hold the time it took to run the past N frames,
// where N is the num_frames_to_average given by the configuration file // where N is the num_frames_to_average given by the configuration file
private double[] m_totalFrameTimeMilliseconds; private double[] m_totalFrameTimeMilliseconds;
private double[] m_simulationFrameTimeMilliseconds; private double[] m_simulationFrameTimeMilliseconds;
private double[] m_physicsFrameTimeMilliseconds; private double[] m_physicsFrameTimeMilliseconds;
private double[] m_networkFrameTimeMilliseconds; private double[] m_networkFrameTimeMilliseconds;
// The location of the next time in milliseconds that will be // The location of the next time in milliseconds that will be
// (over)written when the next frame completes // (over)written when the next frame completes
private int m_nextLocation = 0; private int m_nextLocation = 0;
// The correct number of frames that have completed since the last stats // The correct number of frames that have completed since the last stats
// update for physics // update for physics
private int m_numberPhysicsFrames; private int m_numberPhysicsFrames;
// The current number of users attempting to login to the region
private int m_usersLoggingIn;
// The last reported value of threads from the SmartThreadPool inside of
// XEngine
private int m_inUseThreads;
private Scene m_scene; private Scene m_scene;
private RegionInfo ReportingRegion; private RegionInfo ReportingRegion;
@ -246,11 +264,13 @@ namespace OpenSim.Region.Framework.Scenes
{ {
// Initialize the different frame time arrays to the correct sizes // Initialize the different frame time arrays to the correct sizes
m_totalFrameTimeMilliseconds = new double[m_numberFramesStored]; m_totalFrameTimeMilliseconds = new double[m_numberFramesStored];
m_simulationFrameTimeMilliseconds = new m_simulationFrameTimeMilliseconds = new double[m_numberFramesStored];
double[m_numberFramesStored];
m_physicsFrameTimeMilliseconds = new double[m_numberFramesStored]; m_physicsFrameTimeMilliseconds = new double[m_numberFramesStored];
m_networkFrameTimeMilliseconds = new double[m_numberFramesStored]; m_networkFrameTimeMilliseconds = new double[m_numberFramesStored];
// Initialize the current number of users logging into the region
m_usersLoggingIn = 0;
m_scene = scene; m_scene = scene;
m_reportedFpsCorrectionFactor = scene.MinFrameSeconds * m_nominalReportedFps; m_reportedFpsCorrectionFactor = scene.MinFrameSeconds * m_nominalReportedFps;
m_statsUpdateFactor = (float)(m_statsUpdatesEveryMS / 1000); m_statsUpdateFactor = (float)(m_statsUpdatesEveryMS / 1000);
@ -284,13 +304,14 @@ namespace OpenSim.Region.Framework.Scenes
StatsManager.RegisterStat(SlowFramesStat); StatsManager.RegisterStat(SlowFramesStat);
} }
public SimStatsReporter(Scene scene, int numberOfFrames) : this (scene) public SimStatsReporter(Scene scene, int numberOfFrames) : this (scene)
{ {
// Store the number of frames from the OpenSim.ini configuration // Store the number of frames from the OpenSim.ini configuration file
// file m_numberFramesStored = numberOfFrames;
m_numberFramesStored = numberOfFrames;
} }
public void Close() public void Close()
{ {
m_report.Elapsed -= TriggerStatsHeartbeat; m_report.Elapsed -= TriggerStatsHeartbeat;
@ -328,11 +349,17 @@ namespace OpenSim.Region.Framework.Scenes
double simulationSumFrameTime; double simulationSumFrameTime;
double physicsSumFrameTime; double physicsSumFrameTime;
double networkSumFrameTime; double networkSumFrameTime;
float frameDilation;
int currentFrame;
if (!m_scene.Active) if (!m_scene.Active)
return; return;
SimStatsPacket.StatBlock[] sb = new SimStatsPacket.StatBlock[22]; // Create arrays to hold the statistics for this current scene,
// these will be passed to the SimExtraStatsCollector, they are also
// sent to the SimStats class
SimStatsPacket.StatBlock[] sb = new
SimStatsPacket.StatBlock[m_statisticArraySize];
SimStatsPacket.RegionBlock rb = new SimStatsPacket.RegionBlock(); SimStatsPacket.RegionBlock rb = new SimStatsPacket.RegionBlock();
// Know what's not thread safe in Mono... modifying timers. // Know what's not thread safe in Mono... modifying timers.
@ -354,21 +381,21 @@ namespace OpenSim.Region.Framework.Scenes
#region various statistic googly moogly #region various statistic googly moogly
// ORIGINAL code commented out until we have time to add our own // ORIGINAL code commented out until we have time to add our own
// statistics to the statistics window, this will be done as a // statistics to the statistics window, this will be done as a
// new section given the title of our current project // new section given the title of our current project
// We're going to lie about the FPS because we've been lying since 2008. The actual FPS is currently // We're going to lie about the FPS because we've been lying since 2008. The actual FPS is currently
// locked at a maximum of 11. Maybe at some point this can change so that we're not lying. // locked at a maximum of 11. Maybe at some point this can change so that we're not lying.
//int reportedFPS = (int)(m_fps * m_reportedFpsCorrectionFactor); //int reportedFPS = (int)(m_fps * m_reportedFpsCorrectionFactor);
int reportedFPS = m_fps; int reportedFPS = m_fps;
// save the reported value so there is something available for llGetRegionFPS // save the reported value so there is something available for llGetRegionFPS
lastReportedSimFPS = reportedFPS / m_statsUpdateFactor; lastReportedSimFPS = reportedFPS / m_statsUpdateFactor;
// ORIGINAL code commented out until we have time to add our own // ORIGINAL code commented out until we have time to add our own
// statistics to the statistics window // statistics to the statistics window
//float physfps = ((m_pfps / 1000)); //float physfps = ((m_pfps / 1000));
float physfps = m_numberPhysicsFrames; float physfps = m_numberPhysicsFrames;
//if (physfps > 600) //if (physfps > 600)
//physfps = physfps - (physfps - 600); //physfps = physfps - (physfps - 600);
@ -381,6 +408,8 @@ namespace OpenSim.Region.Framework.Scenes
m_rootAgents = m_scene.SceneGraph.GetRootAgentCount(); m_rootAgents = m_scene.SceneGraph.GetRootAgentCount();
m_childAgents = m_scene.SceneGraph.GetChildAgentCount(); m_childAgents = m_scene.SceneGraph.GetChildAgentCount();
m_numPrim = m_scene.SceneGraph.GetTotalObjectsCount(); m_numPrim = m_scene.SceneGraph.GetTotalObjectsCount();
m_numGeoPrim = m_scene.SceneGraph.GetTotalPrimObjectsCount();
m_numMesh = m_scene.SceneGraph.GetTotalMeshObjectsCount();
m_activePrim = m_scene.SceneGraph.GetActiveObjectsCount(); m_activePrim = m_scene.SceneGraph.GetActiveObjectsCount();
m_activeScripts = m_scene.SceneGraph.GetActiveScriptsCount(); m_activeScripts = m_scene.SceneGraph.GetActiveScriptsCount();
@ -406,11 +435,11 @@ namespace OpenSim.Region.Framework.Scenes
if (framesUpdated == 0) if (framesUpdated == 0)
framesUpdated = 1; framesUpdated = 1;
for (int i = 0; i < 22; i++) for (int i = 0; i < m_statisticArraySize; i++)
{ {
sb[i] = new SimStatsPacket.StatBlock(); sb[i] = new SimStatsPacket.StatBlock();
} }
// Resetting the sums of the frame times to prevent any errors // Resetting the sums of the frame times to prevent any errors
// in calculating the moving average for frame time // in calculating the moving average for frame time
totalSumFrameTime = 0; totalSumFrameTime = 0;
@ -425,12 +454,25 @@ namespace OpenSim.Region.Framework.Scenes
// Sum up each frame time in order to calculate the moving // Sum up each frame time in order to calculate the moving
// average of frame time // average of frame time
totalSumFrameTime += m_totalFrameTimeMilliseconds[i]; totalSumFrameTime += m_totalFrameTimeMilliseconds[i];
simulationSumFrameTime += simulationSumFrameTime +=
m_simulationFrameTimeMilliseconds[i]; m_simulationFrameTimeMilliseconds[i];
physicsSumFrameTime += m_physicsFrameTimeMilliseconds[i]; physicsSumFrameTime += m_physicsFrameTimeMilliseconds[i];
networkSumFrameTime += m_networkFrameTimeMilliseconds[i]; networkSumFrameTime += m_networkFrameTimeMilliseconds[i];
} }
// Get the index that represents the current frame based on the next one known; go back
// to the last index if next one is stated to restart at 0
if (m_nextLocation == 0)
currentFrame = m_numberFramesStored - 1;
else
currentFrame = m_nextLocation - 1;
// Calculate the frame dilation; which is currently based on the ratio between the sum of the
// physics and simulation rate, and the set minimum time to run a scene's frame
frameDilation = (float)(m_simulationFrameTimeMilliseconds[currentFrame] +
m_physicsFrameTimeMilliseconds[currentFrame]) / m_scene.MinFrameTicks;
// ORIGINAL code commented out until we have time to add our own
sb[0].StatID = (uint) Stats.TimeDilation; sb[0].StatID = (uint) Stats.TimeDilation;
sb[0].StatValue = (Single.IsNaN(m_timeDilation)) ? 0.1f : m_timeDilation ; //((((m_timeDilation + (0.10f * statsUpdateFactor)) /10) / statsUpdateFactor)); sb[0].StatValue = (Single.IsNaN(m_timeDilation)) ? 0.1f : m_timeDilation ; //((((m_timeDilation + (0.10f * statsUpdateFactor)) /10) / statsUpdateFactor));
@ -455,31 +497,28 @@ namespace OpenSim.Region.Framework.Scenes
sb[7].StatID = (uint) Stats.ActivePrim; sb[7].StatID = (uint) Stats.ActivePrim;
sb[7].StatValue = m_activePrim; sb[7].StatValue = m_activePrim;
// ORIGINAL code commented out until we have time to add our own // ORIGINAL code commented out until we have time to add our own
// statistics to the statistics window // statistics to the statistics window
sb[8].StatID = (uint)Stats.FrameMS; sb[8].StatID = (uint)Stats.FrameMS;
//sb[8].StatValue = m_frameMS / framesUpdated; //sb[8].StatValue = m_frameMS / framesUpdated;
sb[8].StatValue = (float) totalSumFrameTime / sb[8].StatValue = (float) totalSumFrameTime / m_numberFramesStored;
m_numberFramesStored;
sb[9].StatID = (uint)Stats.NetMS; sb[9].StatID = (uint)Stats.NetMS;
//sb[9].StatValue = m_netMS / framesUpdated; //sb[9].StatValue = m_netMS / framesUpdated;
sb[9].StatValue = (float) networkSumFrameTime / sb[9].StatValue = (float) networkSumFrameTime / m_numberFramesStored;
m_numberFramesStored;
sb[10].StatID = (uint)Stats.PhysicsMS; sb[10].StatID = (uint)Stats.PhysicsMS;
//sb[10].StatValue = m_physicsMS / framesUpdated; //sb[10].StatValue = m_physicsMS / framesUpdated;
sb[10].StatValue = (float) physicsSumFrameTime / sb[10].StatValue = (float) physicsSumFrameTime / m_numberFramesStored;
m_numberFramesStored;
sb[11].StatID = (uint)Stats.ImageMS ; sb[11].StatID = (uint)Stats.ImageMS ;
sb[11].StatValue = m_imageMS / framesUpdated; sb[11].StatValue = m_imageMS / framesUpdated;
sb[12].StatID = (uint)Stats.OtherMS; sb[12].StatID = (uint)Stats.OtherMS;
//sb[12].StatValue = m_otherMS / framesUpdated; //sb[12].StatValue = m_otherMS / framesUpdated;
sb[12].StatValue = (float) simulationSumFrameTime / sb[12].StatValue = (float) simulationSumFrameTime /
m_numberFramesStored; m_numberFramesStored;
sb[13].StatID = (uint)Stats.InPacketsPerSecond; sb[13].StatID = (uint)Stats.InPacketsPerSecond;
sb[13].StatValue = (m_inPacketsPerSecond / m_statsUpdateFactor); sb[13].StatValue = (m_inPacketsPerSecond / m_statsUpdateFactor);
@ -507,7 +546,28 @@ namespace OpenSim.Region.Framework.Scenes
sb[21].StatID = (uint)Stats.SimSpareMs; sb[21].StatID = (uint)Stats.SimSpareMs;
sb[21].StatValue = m_spareMS / framesUpdated; sb[21].StatValue = m_spareMS / framesUpdated;
for (int i = 0; i < 22; i++) // Current ratio between the sum of physics and sim rate, and the
// minimum time to run a scene's frame
sb[22].StatID = (uint)Stats.FrameDilation;
sb[22].StatValue = frameDilation;
// Current number of users currently attemptint to login to region
sb[23].StatID = (uint)Stats.UsersLoggingIn;
sb[23].StatValue = m_usersLoggingIn;
// Total number of geometric primitives in the scene
sb[24].StatID = (uint)Stats.TotalGeoPrim;
sb[24].StatValue = m_numGeoPrim;
// Total number of mesh objects in the scene
sb[25].StatID = (uint)Stats.TotalMesh;
sb[25].StatValue = m_numMesh;
// Current number of threads that XEngine is using
sb[26].StatID = (uint)Stats.ThreadCount;
sb[26].StatValue = m_inUseThreads;
for (int i = 0; i < m_statisticArraySize; i++)
{ {
lastReportedSimStats[i] = sb[i].StatValue; lastReportedSimStats[i] = sb[i].StatValue;
} }
@ -554,8 +614,8 @@ namespace OpenSim.Region.Framework.Scenes
{ {
// Reset the number of frames that the physics library has // Reset the number of frames that the physics library has
// processed since the last stats report // processed since the last stats report
m_numberPhysicsFrames = 0; m_numberPhysicsFrames = 0;
m_timeDilation = 0; m_timeDilation = 0;
m_fps = 0; m_fps = 0;
m_pfps = 0; m_pfps = 0;
@ -686,32 +746,32 @@ namespace OpenSim.Region.Framework.Scenes
m_otherMS += ms; m_otherMS += ms;
} }
public void addPhysicsFrame(int frames) public void addPhysicsFrame(int frames)
{ {
// Add the number of physics frames to the correct total physics // Add the number of physics frames to the correct total physics
// frames // frames
m_numberPhysicsFrames += frames; m_numberPhysicsFrames += frames;
} }
public void addFrameTimeMilliseconds(double total, double simulation, public void addFrameTimeMilliseconds(double total, double simulation,
double physics, double network) double physics, double network)
{ {
// Save the frame times from the current frame into the appropriate // Save the frame times from the current frame into the appropriate
// arrays // arrays
m_totalFrameTimeMilliseconds[m_nextLocation] = total; m_totalFrameTimeMilliseconds[m_nextLocation] = total;
m_simulationFrameTimeMilliseconds[m_nextLocation] = simulation; m_simulationFrameTimeMilliseconds[m_nextLocation] = simulation;
m_physicsFrameTimeMilliseconds[m_nextLocation] = physics; m_physicsFrameTimeMilliseconds[m_nextLocation] = physics;
m_networkFrameTimeMilliseconds[m_nextLocation] = network; m_networkFrameTimeMilliseconds[m_nextLocation] = network;
// Update to the next location in the list // Update to the next location in the list
m_nextLocation++; m_nextLocation++;
// Since the list will begin to overwrite the oldest frame values
// first, the next location needs to loop back to the beginning of the
// list whenever it reaches the end
m_nextLocation = m_nextLocation % m_numberFramesStored;
}
// Since the list will begin to overwrite the oldest frame values
// first, the next location needs to loop back to the beginning of the
// list whenever it reaches the end
m_nextLocation = m_nextLocation % m_numberFramesStored;
}
public void AddPendingDownloads(int count) public void AddPendingDownloads(int count)
{ {
m_pendingDownloads += count; m_pendingDownloads += count;
@ -734,6 +794,31 @@ namespace OpenSim.Region.Framework.Scenes
AddunAckedBytes(unAckedBytes); AddunAckedBytes(unAckedBytes);
} }
public void UpdateUsersLoggingIn(bool isLoggingIn)
{
// Determine whether the user has started logging in or has completed
// logging into the region
if (isLoggingIn)
{
// The user is starting to login to the region so increment the
// number of users attempting to login to the region
m_usersLoggingIn++;
}
else
{
// The user has finished logging into the region so decrement the
// number of users logging into the region
m_usersLoggingIn--;
}
}
public void SetThreadCount(int inUseThreads)
{
// Save the new number of threads to our member variable to send to
// the extra stats collector
m_inUseThreads = inUseThreads;
}
#endregion #endregion
public Dictionary<string, float> GetExtraSimStats() public Dictionary<string, float> GetExtraSimStats()

36
OpenSim/Region/ScriptEngine/XEngine/XEngine.cs Normal file → Executable file
View File

@ -1872,6 +1872,12 @@ namespace OpenSim.Region.ScriptEngine.XEngine
IScriptInstance instance = GetInstance(itemID); IScriptInstance instance = GetInstance(itemID);
if (instance != null) if (instance != null)
instance.ApiResetScript(); instance.ApiResetScript();
// Send the new number of threads that are in use by the thread
// pool, I believe that by adding them to the locations where the
// script is changing states that I will catch all changes to the
// thread pool
m_Scene.setThreadCount(m_ThreadPool.InUseThreads);
} }
public void ResetScript(UUID itemID) public void ResetScript(UUID itemID)
@ -1879,6 +1885,12 @@ namespace OpenSim.Region.ScriptEngine.XEngine
IScriptInstance instance = GetInstance(itemID); IScriptInstance instance = GetInstance(itemID);
if (instance != null) if (instance != null)
instance.ResetScript(m_WaitForEventCompletionOnScriptStop); instance.ResetScript(m_WaitForEventCompletionOnScriptStop);
// Send the new number of threads that are in use by the thread
// pool, I believe that by adding them to the locations where the
// script is changing states that I will catch all changes to the
// thread pool
m_Scene.setThreadCount(m_ThreadPool.InUseThreads);
} }
public void StartScript(UUID itemID) public void StartScript(UUID itemID)
@ -1888,6 +1900,12 @@ namespace OpenSim.Region.ScriptEngine.XEngine
instance.Start(); instance.Start();
else else
m_runFlags.AddOrUpdate(itemID, true, 240); m_runFlags.AddOrUpdate(itemID, true, 240);
// Send the new number of threads that are in use by the thread
// pool, I believe that by adding them to the locations where the
// script is changing states that I will catch all changes to the
// thread pool
m_Scene.setThreadCount(m_ThreadPool.InUseThreads);
} }
public void StopScript(UUID itemID) public void StopScript(UUID itemID)
@ -1903,6 +1921,12 @@ namespace OpenSim.Region.ScriptEngine.XEngine
// m_log.DebugFormat("[XENGINE]: Could not find script with ID {0} to stop in {1}", itemID, World.Name); // m_log.DebugFormat("[XENGINE]: Could not find script with ID {0} to stop in {1}", itemID, World.Name);
m_runFlags.AddOrUpdate(itemID, false, 240); m_runFlags.AddOrUpdate(itemID, false, 240);
} }
// Send the new number of threads that are in use by the thread
// pool, I believe that by adding them to the locations where the
// script is changing states that I will catch all changes to the
// thread pool
m_Scene.setThreadCount(m_ThreadPool.InUseThreads);
} }
public DetectParams GetDetectParams(UUID itemID, int idx) public DetectParams GetDetectParams(UUID itemID, int idx)
@ -2393,6 +2417,12 @@ namespace OpenSim.Region.ScriptEngine.XEngine
instance.Suspend(); instance.Suspend();
// else // else
// m_log.DebugFormat("[XEngine]: Could not find script with ID {0} to resume", itemID); // m_log.DebugFormat("[XEngine]: Could not find script with ID {0} to resume", itemID);
// Send the new number of threads that are in use by the thread
// pool, I believe that by adding them to the locations where the
// script is changing states that I will catch all changes to the
// thread pool
m_Scene.setThreadCount(m_ThreadPool.InUseThreads);
} }
public void ResumeScript(UUID itemID) public void ResumeScript(UUID itemID)
@ -2404,6 +2434,12 @@ namespace OpenSim.Region.ScriptEngine.XEngine
instance.Resume(); instance.Resume();
// else // else
// m_log.DebugFormat("[XEngine]: Could not find script with ID {0} to resume", itemID); // m_log.DebugFormat("[XEngine]: Could not find script with ID {0} to resume", itemID);
// Send the new number of threads that are in use by the thread
// pool, I believe that by adding them to the locations where the
// script is changing states that I will catch all changes to the
// thread pool
m_Scene.setThreadCount(m_ThreadPool.InUseThreads);
} }
public bool HasScript(UUID itemID, out bool running) public bool HasScript(UUID itemID, out bool running)

0
bin/LukeSkywalker.IPNetwork.dll Normal file → Executable file
View File

2
bin/OpenSimDefaults.ini Normal file → Executable file
View File

@ -296,7 +296,7 @@
; Simulator Stats URI ; Simulator Stats URI
; Enable JSON simulator data by setting a URI name (case sensitive) ; Enable JSON simulator data by setting a URI name (case sensitive)
; Returns regular sim stats (SimFPS, ...) ; Returns regular sim stats (SimFPS, ...)
; Stats_URI = "jsonSimStats" Stats_URI = "jsonSimStats"
; Simulator StatsManager URI ; Simulator StatsManager URI
; Enable fetch of StatsManager registered stats. Fetch is query which can optionally ; Enable fetch of StatsManager registered stats. Fetch is query which can optionally