mirror of
https://github.com/opensim/opensim.git
synced 2026-08-07 01:35:46 +08:00
bad merge?
This commit is contained in:
@@ -184,7 +184,11 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
// saved last reported value so there is something available for llGetRegionFPS
|
||||
private float lastReportedSimFPS;
|
||||
<<<<<<< HEAD
|
||||
private float[] lastReportedSimStats = new float[m_statisticArraySize];
|
||||
=======
|
||||
private float[] lastReportedSimStats = new float[23];
|
||||
>>>>>>> avn/ubitvar
|
||||
private float m_pfps;
|
||||
|
||||
/// <summary>
|
||||
@@ -198,13 +202,20 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
private int m_objectUpdates;
|
||||
|
||||
private int m_frameMS;
|
||||
private int m_spareMS;
|
||||
|
||||
private int m_netMS;
|
||||
private int m_agentMS;
|
||||
private int m_physicsMS;
|
||||
private int m_imageMS;
|
||||
private int m_otherMS;
|
||||
<<<<<<< HEAD
|
||||
private int m_scriptMS;
|
||||
=======
|
||||
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;
|
||||
>>>>>>> avn/ubitvar
|
||||
|
||||
private int m_rootAgents;
|
||||
private int m_childAgents;
|
||||
@@ -355,11 +366,15 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
if (!m_scene.Active)
|
||||
return;
|
||||
|
||||
<<<<<<< HEAD
|
||||
// Create arrays to hold the statistics for this current scene,
|
||||
// these will be passed to the SimExtraStatsCollector, they are also
|
||||
// sent to the SimStats class
|
||||
SimStatsPacket.StatBlock[] sb = new
|
||||
SimStatsPacket.StatBlock[m_statisticArraySize];
|
||||
=======
|
||||
SimStatsPacket.StatBlock[] sb = new SimStatsPacket.StatBlock[23];
|
||||
>>>>>>> avn/ubitvar
|
||||
SimStatsPacket.RegionBlock rb = new SimStatsPacket.RegionBlock();
|
||||
|
||||
// Know what's not thread safe in Mono... modifying timers.
|
||||
@@ -404,6 +419,35 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
physfps = 0;
|
||||
|
||||
#endregion
|
||||
float factor = 1 / m_statsUpdateFactor;
|
||||
|
||||
if (reportedFPS <= 0)
|
||||
reportedFPS = 1;
|
||||
|
||||
float perframe = 1.0f / (float)reportedFPS;
|
||||
|
||||
float TotalFrameTime = m_frameMS * perframe;
|
||||
|
||||
float targetframetime = 1100.0f / (float)m_nominalReportedFps;
|
||||
|
||||
float sparetime;
|
||||
float sleeptime;
|
||||
|
||||
if (TotalFrameTime > targetframetime)
|
||||
{
|
||||
sparetime = 0;
|
||||
sleeptime = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
sparetime = m_frameMS - m_physicsMS - m_agentMS;
|
||||
sparetime *= perframe;
|
||||
if (sparetime < 0)
|
||||
sparetime = 0;
|
||||
else if (sparetime > TotalFrameTime)
|
||||
sparetime = TotalFrameTime;
|
||||
sleeptime = m_sleeptimeMS * perframe;
|
||||
}
|
||||
|
||||
m_rootAgents = m_scene.SceneGraph.GetRootAgentCount();
|
||||
m_childAgents = m_scene.SceneGraph.GetChildAgentCount();
|
||||
@@ -417,16 +461,11 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
// so that stat numbers are always consistent.
|
||||
CheckStatSanity();
|
||||
|
||||
//Our time dilation is 0.91 when we're running a full speed,
|
||||
// therefore to make sure we get an appropriate range,
|
||||
// we have to factor in our error. (0.10f * statsUpdateFactor)
|
||||
// multiplies the fix for the error times the amount of times it'll occur a second
|
||||
// / 10 divides the value by the number of times the sim heartbeat runs (10fps)
|
||||
// Then we divide the whole amount by the amount of seconds pass in between stats updates.
|
||||
|
||||
// 'statsUpdateFactor' is how often stats packets are sent in seconds. Used below to change
|
||||
// values to X-per-second values.
|
||||
// other MS is actually simulation time
|
||||
// m_otherMS = m_frameMS - m_physicsMS - m_imageMS - m_netMS - m_agentMS;
|
||||
// m_imageMS m_netMS are not included in m_frameMS
|
||||
|
||||
<<<<<<< HEAD
|
||||
uint thisFrame = m_scene.Frame;
|
||||
uint numFrames = thisFrame - m_lastUpdateFrame;
|
||||
float framesUpdated = (float)numFrames * m_reportedFpsCorrectionFactor;
|
||||
@@ -437,6 +476,13 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
framesUpdated = 1;
|
||||
|
||||
for (int i = 0; i < m_statisticArraySize; i++)
|
||||
=======
|
||||
m_otherMS = m_frameMS - m_physicsMS - m_agentMS - m_sleeptimeMS;
|
||||
if (m_otherMS < 0)
|
||||
m_otherMS = 0;
|
||||
|
||||
for (int i = 0; i < 23; i++)
|
||||
>>>>>>> avn/ubitvar
|
||||
{
|
||||
sb[i] = new SimStatsPacket.StatBlock();
|
||||
}
|
||||
@@ -501,6 +547,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
// ORIGINAL code commented out until we have time to add our own
|
||||
// statistics to the statistics window
|
||||
sb[8].StatID = (uint)Stats.FrameMS;
|
||||
<<<<<<< HEAD
|
||||
//sb[8].StatValue = m_frameMS / framesUpdated;
|
||||
sb[8].StatValue = (float) totalSumFrameTime / m_numberFramesStored;
|
||||
|
||||
@@ -511,13 +558,26 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
sb[10].StatID = (uint)Stats.PhysicsMS;
|
||||
//sb[10].StatValue = m_physicsMS / framesUpdated;
|
||||
sb[10].StatValue = (float) physicsSumFrameTime / m_numberFramesStored;
|
||||
=======
|
||||
sb[8].StatValue = TotalFrameTime;
|
||||
|
||||
sb[9].StatID = (uint)Stats.NetMS;
|
||||
sb[9].StatValue = m_netMS * perframe;
|
||||
|
||||
sb[10].StatID = (uint)Stats.PhysicsMS;
|
||||
sb[10].StatValue = m_physicsMS * perframe;
|
||||
>>>>>>> avn/ubitvar
|
||||
|
||||
sb[11].StatID = (uint)Stats.ImageMS ;
|
||||
sb[11].StatValue = m_imageMS / framesUpdated;
|
||||
sb[11].StatValue = m_imageMS * perframe;
|
||||
|
||||
sb[12].StatID = (uint)Stats.OtherMS;
|
||||
<<<<<<< HEAD
|
||||
//sb[12].StatValue = m_otherMS / framesUpdated;
|
||||
sb[12].StatValue = (float) simulationSumFrameTime / m_numberFramesStored;
|
||||
=======
|
||||
sb[12].StatValue = m_otherMS * perframe;
|
||||
>>>>>>> avn/ubitvar
|
||||
|
||||
sb[13].StatID = (uint)Stats.InPacketsPerSecond;
|
||||
sb[13].StatValue = (m_inPacketsPerSecond / m_statsUpdateFactor);
|
||||
@@ -529,7 +589,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
sb[15].StatValue = m_unAckedBytes;
|
||||
|
||||
sb[16].StatID = (uint)Stats.AgentMS;
|
||||
sb[16].StatValue = m_agentMS / framesUpdated;
|
||||
sb[16].StatValue = m_agentMS * perframe;
|
||||
|
||||
sb[17].StatID = (uint)Stats.PendingDownloads;
|
||||
sb[17].StatValue = m_pendingDownloads;
|
||||
@@ -544,7 +604,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
sb[20].StatValue = m_scriptLinesPerSecond / m_statsUpdateFactor;
|
||||
|
||||
sb[21].StatID = (uint)Stats.SimSpareMs;
|
||||
sb[21].StatValue = m_spareMS / framesUpdated;
|
||||
sb[21].StatValue = sparetime;
|
||||
|
||||
sb[22].StatID = (uint)Stats.SimSleepMs;
|
||||
sb[22].StatValue = sleeptime;
|
||||
|
||||
// Current ratio between the sum of physics and sim rate, and the
|
||||
// minimum time to run a scene's frame
|
||||
@@ -587,28 +650,32 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
}
|
||||
|
||||
// Extra statistics that aren't currently sent to clients
|
||||
lock (m_lastReportedExtraSimStats)
|
||||
if (m_scene.PhysicsScene != null)
|
||||
{
|
||||
m_lastReportedExtraSimStats[LastReportedObjectUpdateStatName] = m_objectUpdates / m_statsUpdateFactor;
|
||||
m_lastReportedExtraSimStats[SlowFramesStat.ShortName] = (float)SlowFramesStat.Value;
|
||||
|
||||
Dictionary<string, float> physicsStats = m_scene.PhysicsScene.GetStats();
|
||||
|
||||
if (physicsStats != null)
|
||||
lock (m_lastReportedExtraSimStats)
|
||||
{
|
||||
foreach (KeyValuePair<string, float> tuple in physicsStats)
|
||||
m_lastReportedExtraSimStats[LastReportedObjectUpdateStatName] = m_objectUpdates / m_statsUpdateFactor;
|
||||
m_lastReportedExtraSimStats[SlowFramesStat.ShortName] = (float)SlowFramesStat.Value;
|
||||
|
||||
Dictionary<string, float> physicsStats = m_scene.PhysicsScene.GetStats();
|
||||
|
||||
if (physicsStats != null)
|
||||
{
|
||||
// FIXME: An extremely dirty hack to divide MS stats per frame rather than per second
|
||||
// Need to change things so that stats source can indicate whether they are per second or
|
||||
// per frame.
|
||||
if (tuple.Key.EndsWith("MS"))
|
||||
m_lastReportedExtraSimStats[tuple.Key] = tuple.Value / framesUpdated;
|
||||
else
|
||||
m_lastReportedExtraSimStats[tuple.Key] = tuple.Value / m_statsUpdateFactor;
|
||||
foreach (KeyValuePair<string, float> tuple in physicsStats)
|
||||
{
|
||||
// FIXME: An extremely dirty hack to divide MS stats per frame rather than per second
|
||||
// Need to change things so that stats source can indicate whether they are per second or
|
||||
// per frame.
|
||||
if (tuple.Key.EndsWith("MS"))
|
||||
m_lastReportedExtraSimStats[tuple.Key] = tuple.Value * perframe;
|
||||
else
|
||||
m_lastReportedExtraSimStats[tuple.Key] = tuple.Value / m_statsUpdateFactor;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// LastReportedObjectUpdates = m_objectUpdates / m_statsUpdateFactor;
|
||||
ResetValues();
|
||||
}
|
||||
}
|
||||
@@ -635,8 +702,16 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
m_physicsMS = 0;
|
||||
m_imageMS = 0;
|
||||
m_otherMS = 0;
|
||||
<<<<<<< HEAD
|
||||
m_scriptMS = 0;
|
||||
m_spareMS = 0;
|
||||
=======
|
||||
// m_spareMS = 0;
|
||||
m_sleeptimeMS = 0;
|
||||
|
||||
//Ckrinke This variable is not used, so comment to remove compiler warning until it is used.
|
||||
//Ckrinke m_scriptMS = 0;
|
||||
>>>>>>> avn/ubitvar
|
||||
}
|
||||
|
||||
# region methods called from Scene
|
||||
@@ -717,11 +792,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
SlowFramesStat.Value++;
|
||||
}
|
||||
|
||||
public void AddSpareMS(int ms)
|
||||
{
|
||||
m_spareMS += ms;
|
||||
}
|
||||
|
||||
public void addNetMS(int ms)
|
||||
{
|
||||
m_netMS += ms;
|
||||
@@ -747,6 +817,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
m_otherMS += ms;
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
public void AddScriptMS(int ms)
|
||||
{
|
||||
m_scriptMS += ms;
|
||||
@@ -776,6 +847,11 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
// 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 addSleepMS(int ms)
|
||||
{
|
||||
m_sleeptimeMS += ms;
|
||||
>>>>>>> avn/ubitvar
|
||||
}
|
||||
|
||||
public void AddPendingDownloads(int count)
|
||||
|
||||
Reference in New Issue
Block a user