commit
e7f2b77bfb
|
@ -1107,7 +1107,27 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
#endregion Interest Management
|
#endregion Interest Management
|
||||||
|
|
||||||
StatsReporter = new SimStatsReporter(this);
|
// Acquire the statistics section of the OpenSim.ini file located
|
||||||
|
// in the bin directory
|
||||||
|
IConfig statisticsConfig = m_config.Configs["Statistics"];
|
||||||
|
|
||||||
|
// Confirm that the statistics section existed in the configuration
|
||||||
|
// file
|
||||||
|
if (statisticsConfig != null)
|
||||||
|
{
|
||||||
|
// Create the StatsReporter using the number of frames to store
|
||||||
|
// for the frame time statistics, or 10 frames if the config
|
||||||
|
// file doesn't contain a value
|
||||||
|
StatsReporter = new SimStatsReporter(this,
|
||||||
|
statisticsConfig.GetInt("NumberOfFrames", 10));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Create a StatsReporter with the current scene and a default
|
||||||
|
// 10 frames stored for the frame time statistics
|
||||||
|
StatsReporter = new SimStatsReporter(this);
|
||||||
|
}
|
||||||
|
|
||||||
StatsReporter.OnSendStatsResult += SendSimStatsPackets;
|
StatsReporter.OnSendStatsResult += SendSimStatsPackets;
|
||||||
StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats;
|
StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats;
|
||||||
|
|
||||||
|
@ -1607,6 +1627,21 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
float physicsFPS = 0f;
|
float physicsFPS = 0f;
|
||||||
int previousFrameTick, tmpMS;
|
int previousFrameTick, tmpMS;
|
||||||
|
|
||||||
|
// These variables will be used to save the precise frame time using the
|
||||||
|
// Stopwatch class of Microsoft SDK; the times are recorded at the start
|
||||||
|
// and end of a particular section of code, and then used to calculate
|
||||||
|
// the frame times, which are the sums of the sections for each given name
|
||||||
|
double preciseTotalFrameTime = 0.0;
|
||||||
|
double preciseSimFrameTime = 0.0;
|
||||||
|
double precisePhysicsFrameTime = 0.0;
|
||||||
|
Stopwatch totalFrameStopwatch = new Stopwatch();
|
||||||
|
Stopwatch simFrameStopwatch = new Stopwatch();
|
||||||
|
Stopwatch physicsFrameStopwatch = new Stopwatch();
|
||||||
|
|
||||||
|
// Begin the stopwatch to keep track of the time that the frame
|
||||||
|
// started running to determine how long the frame took to complete
|
||||||
|
totalFrameStopwatch.Start();
|
||||||
|
|
||||||
while (!m_shuttingDown && ((endFrame == null && Active) || Frame < endFrame))
|
while (!m_shuttingDown && ((endFrame == null && Active) || Frame < endFrame))
|
||||||
{
|
{
|
||||||
++Frame;
|
++Frame;
|
||||||
|
@ -1622,25 +1657,62 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// 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)
|
||||||
{
|
{
|
||||||
|
// At several points inside the code there was a need to
|
||||||
|
// create a more precise measurement of time elapsed.
|
||||||
|
// This led to the addition of variables that have a
|
||||||
|
// similar function and thus remain tightly connected to
|
||||||
|
// their original counterparts. However, the original
|
||||||
|
// code is not receiving comments from our group because
|
||||||
|
// we don't feel right modifying the code to that degree
|
||||||
|
// at this point in time, the precise values all begin
|
||||||
|
// with the keyword precise
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
tmpMS = Util.EnvironmentTickCount();
|
tmpMS = Util.EnvironmentTickCount();
|
||||||
|
|
||||||
|
// Begin the stopwatch to track the time to prepare physics
|
||||||
|
physicsFrameStopwatch.Start();
|
||||||
if (PhysicsEnabled && Frame % m_update_physics == 0)
|
if (PhysicsEnabled && Frame % m_update_physics == 0)
|
||||||
m_sceneGraph.UpdatePreparePhysics();
|
m_sceneGraph.UpdatePreparePhysics();
|
||||||
|
|
||||||
|
// Get the time it took to prepare the physics, this
|
||||||
|
// would report the most precise time that physics was
|
||||||
|
// running on the machine and should the physics not be
|
||||||
|
// enabled will report the time it took to check if physics
|
||||||
|
// was enabled
|
||||||
|
physicsFrameStopwatch.Stop();
|
||||||
|
precisePhysicsFrameTime =
|
||||||
|
physicsFrameStopwatch.Elapsed.TotalMilliseconds;
|
||||||
physicsMS2 = Util.EnvironmentTickCountSubtract(tmpMS);
|
physicsMS2 = Util.EnvironmentTickCountSubtract(tmpMS);
|
||||||
|
|
||||||
// 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.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
|
||||||
|
simFrameStopwatch.Stop();
|
||||||
|
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
|
||||||
// velocity
|
// velocity
|
||||||
tmpMS = Util.EnvironmentTickCount();
|
tmpMS = Util.EnvironmentTickCount();
|
||||||
|
physicsFrameStopwatch.Restart();
|
||||||
if (Frame % m_update_physics == 0)
|
if (Frame % m_update_physics == 0)
|
||||||
{
|
{
|
||||||
if (PhysicsEnabled)
|
if (PhysicsEnabled)
|
||||||
|
@ -1649,8 +1721,16 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
if (SynchronizeScene != null)
|
if (SynchronizeScene != null)
|
||||||
SynchronizeScene(this);
|
SynchronizeScene(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add the main physics update time to the prepare physics
|
||||||
|
// time
|
||||||
|
physicsFrameStopwatch.Stop();
|
||||||
|
precisePhysicsFrameTime +=
|
||||||
|
physicsFrameStopwatch.Elapsed.TotalMilliseconds;
|
||||||
physicsMS = Util.EnvironmentTickCountSubtract(tmpMS);
|
physicsMS = Util.EnvironmentTickCountSubtract(tmpMS);
|
||||||
|
|
||||||
|
// Start the stopwatch for the remainder of the simulation
|
||||||
|
simFrameStopwatch.Restart();
|
||||||
tmpMS = Util.EnvironmentTickCount();
|
tmpMS = Util.EnvironmentTickCount();
|
||||||
|
|
||||||
// Check if any objects have reached their targets
|
// Check if any objects have reached their targets
|
||||||
|
@ -1738,6 +1818,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();
|
||||||
|
@ -1754,6 +1839,14 @@ 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 total frame time
|
||||||
|
totalFrameStopwatch.Stop();
|
||||||
|
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);
|
||||||
m_lastFrameTick = Util.EnvironmentTickCount();
|
m_lastFrameTick = Util.EnvironmentTickCount();
|
||||||
|
@ -1771,6 +1864,15 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
StatsReporter.AddSpareMS(spareMS);
|
StatsReporter.AddSpareMS(spareMS);
|
||||||
StatsReporter.addScriptLines(m_sceneGraph.GetScriptLPS());
|
StatsReporter.addScriptLines(m_sceneGraph.GetScriptLPS());
|
||||||
|
|
||||||
|
// Send the correct time values to the stats reporter for the
|
||||||
|
// frame times
|
||||||
|
StatsReporter.addFrameTimeMilliseconds(preciseTotalFrameTime,
|
||||||
|
preciseSimFrameTime, precisePhysicsFrameTime, 0.0);
|
||||||
|
|
||||||
|
// Send the correct number of frames that the physics library
|
||||||
|
// has processed to the stats reporter
|
||||||
|
StatsReporter.addPhysicsFrame(1);
|
||||||
|
|
||||||
// Optionally warn if a frame takes double the amount of time that it should.
|
// Optionally warn if a frame takes double the amount of time that it should.
|
||||||
if (DebugUpdates
|
if (DebugUpdates
|
||||||
&& Util.EnvironmentTickCountSubtract(
|
&& Util.EnvironmentTickCountSubtract(
|
||||||
|
|
|
@ -213,6 +213,27 @@ 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
|
||||||
|
// 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
|
||||||
|
// NumberOfFrames parameter
|
||||||
|
private int m_numberFramesStored = 10;
|
||||||
|
|
||||||
|
// 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
|
||||||
|
private double[] m_totalFrameTimeMilliseconds;
|
||||||
|
private double[] m_simulationFrameTimeMilliseconds;
|
||||||
|
private double[] m_physicsFrameTimeMilliseconds;
|
||||||
|
private double[] m_networkFrameTimeMilliseconds;
|
||||||
|
|
||||||
|
// The location of the next time in milliseconds that will be
|
||||||
|
// (over)written when the next frame completes
|
||||||
|
private int m_nextLocation = 0;
|
||||||
|
|
||||||
|
// The correct number of frames that have completed since the last stats
|
||||||
|
// update for physics
|
||||||
|
private int m_numberPhysicsFrames;
|
||||||
|
|
||||||
private Scene m_scene;
|
private Scene m_scene;
|
||||||
|
|
||||||
private RegionInfo ReportingRegion;
|
private RegionInfo ReportingRegion;
|
||||||
|
@ -223,6 +244,13 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
public SimStatsReporter(Scene scene)
|
public SimStatsReporter(Scene scene)
|
||||||
{
|
{
|
||||||
|
// Initialize the different frame time arrays to the correct sizes
|
||||||
|
m_totalFrameTimeMilliseconds = new double[m_numberFramesStored];
|
||||||
|
m_simulationFrameTimeMilliseconds = new
|
||||||
|
double[m_numberFramesStored];
|
||||||
|
m_physicsFrameTimeMilliseconds = new double[m_numberFramesStored];
|
||||||
|
m_networkFrameTimeMilliseconds = new double[m_numberFramesStored];
|
||||||
|
|
||||||
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);
|
||||||
|
@ -256,6 +284,13 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
StatsManager.RegisterStat(SlowFramesStat);
|
StatsManager.RegisterStat(SlowFramesStat);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public SimStatsReporter(Scene scene, int numberOfFrames) : this (scene)
|
||||||
|
{
|
||||||
|
// Store the number of frames from the OpenSim.ini configuration
|
||||||
|
// file
|
||||||
|
m_numberFramesStored = numberOfFrames;
|
||||||
|
}
|
||||||
|
|
||||||
public void Close()
|
public void Close()
|
||||||
{
|
{
|
||||||
m_report.Elapsed -= TriggerStatsHeartbeat;
|
m_report.Elapsed -= TriggerStatsHeartbeat;
|
||||||
|
@ -289,6 +324,11 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
private void statsHeartBeat(object sender, EventArgs e)
|
private void statsHeartBeat(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
double totalSumFrameTime;
|
||||||
|
double simulationSumFrameTime;
|
||||||
|
double physicsSumFrameTime;
|
||||||
|
double networkSumFrameTime;
|
||||||
|
|
||||||
if (!m_scene.Active)
|
if (!m_scene.Active)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -314,14 +354,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
|
||||||
|
// 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
|
// 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;
|
||||||
|
|
||||||
// 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;
|
||||||
|
|
||||||
float physfps = ((m_pfps / 1000));
|
// 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_numberPhysicsFrames;
|
||||||
|
|
||||||
//if (physfps > 600)
|
//if (physfps > 600)
|
||||||
//physfps = physfps - (physfps - 600);
|
//physfps = physfps - (physfps - 600);
|
||||||
|
@ -364,6 +411,26 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
sb[i] = new SimStatsPacket.StatBlock();
|
sb[i] = new SimStatsPacket.StatBlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Resetting the sums of the frame times to prevent any errors
|
||||||
|
// in calculating the moving average for frame time
|
||||||
|
totalSumFrameTime = 0;
|
||||||
|
simulationSumFrameTime = 0;
|
||||||
|
physicsSumFrameTime = 0;
|
||||||
|
networkSumFrameTime = 0;
|
||||||
|
|
||||||
|
// Loop through all the frames that were stored for the current
|
||||||
|
// heartbeat to process the moving average of frame times
|
||||||
|
for (int i = 0; i < m_numberFramesStored; i++)
|
||||||
|
{
|
||||||
|
// Sum up each frame time in order to calculate the moving
|
||||||
|
// average of frame time
|
||||||
|
totalSumFrameTime += m_totalFrameTimeMilliseconds[i];
|
||||||
|
simulationSumFrameTime +=
|
||||||
|
m_simulationFrameTimeMilliseconds[i];
|
||||||
|
physicsSumFrameTime += m_physicsFrameTimeMilliseconds[i];
|
||||||
|
networkSumFrameTime += m_networkFrameTimeMilliseconds[i];
|
||||||
|
}
|
||||||
|
|
||||||
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));
|
||||||
|
|
||||||
|
@ -388,21 +455,31 @@ 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
|
||||||
|
// 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 /
|
||||||
|
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 /
|
||||||
|
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 /
|
||||||
|
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 /
|
||||||
|
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);
|
||||||
|
|
||||||
|
@ -475,6 +552,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
private void ResetValues()
|
private void ResetValues()
|
||||||
{
|
{
|
||||||
|
// Reset the number of frames that the physics library has
|
||||||
|
// processed since the last stats report
|
||||||
|
m_numberPhysicsFrames = 0;
|
||||||
|
|
||||||
m_timeDilation = 0;
|
m_timeDilation = 0;
|
||||||
m_fps = 0;
|
m_fps = 0;
|
||||||
m_pfps = 0;
|
m_pfps = 0;
|
||||||
|
@ -605,6 +686,32 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
m_otherMS += ms;
|
m_otherMS += ms;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void addPhysicsFrame(int frames)
|
||||||
|
{
|
||||||
|
// Add the number of physics frames to the correct total physics
|
||||||
|
// frames
|
||||||
|
m_numberPhysicsFrames += frames;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addFrameTimeMilliseconds(double total, double simulation,
|
||||||
|
double physics, double network)
|
||||||
|
{
|
||||||
|
// Save the frame times from the current frame into the appropriate
|
||||||
|
// arrays
|
||||||
|
m_totalFrameTimeMilliseconds[m_nextLocation] = total;
|
||||||
|
m_simulationFrameTimeMilliseconds[m_nextLocation] = simulation;
|
||||||
|
m_physicsFrameTimeMilliseconds[m_nextLocation] = physics;
|
||||||
|
m_networkFrameTimeMilliseconds[m_nextLocation] = network;
|
||||||
|
|
||||||
|
// Update to the next location in the list
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
public void AddPendingDownloads(int count)
|
public void AddPendingDownloads(int count)
|
||||||
{
|
{
|
||||||
m_pendingDownloads += count;
|
m_pendingDownloads += count;
|
||||||
|
|
|
@ -398,27 +398,31 @@ namespace OpenSim.Region.OptionalModules.World.NPC
|
||||||
|
|
||||||
public bool DeleteNPC(UUID agentID, Scene scene)
|
public bool DeleteNPC(UUID agentID, Scene scene)
|
||||||
{
|
{
|
||||||
|
bool doRemove = false;
|
||||||
|
NPCAvatar av;
|
||||||
lock (m_avatars)
|
lock (m_avatars)
|
||||||
{
|
{
|
||||||
NPCAvatar av;
|
|
||||||
if (m_avatars.TryGetValue(agentID, out av))
|
if (m_avatars.TryGetValue(agentID, out av))
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
m_log.DebugFormat("[NPC MODULE]: Found {0} {1} to remove",
|
m_log.DebugFormat("[NPC MODULE]: Found {0} {1} to remove",
|
||||||
agentID, av.Name);
|
agentID, av.Name);
|
||||||
*/
|
*/
|
||||||
|
doRemove = true;
|
||||||
scene.CloseAgent(agentID, false);
|
|
||||||
|
|
||||||
m_avatars.Remove(agentID);
|
|
||||||
|
|
||||||
/*
|
|
||||||
m_log.DebugFormat("[NPC MODULE]: Removed NPC {0} {1}",
|
|
||||||
agentID, av.Name);
|
|
||||||
*/
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (doRemove)
|
||||||
|
{
|
||||||
|
scene.CloseAgent(agentID, false);
|
||||||
|
lock (m_avatars)
|
||||||
|
{
|
||||||
|
m_avatars.Remove(agentID);
|
||||||
|
}
|
||||||
|
m_log.DebugFormat("[NPC MODULE]: Removed NPC {0} {1}",
|
||||||
|
agentID, av.Name);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
/*
|
/*
|
||||||
m_log.DebugFormat("[NPC MODULE]: Could not find {0} to remove",
|
m_log.DebugFormat("[NPC MODULE]: Could not find {0} to remove",
|
||||||
agentID);
|
agentID);
|
||||||
|
@ -457,4 +461,4 @@ namespace OpenSim.Region.OptionalModules.World.NPC
|
||||||
av.OwnerID == callerID || av.AgentId == callerID;
|
av.OwnerID == callerID || av.AgentId == callerID;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue