Phase 2 additons with Frame Dilation metric.

fsassets
Robert Louden 2015-04-21 16:15:48 -04:00
parent 1959eb8372
commit c3138f9f38
3 changed files with 5822 additions and 5797 deletions

View File

@ -72,6 +72,7 @@ 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_usersLoggingIn;
private volatile float m_totalGeoPrims; private volatile float m_totalGeoPrims;
private volatile float m_totalMeshes; private volatile float m_totalMeshes;
@ -257,7 +258,7 @@ namespace OpenSim.Framework.Monitoring
// For an unknown reason the original designers decided not to // For an unknown reason the original designers decided not to
// include the spare MS statistic inside of this class, this is // include the spare MS statistic inside of this class, this is
// located inside the StatsBlock at location 21 thus it is skipped // 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;
@ -279,10 +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_usersLoggingIn = stats.StatsBlock[22].StatValue; m_frameDilation = stats.StatsBlock[22].StatValue;
m_totalGeoPrims = stats.StatsBlock[23].StatValue; m_usersLoggingIn = stats.StatsBlock[23].StatValue;
m_totalMeshes = stats.StatsBlock[24].StatValue; m_totalGeoPrims = stats.StatsBlock[24].StatValue;
m_inUseThreads = stats.StatsBlock[25].StatValue; m_totalMeshes = stats.StatsBlock[25].StatValue;
m_inUseThreads = stats.StatsBlock[26].StatValue;
} }
/// <summary> /// <summary>
@ -474,14 +476,13 @@ Asset service request failures: {3}" + Environment.NewLine,
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.##}", args["Logging in Users"] = OSD.FromString(String.Format("{0:0.##}",
m_usersLoggingIn)); m_usersLoggingIn));
args["GeoPrims"] = OSD.FromString(String.Format("{0:0.##}", args["GeoPrims"] = OSD.FromString(String.Format("{0:0.##}",
m_totalGeoPrims)); m_totalGeoPrims));
args["Mesh Objects"] = OSD.FromString(String.Format("{0:0.##}", args["Mesh Objects"] = OSD.FromString(String.Format("{0:0.##}",
m_totalMeshes)); 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.##}", args["XEngine Thread Count"] = OSD.FromString(String.Format("{0:0.##}",
m_inUseThreads)); m_inUseThreads));
args["Util Thread Count"] = OSD.FromString(String.Format("{0:0.##}", args["Util Thread Count"] = OSD.FromString(String.Format("{0:0.##}",

View File

@ -267,7 +267,8 @@ namespace OpenSim.Region.Framework.Scenes
public float DefaultDrawDistance public float DefaultDrawDistance
{ {
// get { return m_defaultDrawDistance; } // get { return m_defaultDrawDistance; }
get { get
{
if (RegionInfo != null) if (RegionInfo != null)
{ {
float largestDimension = Math.Max(RegionInfo.RegionSizeX, RegionInfo.RegionSizeY); float largestDimension = Math.Max(RegionInfo.RegionSizeX, RegionInfo.RegionSizeY);
@ -800,12 +801,14 @@ namespace OpenSim.Region.Framework.Scenes
// can be closest/random/sequence // can be closest/random/sequence
public string SpawnPointRouting public string SpawnPointRouting
{ {
get; private set; get;
private set;
} }
// allow landmarks to pass // allow landmarks to pass
public bool TelehubAllowLandmarks public bool TelehubAllowLandmarks
{ {
get; private set; get;
private set;
} }
#endregion Properties #endregion Properties
@ -1148,7 +1151,8 @@ namespace OpenSim.Region.Framework.Scenes
} }
public Scene(RegionInfo regInfo, PhysicsScene physicsScene) : base(regInfo) public Scene(RegionInfo regInfo, PhysicsScene physicsScene)
: base(regInfo)
{ {
m_sceneGraph = new SceneGraph(this); m_sceneGraph = new SceneGraph(this);
m_sceneGraph.PhysicsScene = physicsScene; m_sceneGraph.PhysicsScene = physicsScene;
@ -1673,7 +1677,14 @@ namespace OpenSim.Region.Framework.Scenes
if (Frame % m_update_terrain == 0) if (Frame % m_update_terrain == 0)
{ {
tmpMS = Util.EnvironmentTickCount(); tmpMS = Util.EnvironmentTickCount();
simFrameStopwatch.Start();
UpdateTerrain(); UpdateTerrain();
// Get the simulation frame time that the avatar force
// input took
simFrameStopwatch.Stop();
preciseSimFrameTime =
simFrameStopwatch.Elapsed.TotalMilliseconds;
terrainMS = Util.EnvironmentTickCountSubtract(tmpMS); terrainMS = Util.EnvironmentTickCountSubtract(tmpMS);
} }
@ -1705,13 +1716,15 @@ namespace OpenSim.Region.Framework.Scenes
// Apply any pending avatar force input to the avatar's velocity // Apply any pending avatar force input to the avatar's velocity
tmpMS = Util.EnvironmentTickCount(); tmpMS = Util.EnvironmentTickCount();
simFrameStopwatch.Start(); simFrameStopwatch.Restart();
if (Frame % m_update_entitymovement == 0) if (Frame % m_update_entitymovement == 0)
m_sceneGraph.UpdateScenePresenceMovement(); m_sceneGraph.UpdateScenePresenceMovement();
// Get the simulation frame time that the avatar force input took // Get the simulation frame time that the avatar force input
// took
simFrameStopwatch.Stop(); simFrameStopwatch.Stop();
preciseSimFrameTime = simFrameStopwatch.Elapsed.TotalMilliseconds; preciseSimFrameTime +=
simFrameStopwatch.Elapsed.TotalMilliseconds;
agentMS = Util.EnvironmentTickCountSubtract(tmpMS); agentMS = Util.EnvironmentTickCountSubtract(tmpMS);
// Perform the main physics update. This will do the actual work of moving objects and avatars according to their // Perform the main physics update. This will do the actual work of moving objects and avatars according to their
@ -1821,6 +1834,11 @@ namespace OpenSim.Region.Framework.Scenes
EventManager.TriggerRegionHeartbeatEnd(this); EventManager.TriggerRegionHeartbeatEnd(this);
otherMS = eventMS + backupMS + terrainMS + landMS; otherMS = eventMS + backupMS + terrainMS + landMS;
// Get the elapsed time for the simulation frame
simFrameStopwatch.Stop();
preciseSimFrameTime +=
simFrameStopwatch.Elapsed.TotalMilliseconds;
if (!UpdateOnTimer) if (!UpdateOnTimer)
{ {
Watchdog.UpdateThread(); Watchdog.UpdateThread();
@ -1837,9 +1855,13 @@ namespace OpenSim.Region.Framework.Scenes
spareMS = Math.Max(0, MinFrameTicks - physicsMS2 - agentMS - physicsMS - otherMS); spareMS = Math.Max(0, MinFrameTicks - physicsMS2 - agentMS - physicsMS - otherMS);
} }
// Get the elapsed time for the simulation frame // Get the total frame time
simFrameStopwatch.Stop(); totalFrameStopwatch.Stop();
preciseSimFrameTime += simFrameStopwatch.Elapsed.TotalMilliseconds; preciseTotalFrameTime =
totalFrameStopwatch.Elapsed.TotalMilliseconds;
// Restart the stopwatch for the total time of the next frame
totalFrameStopwatch.Restart();
previousFrameTick = m_lastFrameTick; previousFrameTick = m_lastFrameTick;
frameMS = Util.EnvironmentTickCountSubtract(m_lastFrameTick); frameMS = Util.EnvironmentTickCountSubtract(m_lastFrameTick);

View File

@ -63,7 +63,7 @@ namespace OpenSim.Region.Framework.Scenes
// Determines the size of the array that is used to collect StatBlocks // Determines the size of the array that is used to collect StatBlocks
// for sending to the SimStats and SimExtraStatsCollector // for sending to the SimStats and SimExtraStatsCollector
private const int m_statisticArraySize = 26; 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.
@ -109,10 +109,11 @@ namespace OpenSim.Region.Framework.Scenes
SimSpareMs = 32, SimSpareMs = 32,
SimSleepMs = 33, SimSleepMs = 33,
SimIoPumpTime = 34, SimIoPumpTime = 34,
UsersLoggingIn = 35, FrameDilation = 35,
TotalGeoPrim = 36, UsersLoggingIn = 36,
TotalMesh = 37, TotalGeoPrim = 37,
ThreadCount = 38 TotalMesh = 38,
ThreadCount = 39
} }
/// <summary> /// <summary>
@ -348,7 +349,7 @@ namespace OpenSim.Region.Framework.Scenes
double simulationSumFrameTime; double simulationSumFrameTime;
double physicsSumFrameTime; double physicsSumFrameTime;
double networkSumFrameTime; double networkSumFrameTime;
float timeDilation; float frameDilation;
int currentFrame; int currentFrame;
if (!m_scene.Active) if (!m_scene.Active)
@ -466,16 +467,14 @@ namespace OpenSim.Region.Framework.Scenes
else else
currentFrame = m_nextLocation - 1; currentFrame = m_nextLocation - 1;
// Calculate the time dilation; which is currently based on the ratio between the sum of the // 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 the scene's update; minFrameTime // physics and simulation rate, and the set minimum time to run a scene's frame
// is given in seconds so multiply by 1000 to convert it to milliseconds frameDilation = (float)(m_simulationFrameTimeMilliseconds[currentFrame] +
timeDilation = (float)(m_simulationFrameTimeMilliseconds[currentFrame] + m_physicsFrameTimeMilliseconds[currentFrame]) / m_scene.MinFrameTicks;
m_physicsFrameTimeMilliseconds[currentFrame]) / (m_scene.MinFrameTime * 1000);
// ORIGINAL code commented out until we have time to add our own // 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));
sb[0].StatValue = timeDilation;
sb[1].StatID = (uint) Stats.SimFPS; sb[1].StatID = (uint) Stats.SimFPS;
sb[1].StatValue = reportedFPS / m_statsUpdateFactor; sb[1].StatValue = reportedFPS / m_statsUpdateFactor;
@ -547,23 +546,26 @@ 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;
// Added to track the number of users currently attempting to // Current ratio between the sum of physics and sim rate, and the
// login to the region // minimum time to run a scene's frame
sb[22].StatID = (uint)Stats.UsersLoggingIn; sb[22].StatID = (uint)Stats.FrameDilation;
sb[22].StatValue = m_usersLoggingIn; 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 // Total number of geometric primitives in the scene
sb[23].StatID = (uint)Stats.TotalGeoPrim; sb[24].StatID = (uint)Stats.TotalGeoPrim;
sb[23].StatValue = m_numGeoPrim; sb[24].StatValue = m_numGeoPrim;
// Total number of mesh objects in the scene // Total number of mesh objects in the scene
sb[24].StatID = (uint)Stats.TotalMesh; sb[25].StatID = (uint)Stats.TotalMesh;
sb[24].StatValue = m_numMesh; sb[25].StatValue = m_numMesh;
// Added to track the current number of threads that XEngine is // Current number of threads that XEngine is using
// using sb[26].StatID = (uint)Stats.ThreadCount;
sb[25].StatID = (uint)Stats.ThreadCount; sb[26].StatValue = m_inUseThreads;
sb[25].StatValue = m_inUseThreads;
for (int i = 0; i < m_statisticArraySize; i++) for (int i = 0; i < m_statisticArraySize; i++)
{ {