use GetTimeStampMS to increase heartbeat and stats timing resolution. some rearrange on stat code ( MOSES special ones still out )
parent
f0c865555b
commit
08f9c54554
|
@ -398,16 +398,16 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
private int m_update_coarse_locations = 50;
|
||||
private int m_update_temp_cleaning = 180;
|
||||
|
||||
private int agentMS;
|
||||
private int frameMS;
|
||||
private int physicsMS2;
|
||||
private int physicsMS;
|
||||
private int otherMS;
|
||||
private int tempOnRezMS;
|
||||
private int eventMS;
|
||||
private int backupMS;
|
||||
private int terrainMS;
|
||||
private int landMS;
|
||||
private float agentMS;
|
||||
private float frameMS;
|
||||
private float physicsMS2;
|
||||
private float physicsMS;
|
||||
private float otherMS;
|
||||
private float tempOnRezMS;
|
||||
private float eventMS;
|
||||
private float backupMS;
|
||||
private float terrainMS;
|
||||
private float landMS;
|
||||
|
||||
// A temporary configuration flag to enable using FireAndForget to process
|
||||
// collisions from the physics engine. There is a problem with collisions
|
||||
|
@ -785,15 +785,15 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
get { return m_capsModule; }
|
||||
}
|
||||
|
||||
public int MonitorFrameTime { get { return frameMS; } }
|
||||
public int MonitorPhysicsUpdateTime { get { return physicsMS; } }
|
||||
public int MonitorPhysicsSyncTime { get { return physicsMS2; } }
|
||||
public int MonitorOtherTime { get { return otherMS; } }
|
||||
public int MonitorTempOnRezTime { get { return tempOnRezMS; } }
|
||||
public int MonitorEventTime { get { return eventMS; } } // This may need to be divided into each event?
|
||||
public int MonitorBackupTime { get { return backupMS; } }
|
||||
public int MonitorTerrainTime { get { return terrainMS; } }
|
||||
public int MonitorLandTime { get { return landMS; } }
|
||||
public int MonitorFrameTime { get { return (int)frameMS; } }
|
||||
public int MonitorPhysicsUpdateTime { get { return (int)physicsMS; } }
|
||||
public int MonitorPhysicsSyncTime { get { return (int)physicsMS2; } }
|
||||
public int MonitorOtherTime { get { return (int)otherMS; } }
|
||||
public int MonitorTempOnRezTime { get { return (int)tempOnRezMS; } }
|
||||
public int MonitorEventTime { get { return (int)eventMS; } } // This may need to be divided into each event?
|
||||
public int MonitorBackupTime { get { return (int)backupMS; } }
|
||||
public int MonitorTerrainTime { get { return (int)terrainMS; } }
|
||||
public int MonitorLandTime { get { return (int)landMS; } }
|
||||
public int MonitorLastFrameTick { get { return m_lastFrameTick; } }
|
||||
|
||||
public UpdatePrioritizationSchemes UpdatePrioritizationScheme { get; set; }
|
||||
|
@ -1714,20 +1714,21 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
float physicsFPS = 0f;
|
||||
|
||||
int tmpMS;
|
||||
int previousFrameTick;
|
||||
int maintc;
|
||||
int sleepMS;
|
||||
int framestart;
|
||||
|
||||
double tmpMS;
|
||||
double tmpMS2;
|
||||
double framestart;
|
||||
float sleepMS;
|
||||
|
||||
while (!m_shuttingDown && ((endFrame == null && Active) || Frame < endFrame))
|
||||
{
|
||||
framestart = Util.EnvironmentTickCount();
|
||||
framestart = Util.GetTimeStampMS();
|
||||
++Frame;
|
||||
|
||||
// m_log.DebugFormat("[SCENE]: Processing frame {0} in {1}", Frame, RegionInfo.RegionName);
|
||||
|
||||
agentMS = tempOnRezMS = eventMS = backupMS = terrainMS = landMS = 0;
|
||||
agentMS = tempOnRezMS = eventMS = backupMS = terrainMS = landMS = 0f;
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -1735,7 +1736,8 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
// Apply taints in terrain module to terrain in physics scene
|
||||
|
||||
tmpMS = Util.EnvironmentTickCount();
|
||||
tmpMS = Util.GetTimeStampMS();
|
||||
|
||||
if (Frame % 4 == 0)
|
||||
{
|
||||
CheckTerrainUpdates();
|
||||
|
@ -1746,26 +1748,29 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
UpdateTerrain();
|
||||
}
|
||||
|
||||
terrainMS = Util.EnvironmentTickCountSubtract(tmpMS);
|
||||
tmpMS = Util.EnvironmentTickCount();
|
||||
tmpMS2 = Util.GetTimeStampMS();
|
||||
terrainMS = (float)(tmpMS2 - tmpMS);
|
||||
tmpMS = tmpMS2;
|
||||
|
||||
if (PhysicsEnabled && Frame % m_update_physics == 0)
|
||||
m_sceneGraph.UpdatePreparePhysics();
|
||||
|
||||
physicsMS2 = Util.EnvironmentTickCountSubtract(tmpMS);
|
||||
tmpMS2 = Util.GetTimeStampMS();
|
||||
physicsMS2 = (float)(tmpMS2 - tmpMS);
|
||||
tmpMS = tmpMS2;
|
||||
|
||||
// Apply any pending avatar force input to the avatar's velocity
|
||||
tmpMS = Util.EnvironmentTickCount();
|
||||
if (Frame % m_update_entitymovement == 0)
|
||||
m_sceneGraph.UpdateScenePresenceMovement();
|
||||
|
||||
// Get the simulation frame time that the avatar force input
|
||||
// took
|
||||
agentMS = Util.EnvironmentTickCountSubtract(tmpMS);
|
||||
tmpMS2 = Util.GetTimeStampMS();
|
||||
agentMS = (float)(tmpMS2 - tmpMS);
|
||||
tmpMS = tmpMS2;
|
||||
|
||||
// Perform the main physics update. This will do the actual work of moving objects and avatars according to their
|
||||
// velocity
|
||||
tmpMS = Util.EnvironmentTickCount();
|
||||
if (Frame % m_update_physics == 0)
|
||||
{
|
||||
if (PhysicsEnabled)
|
||||
|
@ -1774,12 +1779,10 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
if (SynchronizeScene != null)
|
||||
SynchronizeScene(this);
|
||||
}
|
||||
|
||||
// Add the main physics update time to the prepare physics time
|
||||
physicsMS = Util.EnvironmentTickCountSubtract(tmpMS);
|
||||
|
||||
// Start the stopwatch for the remainder of the simulation
|
||||
tmpMS = Util.EnvironmentTickCount();
|
||||
|
||||
tmpMS2 = Util.GetTimeStampMS();
|
||||
physicsMS = (float)(tmpMS2 - tmpMS);
|
||||
tmpMS = tmpMS2;
|
||||
|
||||
// Check if any objects have reached their targets
|
||||
CheckAtTargets();
|
||||
|
@ -1794,29 +1797,37 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
if (Frame % m_update_presences == 0)
|
||||
m_sceneGraph.UpdatePresences();
|
||||
|
||||
agentMS += Util.EnvironmentTickCountSubtract(tmpMS);
|
||||
tmpMS2 = Util.GetTimeStampMS();
|
||||
agentMS += (float)(tmpMS2 - tmpMS);
|
||||
tmpMS = tmpMS2;
|
||||
|
||||
// Delete temp-on-rez stuff
|
||||
if (Frame % m_update_temp_cleaning == 0 && !m_cleaningTemps)
|
||||
{
|
||||
tmpMS = Util.EnvironmentTickCount();
|
||||
|
||||
m_cleaningTemps = true;
|
||||
Util.FireAndForget(delegate { CleanTempObjects(); m_cleaningTemps = false; });
|
||||
tempOnRezMS = Util.EnvironmentTickCountSubtract(tmpMS);
|
||||
tmpMS2 = Util.GetTimeStampMS();
|
||||
tempOnRezMS = (float)(tmpMS2 - tmpMS); // bad.. counts the FireAndForget, not CleanTempObjects
|
||||
tmpMS = tmpMS2;
|
||||
}
|
||||
|
||||
if (Frame % m_update_events == 0)
|
||||
{
|
||||
tmpMS = Util.EnvironmentTickCount();
|
||||
UpdateEvents();
|
||||
eventMS = Util.EnvironmentTickCountSubtract(tmpMS);
|
||||
|
||||
tmpMS2 = Util.GetTimeStampMS();
|
||||
eventMS = (float)(tmpMS2 - tmpMS);
|
||||
tmpMS = tmpMS2;
|
||||
}
|
||||
|
||||
if (PeriodicBackup && Frame % m_update_backup == 0)
|
||||
{
|
||||
tmpMS = Util.EnvironmentTickCount();
|
||||
UpdateStorageBackup();
|
||||
backupMS = Util.EnvironmentTickCountSubtract(tmpMS);
|
||||
|
||||
tmpMS2 = Util.GetTimeStampMS();
|
||||
backupMS = (float)(tmpMS2 - tmpMS);
|
||||
tmpMS = tmpMS2;
|
||||
}
|
||||
|
||||
//if (Frame % m_update_land == 0)
|
||||
|
@ -1887,20 +1898,26 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
StatsReporter.addOtherMS(otherMS);
|
||||
StatsReporter.addScriptLines(m_sceneGraph.GetScriptLPS());
|
||||
|
||||
|
||||
tmpMS = Util.GetTimeStampMS();
|
||||
|
||||
previousFrameTick = m_lastFrameTick;
|
||||
m_lastFrameTick = Util.EnvironmentTickCount();
|
||||
tmpMS = Util.EnvironmentTickCountSubtract(m_lastFrameTick, framestart);
|
||||
tmpMS = (int)(MinFrameTime * 1000) - tmpMS;
|
||||
m_lastFrameTick = (int)(tmpMS + 0.5);
|
||||
|
||||
// estimate sleep time
|
||||
tmpMS2 = tmpMS - framestart;
|
||||
tmpMS2 = (double)MinFrameTime * 1000.0D - tmpMS2;
|
||||
|
||||
m_firstHeartbeat = false;
|
||||
|
||||
sleepMS = Util.EnvironmentTickCount();
|
||||
// sleep if we can
|
||||
if (tmpMS2 > 0)
|
||||
Thread.Sleep((int)(tmpMS2 +0.5));
|
||||
|
||||
if (tmpMS > 0)
|
||||
Thread.Sleep(tmpMS);
|
||||
tmpMS2 = Util.GetTimeStampMS();
|
||||
|
||||
sleepMS = Util.EnvironmentTickCountSubtract(sleepMS);
|
||||
frameMS = Util.EnvironmentTickCountSubtract(framestart);
|
||||
sleepMS = (float)(tmpMS2 - tmpMS);
|
||||
frameMS = (float)(tmpMS2 - framestart);
|
||||
StatsReporter.addSleepMS(sleepMS);
|
||||
StatsReporter.addFrameMS(frameMS);
|
||||
|
||||
|
|
|
@ -90,7 +90,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
Agents = 13,
|
||||
ChildAgents = 14,
|
||||
ActiveScripts = 15,
|
||||
ScriptLinesPerSecond = 16,
|
||||
LSLScriptLinesPerSecond = 16, // viewers don't like this
|
||||
InPacketsPerSecond = 17,
|
||||
OutPacketsPerSecond = 18,
|
||||
PendingDownloads = 19,
|
||||
|
@ -109,11 +109,18 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
SimSpareMs = 32,
|
||||
SimSleepMs = 33,
|
||||
SimIoPumpTime = 34,
|
||||
FrameDilation = 35,
|
||||
UsersLoggingIn = 36,
|
||||
TotalGeoPrim = 37,
|
||||
TotalMesh = 38,
|
||||
ThreadCount = 39
|
||||
SimPCTSscriptsRun = 35,
|
||||
SimRegionIdle = 36, // dataserver only
|
||||
SimRegionIdlePossible = 37, // dataserver only
|
||||
SimAIStepTimeMS = 38,
|
||||
SimSkippedSillouet_PS = 39,
|
||||
SimSkippedCharsPerC = 40,
|
||||
|
||||
MOSESFrameDilation = 100,
|
||||
MOSESUsersLoggingIn = 101,
|
||||
MOSESTotalGeoPrim = 102,
|
||||
MOSESTotalMesh = 103,
|
||||
MOSESThreadCount = 104
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -170,7 +177,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
/// <summary>
|
||||
/// Our nominal fps target, as expected in fps stats when a sim is running normally.
|
||||
/// </summary>
|
||||
private float m_nominalReportedFps = 55;
|
||||
private float m_nominalReportedFps = 11;
|
||||
|
||||
/// <summary>
|
||||
/// Parameter to adjust reported scene fps
|
||||
|
@ -197,17 +204,14 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
/// </summary>
|
||||
private int m_objectUpdates;
|
||||
|
||||
private int m_frameMS;
|
||||
private float m_frameMS;
|
||||
|
||||
private int m_netMS;
|
||||
private int m_agentMS;
|
||||
private int m_physicsMS;
|
||||
private int m_imageMS;
|
||||
private int m_otherMS;
|
||||
private int m_sleeptimeMS;
|
||||
|
||||
//Ckrinke: (3-21-08) Comment out to remove a compiler warning. Bring back into play when needed.
|
||||
//Ckrinke private int m_scriptMS = 0;
|
||||
private float m_netMS;
|
||||
private float m_agentMS;
|
||||
private float m_physicsMS;
|
||||
private float m_imageMS;
|
||||
private float m_otherMS;
|
||||
private float m_sleeptimeMS;
|
||||
|
||||
private int m_rootAgents;
|
||||
private int m_childAgents;
|
||||
|
@ -221,7 +225,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
private int m_pendingDownloads;
|
||||
private int m_pendingUploads = 0; // FIXME: Not currently filled in
|
||||
private int m_activeScripts;
|
||||
private int m_scriptLinesPerSecond;
|
||||
// private int m_scriptLinesPerSecond;
|
||||
|
||||
private int m_objectCapacity = 45000;
|
||||
|
||||
|
@ -264,8 +268,10 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
public SimStatsReporter(Scene scene)
|
||||
{
|
||||
m_scene = scene;
|
||||
m_reportedFpsCorrectionFactor = scene.MinFrameTime * m_nominalReportedFps;
|
||||
m_statsUpdateFactor = (float)(m_statsUpdatesEveryMS / 1000);
|
||||
// m_reportedFpsCorrectionFactor = 5.0f; // needs to come from config
|
||||
m_reportedFpsCorrectionFactor = 1.0f; // needs to come from config
|
||||
m_nominalReportedFps *= m_reportedFpsCorrectionFactor;
|
||||
m_statsUpdateFactor = (float)(m_statsUpdatesEveryMS / 1000.0f);
|
||||
ReportingRegion = scene.RegionInfo;
|
||||
|
||||
m_objectCapacity = scene.RegionInfo.ObjectCapacity;
|
||||
|
@ -310,7 +316,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
public void SetUpdateMS(int ms)
|
||||
{
|
||||
m_statsUpdatesEveryMS = ms;
|
||||
m_statsUpdateFactor = (float)(m_statsUpdatesEveryMS / 1000);
|
||||
m_statsUpdateFactor = (float)(m_statsUpdatesEveryMS / 1000.0f);
|
||||
m_report.Interval = m_statsUpdatesEveryMS;
|
||||
}
|
||||
|
||||
|
@ -333,8 +339,8 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
if (!m_scene.Active)
|
||||
return;
|
||||
|
||||
SimStatsPacket.StatBlock[] sb = new SimStatsPacket.StatBlock[23];
|
||||
SimStatsPacket.RegionBlock rb = new SimStatsPacket.RegionBlock();
|
||||
SimStatsPacket.StatBlock[] sb = new SimStatsPacket.StatBlock[23];
|
||||
SimStatsPacket.RegionBlock rb = new SimStatsPacket.RegionBlock();
|
||||
|
||||
// Know what's not thread safe in Mono... modifying timers.
|
||||
// m_log.Debug("Firing Stats Heart Beat");
|
||||
|
@ -354,21 +360,14 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
}
|
||||
|
||||
#region various statistic googly moogly
|
||||
|
||||
// ORIGINAL code commented out until we have time to add our own
|
||||
// statistics to the statistics window, this will be done as a
|
||||
// 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
|
||||
// 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 = m_fps;
|
||||
int reportedFPS = (int)(m_fps * m_reportedFpsCorrectionFactor);
|
||||
|
||||
// save the reported value so there is something available for llGetRegionFPS
|
||||
lastReportedSimFPS = reportedFPS / m_statsUpdateFactor;
|
||||
|
||||
// ORIGINAL code commented out until we have time to add our own
|
||||
// statistics to the statistics window
|
||||
float physfps = ((m_pfps / 1000));
|
||||
float physfps = ((m_pfps / 1000.0f));
|
||||
|
||||
//if (physfps > 600)
|
||||
//physfps = physfps - (physfps - 600);
|
||||
|
@ -377,7 +376,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
physfps = 0;
|
||||
|
||||
#endregion
|
||||
float factor = 1 / m_statsUpdateFactor;
|
||||
float factor = 1.0f / m_statsUpdateFactor;
|
||||
|
||||
if (reportedFPS <= 0)
|
||||
reportedFPS = 1;
|
||||
|
@ -386,7 +385,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
float TotalFrameTime = m_frameMS * perframe;
|
||||
|
||||
float targetframetime = 1100.0f / (float)m_nominalReportedFps;
|
||||
float targetframetime = 1000.0f / (float)m_nominalReportedFps;
|
||||
|
||||
float sparetime;
|
||||
float sleeptime;
|
||||
|
@ -431,10 +430,9 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
{
|
||||
sb[i] = new SimStatsPacket.StatBlock();
|
||||
}
|
||||
|
||||
|
||||
|
||||
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 ;
|
||||
|
||||
sb[1].StatID = (uint) Stats.SimFPS;
|
||||
sb[1].StatValue = reportedFPS / m_statsUpdateFactor;
|
||||
|
@ -493,14 +491,15 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
sb[19].StatID = (uint)Stats.ActiveScripts;
|
||||
sb[19].StatValue = m_activeScripts;
|
||||
|
||||
sb[20].StatID = (uint)Stats.ScriptLinesPerSecond;
|
||||
sb[20].StatValue = m_scriptLinesPerSecond / m_statsUpdateFactor;
|
||||
sb[20].StatID = (uint)Stats.SimSpareMs;
|
||||
sb[20].StatValue = sparetime;
|
||||
|
||||
sb[21].StatID = (uint)Stats.SimSpareMs;
|
||||
sb[21].StatValue = sparetime;
|
||||
sb[21].StatID = (uint)Stats.SimSleepMs;
|
||||
sb[21].StatValue = sleeptime;
|
||||
|
||||
sb[22].StatID = (uint)Stats.SimSleepMs;
|
||||
sb[22].StatValue = sleeptime;
|
||||
// this should came from phys engine
|
||||
sb[22].StatID = (uint)Stats.SimPhysicsStepMs;
|
||||
sb[22].StatValue = 20;
|
||||
|
||||
for (int i = 0; i < 23; i++)
|
||||
{
|
||||
|
@ -563,7 +562,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
//m_inPacketsPerSecond = 0;
|
||||
//m_outPacketsPerSecond = 0;
|
||||
m_unAckedBytes = 0;
|
||||
m_scriptLinesPerSecond = 0;
|
||||
// m_scriptLinesPerSecond = 0;
|
||||
|
||||
m_frameMS = 0;
|
||||
m_agentMS = 0;
|
||||
|
@ -571,7 +570,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
m_physicsMS = 0;
|
||||
m_imageMS = 0;
|
||||
m_otherMS = 0;
|
||||
// m_spareMS = 0;
|
||||
m_sleeptimeMS = 0;
|
||||
|
||||
//Ckrinke This variable is not used, so comment to remove compiler warning until it is used.
|
||||
|
@ -646,7 +644,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
if (m_unAckedBytes < 0) m_unAckedBytes = 0;
|
||||
}
|
||||
|
||||
public void addFrameMS(int ms)
|
||||
public void addFrameMS(float ms)
|
||||
{
|
||||
m_frameMS += ms;
|
||||
|
||||
|
@ -656,32 +654,32 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
SlowFramesStat.Value++;
|
||||
}
|
||||
|
||||
public void addNetMS(int ms)
|
||||
public void addNetMS(float ms)
|
||||
{
|
||||
m_netMS += ms;
|
||||
}
|
||||
|
||||
public void addAgentMS(int ms)
|
||||
public void addAgentMS(float ms)
|
||||
{
|
||||
m_agentMS += ms;
|
||||
}
|
||||
|
||||
public void addPhysicsMS(int ms)
|
||||
public void addPhysicsMS(float ms)
|
||||
{
|
||||
m_physicsMS += ms;
|
||||
}
|
||||
|
||||
public void addImageMS(int ms)
|
||||
public void addImageMS(float ms)
|
||||
{
|
||||
m_imageMS += ms;
|
||||
}
|
||||
|
||||
public void addOtherMS(int ms)
|
||||
public void addOtherMS(float ms)
|
||||
{
|
||||
m_otherMS += ms;
|
||||
}
|
||||
|
||||
public void addSleepMS(int ms)
|
||||
public void addSleepMS(float ms)
|
||||
{
|
||||
m_sleeptimeMS += ms;
|
||||
}
|
||||
|
@ -698,7 +696,8 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
public void addScriptLines(int count)
|
||||
{
|
||||
m_scriptLinesPerSecond += count;
|
||||
// we need events not lines
|
||||
// m_scriptLinesPerSecond += count;
|
||||
}
|
||||
|
||||
public void AddPacketsStats(int inPackets, int outPackets, int unAckedBytes)
|
||||
|
|
Loading…
Reference in New Issue