Add region heartbeat start event to complement heartbeat end event.

This allows object modification before the usual heartbeat operation.
cpu-performance
Robert Adams 2013-05-30 09:21:58 -07:00
parent 3aa2fb9928
commit 439f11cc3c
2 changed files with 25 additions and 0 deletions

View File

@ -969,6 +969,8 @@ namespace OpenSim.Region.Framework.Scenes
public delegate void RegionStarted(Scene scene); public delegate void RegionStarted(Scene scene);
public event RegionStarted OnRegionStarted; public event RegionStarted OnRegionStarted;
public delegate void RegionHeartbeatStart(Scene scene);
public event RegionHeartbeatStart OnRegionHeartbeatStart;
public delegate void RegionHeartbeatEnd(Scene scene); public delegate void RegionHeartbeatEnd(Scene scene);
public event RegionHeartbeatEnd OnRegionHeartbeatEnd; public event RegionHeartbeatEnd OnRegionHeartbeatEnd;
@ -3068,6 +3070,27 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
public void TriggerRegionHeartbeatStart(Scene scene)
{
RegionHeartbeatStart handler = OnRegionHeartbeatStart;
if (handler != null)
{
foreach (RegionHeartbeatStart d in handler.GetInvocationList())
{
try
{
d(scene);
}
catch (Exception e)
{
m_log.ErrorFormat("[EVENT MANAGER]: Delegate for OnRegionHeartbeatStart failed - continuing {0} - {1}",
e.Message, e.StackTrace);
}
}
}
}
public void TriggerRegionHeartbeatEnd(Scene scene) public void TriggerRegionHeartbeatEnd(Scene scene)
{ {
RegionHeartbeatEnd handler = OnRegionHeartbeatEnd; RegionHeartbeatEnd handler = OnRegionHeartbeatEnd;

View File

@ -1517,6 +1517,8 @@ namespace OpenSim.Region.Framework.Scenes
try try
{ {
EventManager.TriggerRegionHeartbeatStart(this);
// Apply taints in terrain module to terrain in physics scene // Apply taints in terrain module to terrain in physics scene
if (Frame % m_update_terrain == 0) if (Frame % m_update_terrain == 0)
{ {