Properly show per frame millisecond statistics per frame, not as amount of time taken per second.
This is to make these statistics actually match their names (and also be more accurate as number of frames can vary under heavy load) Currently using scene frames (11.23 every second) instead of physics frames (56.18 per second)0.7.3-extended
parent
3e75083d2d
commit
61e7d4a0e2
|
@ -117,11 +117,16 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
private Dictionary<string, float> m_lastReportedExtraSimStats = new Dictionary<string, float>();
|
private Dictionary<string, float> m_lastReportedExtraSimStats = new Dictionary<string, float>();
|
||||||
|
|
||||||
// Sending a stats update every 3 seconds-
|
// Sending a stats update every 3 seconds-
|
||||||
private int statsUpdatesEveryMS = 3000;
|
private int m_statsUpdatesEveryMS = 3000;
|
||||||
private float statsUpdateFactor = 0;
|
private float m_statsUpdateFactor = 0;
|
||||||
private float m_timeDilation = 0;
|
private float m_timeDilation = 0;
|
||||||
private int m_fps = 0;
|
private int m_fps = 0;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Number of the last frame on which we processed a stats udpate.
|
||||||
|
/// </summary>
|
||||||
|
private uint m_lastUpdateFrame;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Our nominal fps target, as expected in fps stats when a sim is running normally.
|
/// Our nominal fps target, as expected in fps stats when a sim is running normally.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -188,12 +193,12 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
m_scene = scene;
|
m_scene = scene;
|
||||||
m_reportedFpsCorrectionFactor = scene.MinFrameTime * m_nominalReportedFps;
|
m_reportedFpsCorrectionFactor = scene.MinFrameTime * m_nominalReportedFps;
|
||||||
statsUpdateFactor = (float)(statsUpdatesEveryMS / 1000);
|
m_statsUpdateFactor = (float)(m_statsUpdatesEveryMS / 1000);
|
||||||
ReportingRegion = scene.RegionInfo;
|
ReportingRegion = scene.RegionInfo;
|
||||||
|
|
||||||
m_objectCapacity = scene.RegionInfo.ObjectCapacity;
|
m_objectCapacity = scene.RegionInfo.ObjectCapacity;
|
||||||
m_report.AutoReset = true;
|
m_report.AutoReset = true;
|
||||||
m_report.Interval = statsUpdatesEveryMS;
|
m_report.Interval = m_statsUpdatesEveryMS;
|
||||||
m_report.Elapsed += statsHeartBeat;
|
m_report.Elapsed += statsHeartBeat;
|
||||||
m_report.Enabled = true;
|
m_report.Enabled = true;
|
||||||
|
|
||||||
|
@ -213,9 +218,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// <param name='ms'></param>
|
/// <param name='ms'></param>
|
||||||
public void SetUpdateMS(int ms)
|
public void SetUpdateMS(int ms)
|
||||||
{
|
{
|
||||||
statsUpdatesEveryMS = ms;
|
m_statsUpdatesEveryMS = ms;
|
||||||
statsUpdateFactor = (float)(statsUpdatesEveryMS / 1000);
|
m_statsUpdateFactor = (float)(m_statsUpdatesEveryMS / 1000);
|
||||||
m_report.Interval = statsUpdatesEveryMS;
|
m_report.Interval = m_statsUpdatesEveryMS;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void statsHeartBeat(object sender, EventArgs e)
|
private void statsHeartBeat(object sender, EventArgs e)
|
||||||
|
@ -247,7 +252,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
int reportedFPS = (int)(m_fps * m_reportedFpsCorrectionFactor);
|
int reportedFPS = (int)(m_fps * m_reportedFpsCorrectionFactor);
|
||||||
|
|
||||||
// save the reported value so there is something available for llGetRegionFPS
|
// save the reported value so there is something available for llGetRegionFPS
|
||||||
lastReportedSimFPS = reportedFPS / statsUpdateFactor;
|
lastReportedSimFPS = reportedFPS / m_statsUpdateFactor;
|
||||||
|
|
||||||
float physfps = ((m_pfps / 1000));
|
float physfps = ((m_pfps / 1000));
|
||||||
|
|
||||||
|
@ -279,6 +284,14 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// 'statsUpdateFactor' is how often stats packets are sent in seconds. Used below to change
|
// 'statsUpdateFactor' is how often stats packets are sent in seconds. Used below to change
|
||||||
// values to X-per-second values.
|
// values to X-per-second values.
|
||||||
|
|
||||||
|
uint thisFrame = m_scene.Frame;
|
||||||
|
float framesUpdated = (float)(thisFrame - m_lastUpdateFrame);
|
||||||
|
m_lastUpdateFrame = thisFrame;
|
||||||
|
|
||||||
|
// Avoid div-by-zero if somehow we've not updated any frames.
|
||||||
|
if (framesUpdated == 0)
|
||||||
|
framesUpdated = 1;
|
||||||
|
|
||||||
for (int i = 0; i < 21; i++)
|
for (int i = 0; i < 21; i++)
|
||||||
{
|
{
|
||||||
sb[i] = new SimStatsPacket.StatBlock();
|
sb[i] = new SimStatsPacket.StatBlock();
|
||||||
|
@ -288,13 +301,13 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
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));
|
||||||
|
|
||||||
sb[1].StatID = (uint) Stats.SimFPS;
|
sb[1].StatID = (uint) Stats.SimFPS;
|
||||||
sb[1].StatValue = reportedFPS / statsUpdateFactor;
|
sb[1].StatValue = reportedFPS / m_statsUpdateFactor;
|
||||||
|
|
||||||
sb[2].StatID = (uint) Stats.PhysicsFPS;
|
sb[2].StatID = (uint) Stats.PhysicsFPS;
|
||||||
sb[2].StatValue = physfps / statsUpdateFactor;
|
sb[2].StatValue = physfps / m_statsUpdateFactor;
|
||||||
|
|
||||||
sb[3].StatID = (uint) Stats.AgentUpdates;
|
sb[3].StatID = (uint) Stats.AgentUpdates;
|
||||||
sb[3].StatValue = (m_agentUpdates / statsUpdateFactor);
|
sb[3].StatValue = (m_agentUpdates / m_statsUpdateFactor);
|
||||||
|
|
||||||
sb[4].StatID = (uint) Stats.Agents;
|
sb[4].StatID = (uint) Stats.Agents;
|
||||||
sb[4].StatValue = m_rootAgents;
|
sb[4].StatValue = m_rootAgents;
|
||||||
|
@ -309,31 +322,31 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
sb[7].StatValue = m_activePrim;
|
sb[7].StatValue = m_activePrim;
|
||||||
|
|
||||||
sb[8].StatID = (uint)Stats.FrameMS;
|
sb[8].StatID = (uint)Stats.FrameMS;
|
||||||
sb[8].StatValue = m_frameMS / statsUpdateFactor;
|
sb[8].StatValue = m_frameMS / framesUpdated;
|
||||||
|
|
||||||
sb[9].StatID = (uint)Stats.NetMS;
|
sb[9].StatID = (uint)Stats.NetMS;
|
||||||
sb[9].StatValue = m_netMS / statsUpdateFactor;
|
sb[9].StatValue = m_netMS / framesUpdated;
|
||||||
|
|
||||||
sb[10].StatID = (uint)Stats.PhysicsMS;
|
sb[10].StatID = (uint)Stats.PhysicsMS;
|
||||||
sb[10].StatValue = m_physicsMS / statsUpdateFactor;
|
sb[10].StatValue = m_physicsMS / framesUpdated;
|
||||||
|
|
||||||
sb[11].StatID = (uint)Stats.ImageMS ;
|
sb[11].StatID = (uint)Stats.ImageMS ;
|
||||||
sb[11].StatValue = m_imageMS / statsUpdateFactor;
|
sb[11].StatValue = m_imageMS / framesUpdated;
|
||||||
|
|
||||||
sb[12].StatID = (uint)Stats.OtherMS;
|
sb[12].StatID = (uint)Stats.OtherMS;
|
||||||
sb[12].StatValue = m_otherMS / statsUpdateFactor;
|
sb[12].StatValue = m_otherMS / framesUpdated;
|
||||||
|
|
||||||
sb[13].StatID = (uint)Stats.InPacketsPerSecond;
|
sb[13].StatID = (uint)Stats.InPacketsPerSecond;
|
||||||
sb[13].StatValue = (m_inPacketsPerSecond / statsUpdateFactor);
|
sb[13].StatValue = (m_inPacketsPerSecond / m_statsUpdateFactor);
|
||||||
|
|
||||||
sb[14].StatID = (uint)Stats.OutPacketsPerSecond;
|
sb[14].StatID = (uint)Stats.OutPacketsPerSecond;
|
||||||
sb[14].StatValue = (m_outPacketsPerSecond / statsUpdateFactor);
|
sb[14].StatValue = (m_outPacketsPerSecond / m_statsUpdateFactor);
|
||||||
|
|
||||||
sb[15].StatID = (uint)Stats.UnAckedBytes;
|
sb[15].StatID = (uint)Stats.UnAckedBytes;
|
||||||
sb[15].StatValue = m_unAckedBytes;
|
sb[15].StatValue = m_unAckedBytes;
|
||||||
|
|
||||||
sb[16].StatID = (uint)Stats.AgentMS;
|
sb[16].StatID = (uint)Stats.AgentMS;
|
||||||
sb[16].StatValue = m_agentMS / statsUpdateFactor;
|
sb[16].StatValue = m_agentMS / framesUpdated;
|
||||||
|
|
||||||
sb[17].StatID = (uint)Stats.PendingDownloads;
|
sb[17].StatID = (uint)Stats.PendingDownloads;
|
||||||
sb[17].StatValue = m_pendingDownloads;
|
sb[17].StatValue = m_pendingDownloads;
|
||||||
|
@ -345,7 +358,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
sb[19].StatValue = m_activeScripts;
|
sb[19].StatValue = m_activeScripts;
|
||||||
|
|
||||||
sb[20].StatID = (uint)Stats.ScriptLinesPerSecond;
|
sb[20].StatID = (uint)Stats.ScriptLinesPerSecond;
|
||||||
sb[20].StatValue = m_scriptLinesPerSecond / statsUpdateFactor;
|
sb[20].StatValue = m_scriptLinesPerSecond / m_statsUpdateFactor;
|
||||||
|
|
||||||
for (int i = 0; i < 21; i++)
|
for (int i = 0; i < 21; i++)
|
||||||
{
|
{
|
||||||
|
@ -366,7 +379,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// Extra statistics that aren't currently sent to clients
|
// Extra statistics that aren't currently sent to clients
|
||||||
lock (m_lastReportedExtraSimStats)
|
lock (m_lastReportedExtraSimStats)
|
||||||
{
|
{
|
||||||
m_lastReportedExtraSimStats[LastReportedObjectUpdateStatName] = m_objectUpdates / statsUpdateFactor;
|
m_lastReportedExtraSimStats[LastReportedObjectUpdateStatName] = m_objectUpdates / m_statsUpdateFactor;
|
||||||
|
|
||||||
Dictionary<string, float> physicsStats = m_scene.PhysicsScene.GetStats();
|
Dictionary<string, float> physicsStats = m_scene.PhysicsScene.GetStats();
|
||||||
|
|
||||||
|
@ -374,7 +387,13 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
foreach (KeyValuePair<string, float> tuple in physicsStats)
|
foreach (KeyValuePair<string, float> tuple in physicsStats)
|
||||||
{
|
{
|
||||||
m_lastReportedExtraSimStats[tuple.Key] = tuple.Value / statsUpdateFactor;
|
// 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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue