Move expired objects cleaning trigger to the maintenance thread of a region rather than it's main scene loop.

[Startup] default setting UpdateTempCleaningEveryNFrames becomes UpdateTempCleaningEveryNSeconds.
Default becomes 180s instead of effective 182s (which would also vary with any changes in frame time or extra long frames)
ghosts
Justin Clark-Casey (justincc) 2014-09-27 00:23:52 +01:00
parent 528a7f3352
commit 2eece5b009
2 changed files with 27 additions and 24 deletions

View File

@ -399,13 +399,13 @@ namespace OpenSim.Region.Framework.Scenes
private int m_update_physics = 1; private int m_update_physics = 1;
private int m_update_entitymovement = 1; private int m_update_entitymovement = 1;
private int m_update_objects = 1; private int m_update_objects = 1;
private int m_update_temp_cleaning = 1000;
private int m_update_presences = 1; // Update scene presence movements private int m_update_presences = 1; // Update scene presence movements
private int m_update_events = 1; private int m_update_events = 1;
private int m_update_backup = 200; private int m_update_backup = 200;
private int m_update_terrain = 50; private int m_update_terrain = 50;
// private int m_update_land = 1; // private int m_update_land = 1;
private int m_update_coarse_locations = 50; private int m_update_coarse_locations = 50;
private int m_update_temp_cleaning = 180;
private int agentMS; private int agentMS;
private int frameMS; private int frameMS;
@ -1046,7 +1046,7 @@ namespace OpenSim.Region.Framework.Scenes
m_update_physics = startupConfig.GetInt( "UpdatePhysicsEveryNFrames", m_update_physics); m_update_physics = startupConfig.GetInt( "UpdatePhysicsEveryNFrames", m_update_physics);
m_update_presences = startupConfig.GetInt( "UpdateAgentsEveryNFrames", m_update_presences); m_update_presences = startupConfig.GetInt( "UpdateAgentsEveryNFrames", m_update_presences);
m_update_terrain = startupConfig.GetInt( "UpdateTerrainEveryNFrames", m_update_terrain); m_update_terrain = startupConfig.GetInt( "UpdateTerrainEveryNFrames", m_update_terrain);
m_update_temp_cleaning = startupConfig.GetInt( "UpdateTempCleaningEveryNFrames", m_update_temp_cleaning); m_update_temp_cleaning = startupConfig.GetInt( "UpdateTempCleaningEveryNSeconds", m_update_temp_cleaning);
} }
// FIXME: Ultimately this should be in a module. // FIXME: Ultimately this should be in a module.
@ -1523,7 +1523,7 @@ namespace OpenSim.Region.Framework.Scenes
public void DoMaintenance(int runs) public void DoMaintenance(int runs)
{ {
long? endRun = null; long? endRun = null;
int runtc; int runtc, tmpMS;
int previousMaintenanceTick; int previousMaintenanceTick;
if (runs >= 0) if (runs >= 0)
@ -1537,6 +1537,8 @@ namespace OpenSim.Region.Framework.Scenes
runtc = Util.EnvironmentTickCount(); runtc = Util.EnvironmentTickCount();
++MaintenanceRun; ++MaintenanceRun;
// m_log.DebugFormat("[SCENE]: Maintenance run {0} in {1}", MaintenanceRun, Name);
// Coarse locations relate to positions of green dots on the mini-map (on a SecondLife client) // Coarse locations relate to positions of green dots on the mini-map (on a SecondLife client)
if (MaintenanceRun % (m_update_coarse_locations / 10) == 0) if (MaintenanceRun % (m_update_coarse_locations / 10) == 0)
{ {
@ -1558,6 +1560,21 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
// Delete temp-on-rez stuff
if (MaintenanceRun % m_update_temp_cleaning == 0 && !m_cleaningTemps)
{
// m_log.DebugFormat("[SCENE]: Running temp-on-rez cleaning in {0}", Name);
tmpMS = Util.EnvironmentTickCount();
m_cleaningTemps = true;
Watchdog.RunInThread(
delegate { CleanTempObjects(); m_cleaningTemps = false; },
string.Format("CleanTempObjects ({0})", Name),
null);
tempOnRezMS = Util.EnvironmentTickCountSubtract(tmpMS);
}
Watchdog.UpdateThread(); Watchdog.UpdateThread();
previousMaintenanceTick = m_lastMaintenanceTick; previousMaintenanceTick = m_lastMaintenanceTick;
@ -1596,7 +1613,7 @@ namespace OpenSim.Region.Framework.Scenes
// m_log.DebugFormat("[SCENE]: Processing frame {0} in {1}", Frame, RegionInfo.RegionName); // m_log.DebugFormat("[SCENE]: Processing frame {0} in {1}", Frame, RegionInfo.RegionName);
agentMS = tempOnRezMS = eventMS = backupMS = terrainMS = landMS = spareMS = 0; agentMS = eventMS = backupMS = terrainMS = landMS = spareMS = 0;
try try
{ {
@ -1651,20 +1668,6 @@ namespace OpenSim.Region.Framework.Scenes
agentMS += Util.EnvironmentTickCountSubtract(tmpMS); agentMS += Util.EnvironmentTickCountSubtract(tmpMS);
// Delete temp-on-rez stuff
if (Frame % m_update_temp_cleaning == 0 && !m_cleaningTemps)
{
tmpMS = Util.EnvironmentTickCount();
m_cleaningTemps = true;
Watchdog.RunInThread(
delegate { CleanTempObjects(); m_cleaningTemps = false; },
string.Format("CleanTempObjects ({0})", Name),
null);
tempOnRezMS = Util.EnvironmentTickCountSubtract(tmpMS);
}
if (Frame % m_update_events == 0) if (Frame % m_update_events == 0)
{ {
tmpMS = Util.EnvironmentTickCount(); tmpMS = Util.EnvironmentTickCount();
@ -1733,7 +1736,7 @@ namespace OpenSim.Region.Framework.Scenes
} }
EventManager.TriggerRegionHeartbeatEnd(this); EventManager.TriggerRegionHeartbeatEnd(this);
otherMS = tempOnRezMS + eventMS + backupMS + terrainMS + landMS; otherMS = eventMS + backupMS + terrainMS + landMS;
if (!UpdateOnTimer) if (!UpdateOnTimer)
{ {

View File

@ -170,10 +170,6 @@
; This must be a whole number ; This must be a whole number
UpdatePhysicsEveryNFrames = 1; UpdatePhysicsEveryNFrames = 1;
; Clean up temp on rez objects.
; This must be a whole number
UpdateTempCleaningEveryNFrames = 1000;
; Send out the on frame event to modules and other listeners. This should probably never deviate from 1. ; Send out the on frame event to modules and other listeners. This should probably never deviate from 1.
; This must be a whole number ; This must be a whole number
UpdateEventsEveryNFrames = 1; UpdateEventsEveryNFrames = 1;
@ -186,6 +182,10 @@
; This must be a whole number ; This must be a whole number
UpdateStorageEveryNFrames = 200; UpdateStorageEveryNFrames = 200;
; Clean up temp on rez objects.
; This must be a whole number
UpdateTempCleaningEveryNSeconds = 180;
; ## ; ##
; ## PRIM STORAGE ; ## PRIM STORAGE
; ## ; ##