本文整理汇总了C#中OpenSim.Framework.SimStats类的典型用法代码示例。如果您正苦于以下问题:C# SimStats类的具体用法?C# SimStats怎么用?C# SimStats使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SimStats类属于OpenSim.Framework命名空间,在下文中一共展示了SimStats类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SendSimStats
public void SendSimStats(SimStats stats)
{
}
示例2: ReceiveClassicSimStatsPacket
private void ReceiveClassicSimStatsPacket(SimStats stats)
{
if (!enabled)
return;
try
{
// Ignore the update if there's a report running right now
// ignore the update if there hasn't been a hit in 30 seconds.
if (concurrencyCounter > 0 || System.Environment.TickCount - lastHit > 30000)
return;
// We will conduct this under lock so that fields such as updateLogCounter do not potentially get
// confused if a scene is removed.
// XXX: Possibly the scope of this lock could be reduced though it's not critical.
lock (m_scenes)
{
if (updateLogMod != 0 && updateLogCounter++ % updateLogMod == 0)
{
m_loglines = readLogLines(10);
if (updateLogCounter > 10000)
updateLogCounter = 1;
}
USimStatsData ss = m_simstatsCounters[stats.RegionUUID];
if ((++ss.StatsCounter % updateStatsMod) == 0)
{
ss.ConsumeSimStats(stats);
}
}
}
catch (KeyNotFoundException)
{
}
}
示例3: ConsumeSimStats
public void ConsumeSimStats(SimStats stats)
{
m_regionID = stats.RegionUUID;
m_timeDilation = stats.StatsBlock[0].StatValue;
m_simFps = stats.StatsBlock[1].StatValue;
m_physicsFps = stats.StatsBlock[2].StatValue;
m_agentUpdates = stats.StatsBlock[3].StatValue;
m_rootAgents = stats.StatsBlock[4].StatValue;
m_childAgents = stats.StatsBlock[5].StatValue;
m_totalPrims = stats.StatsBlock[6].StatValue;
m_activePrims = stats.StatsBlock[7].StatValue;
m_totalFrameTime = stats.StatsBlock[8].StatValue;
m_netFrameTime = stats.StatsBlock[9].StatValue;
m_physicsFrameTime = stats.StatsBlock[10].StatValue;
m_otherFrameTime = stats.StatsBlock[11].StatValue;
m_imageFrameTime = stats.StatsBlock[12].StatValue;
m_inPacketsPerSecond = stats.StatsBlock[13].StatValue;
m_outPacketsPerSecond = stats.StatsBlock[14].StatValue;
m_unackedBytes = stats.StatsBlock[15].StatValue;
m_agentFrameTime = stats.StatsBlock[16].StatValue;
m_pendingDownloads = stats.StatsBlock[17].StatValue;
m_pendingUploads = stats.StatsBlock[18].StatValue;
m_activeScripts = stats.StatsBlock[19].StatValue;
m_scriptLinesPerSecond = stats.StatsBlock[20].StatValue;
}
示例4: SendSimStatsPackets
private void SendSimStatsPackets(SimStats stats)
{
List<ScenePresence> StatSendAgents = GetScenePresences();
foreach (ScenePresence agent in StatSendAgents)
{
if (!agent.IsChildAgent)
{
agent.ControllingClient.SendSimStats(stats);
}
}
}
示例5: statsHeartBeat
private void statsHeartBeat(object sender, EventArgs e)
{
SimStatsPacket.StatBlock[] sb = new SimStatsPacket.StatBlock[33];
SimStatsPacket.RegionBlock rb = new SimStatsPacket.RegionBlock();
// Know what's not thread safe in Mono... modifying timers.
// m_log.Debug("Firing Stats Heart Beat");
lock (m_report)
{
uint regionFlags = 0;
try
{
if (estateModule == null)
estateModule = m_scene.RequestModuleInterface<IEstateModule>();
regionFlags = estateModule != null ? estateModule.GetRegionFlags() : (uint) 0;
}
catch (Exception)
{
// leave region flags at 0
}
#region various statistic googly moogly
// Our FPS is actually 10fps, so multiplying by 5 to get the amount that people expect there
// 0-50 is pretty close to 0-45
float simfps = (int) ((m_fps * 5));
// save the reported value so there is something available for llGetRegionFPS
lastReportedSimFPS = (float)simfps / statsUpdateFactor;
//if (simfps > 45)
//simfps = simfps - (simfps - 45);
//if (simfps < 0)
//simfps = 0;
//
float physfps = ((m_pfps / 1000));
//if (physfps > 600)
//physfps = physfps - (physfps - 600);
if (physfps < 0)
physfps = 0;
#endregion
//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.
for (int i = 0; i<33;i++)
{
sb[i] = new SimStatsPacket.StatBlock();
}
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[1].StatID = (uint) Stats.SimFPS;
sb[1].StatValue = simfps/statsUpdateFactor;
sb[2].StatID = (uint) Stats.PhysicsFPS;
sb[2].StatValue = physfps / statsUpdateFactor;
sb[3].StatID = (uint) Stats.AgentUpdates;
sb[3].StatValue = (m_agentUpdates / statsUpdateFactor);
sb[4].StatID = (uint) Stats.Agents;
sb[4].StatValue = m_rootAgents;
sb[5].StatID = (uint) Stats.ChildAgents;
sb[5].StatValue = m_childAgents;
sb[6].StatID = (uint) Stats.TotalPrim;
sb[6].StatValue = m_numPrim;
sb[7].StatID = (uint) Stats.ActivePrim;
sb[7].StatValue = m_activePrim;
sb[8].StatID = (uint)Stats.FrameMS;
sb[8].StatValue = m_frameMS / statsUpdateFactor;
sb[9].StatID = (uint)Stats.NetMS;
sb[9].StatValue = m_netMS / statsUpdateFactor;
sb[10].StatID = (uint)Stats.PhysicsMS;
sb[10].StatValue = m_physicsMS / statsUpdateFactor;
sb[11].StatID = (uint)Stats.ImageMS ;
sb[11].StatValue = m_imageMS / statsUpdateFactor;
sb[12].StatID = (uint)Stats.OtherMS;
sb[12].StatValue = m_otherMS / statsUpdateFactor;
//.........这里部分代码省略.........
示例6: statsHeartBeat
private void statsHeartBeat(object sender, EventArgs e)
{
SimStatsPacket.StatBlock[] sb = new SimStatsPacket.StatBlock[23];
SimStatsPacket.RegionBlock rb = new SimStatsPacket.RegionBlock();
float factorByframe;
float factor;
// Know what's not thread safe in Mono... modifying timers.
// m_log.Debug("Firing Stats Heart Beat");
lock (m_report)
{
uint regionFlags = 0;
try
{
if (estateModule == null)
estateModule = m_scene.RequestModuleInterface<IEstateModule>();
regionFlags = estateModule != null ? estateModule.GetRegionFlags() : (uint) 0;
}
catch (Exception)
{
// leave region flags at 0
}
#region various statistic googly moogly
// Our FPS is actually 10fps, so multiplying by 5 to get the amount that people expect there
// 0-50 is pretty close to 0-45
// show real
float simfps = (int) ((m_fps));
if (simfps == 0.0)
simfps = 10; // we still don't have stats on this
// factor to convert things to per second
factor = 1 / statsUpdateFactor;
// factor to convert things for time per frame need because how acumulators work
// factorByframe = factor / simfps;
factorByframe = 1 / simfps;
// save the reported value so there is something available for llGetRegionFPS
lastReportedSimFPS = simfps * factor;
float physfps = ((m_pfps));
if (physfps < 0)
physfps = 0;
#endregion
for (int i = 0; i < 23; i++)
{
sb[i] = new SimStatsPacket.StatBlock();
}
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[1].StatID = (uint) Stats.SimFPS;
sb[1].StatValue = simfps * factor;
sb[2].StatID = (uint) Stats.PhysicsFPS;
sb[2].StatValue = physfps * factor;
sb[3].StatID = (uint) Stats.AgentUpdates;
sb[3].StatValue = (m_agentUpdates * factor);
sb[4].StatID = (uint) Stats.Agents;
sb[4].StatValue = m_rootAgents;
sb[5].StatID = (uint) Stats.ChildAgents;
sb[5].StatValue = m_childAgents;
sb[6].StatID = (uint) Stats.TotalPrim;
sb[6].StatValue = m_numPrim;
sb[7].StatID = (uint) Stats.ActivePrim;
sb[7].StatValue = m_activePrim;
sb[8].StatID = (uint)Stats.FrameMS;
// sb[8].StatValue = m_frameMS * factorByframe;
float simFrameTime = 1000.0f / (simfps * factor);
sb[8].StatValue = simFrameTime;
sb[9].StatID = (uint)Stats.NetMS;
sb[9].StatValue = m_netMS * factorByframe;
sb[10].StatID = (uint)Stats.PhysicsMS;
sb[10].StatValue = m_physicsMS * factorByframe;
sb[11].StatID = (uint)Stats.ImageMS ;
sb[11].StatValue = m_imageMS * factorByframe;
sb[12].StatID = (uint)Stats.OtherMS;
float othertmp = m_frameMS - m_physicsMS - m_imageMS - m_netMS - m_agentMS;
if (othertmp < 0)
othertmp = 0;
sb[12].StatValue = othertmp * factorByframe;
//.........这里部分代码省略.........
示例7: statsHeartBeat
private void statsHeartBeat(object sender, EventArgs e)
{
SimStatsPacket.StatBlock[] sb = new SimStatsPacket.StatBlock[21];
SimStatsPacket.RegionBlock rb = new SimStatsPacket.RegionBlock();
// Know what's not thread safe in Mono... modifying timers.
// m_log.Debug("Firing Stats Heart Beat");
lock (m_report)
{
uint regionFlags = 0;
try
{
if (estateModule == null)
estateModule = m_scene.RequestModuleInterface<IEstateModule>();
regionFlags = estateModule != null ? estateModule.GetRegionFlags() : (uint) 0;
}
catch (Exception)
{
// leave region flags at 0
}
#region various statistic googly moogly
// 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.
int reportedFPS = (int)(m_fps * m_reportedFpsCorrectionFactor);
// save the reported value so there is something available for llGetRegionFPS
lastReportedSimFPS = reportedFPS / statsUpdateFactor;
float physfps = ((m_pfps / 1000));
//if (physfps > 600)
//physfps = physfps - (physfps - 600);
if (physfps < 0)
physfps = 0;
#endregion
//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.
for (int i = 0; i < 21; i++)
{
sb[i] = new SimStatsPacket.StatBlock();
}
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[1].StatID = (uint) Stats.SimFPS;
sb[1].StatValue = reportedFPS / statsUpdateFactor;
sb[2].StatID = (uint) Stats.PhysicsFPS;
sb[2].StatValue = physfps / statsUpdateFactor;
sb[3].StatID = (uint) Stats.AgentUpdates;
sb[3].StatValue = (m_agentUpdates / statsUpdateFactor);
sb[4].StatID = (uint) Stats.Agents;
sb[4].StatValue = m_rootAgents;
sb[5].StatID = (uint) Stats.ChildAgents;
sb[5].StatValue = m_childAgents;
sb[6].StatID = (uint) Stats.TotalPrim;
sb[6].StatValue = m_numPrim;
sb[7].StatID = (uint) Stats.ActivePrim;
sb[7].StatValue = m_activePrim;
sb[8].StatID = (uint)Stats.FrameMS;
sb[8].StatValue = m_frameMS / statsUpdateFactor;
sb[9].StatID = (uint)Stats.NetMS;
sb[9].StatValue = m_netMS / statsUpdateFactor;
sb[10].StatID = (uint)Stats.PhysicsMS;
sb[10].StatValue = m_physicsMS / statsUpdateFactor;
sb[11].StatID = (uint)Stats.ImageMS ;
sb[11].StatValue = m_imageMS / statsUpdateFactor;
sb[12].StatID = (uint)Stats.OtherMS;
sb[12].StatValue = m_otherMS / statsUpdateFactor;
sb[13].StatID = (uint)Stats.InPacketsPerSecond;
sb[13].StatValue = (m_inPacketsPerSecond / statsUpdateFactor);
sb[14].StatID = (uint)Stats.OutPacketsPerSecond;
sb[14].StatValue = (m_outPacketsPerSecond / statsUpdateFactor);
//.........这里部分代码省略.........
示例8: statsHeartBeat
private void statsHeartBeat(object sender, EventArgs e)
{
double totalSumFrameTime;
double simulationSumFrameTime;
double physicsSumFrameTime;
double networkSumFrameTime;
float frameDilation;
int currentFrame;
if (!m_scene.Active)
return;
// 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.RegionBlock rb = new SimStatsPacket.RegionBlock();
// Know what's not thread safe in Mono... modifying timers.
// m_log.Debug("Firing Stats Heart Beat");
lock (m_report)
{
uint regionFlags = 0;
try
{
if (estateModule == null)
estateModule = m_scene.RequestModuleInterface<IEstateModule>();
regionFlags = estateModule != null ? estateModule.GetRegionFlags() : (uint) 0;
}
catch (Exception)
{
// leave region flags at 0
}
#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
// 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 = m_fps;
// save the reported value so there is something available for llGetRegionFPS
lastReportedSimFPS = reportedFPS / m_statsUpdateFactor;
// 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)
//physfps = physfps - (physfps - 600);
if (physfps < 0)
physfps = 0;
#endregion
m_rootAgents = m_scene.SceneGraph.GetRootAgentCount();
m_childAgents = m_scene.SceneGraph.GetChildAgentCount();
m_numPrim = m_scene.SceneGraph.GetTotalObjectsCount();
m_numGeoPrim = m_scene.SceneGraph.GetTotalPrimObjectsCount();
m_numMesh = m_scene.SceneGraph.GetTotalMeshObjectsCount();
m_activePrim = m_scene.SceneGraph.GetActiveObjectsCount();
m_activeScripts = m_scene.SceneGraph.GetActiveScriptsCount();
// FIXME: Checking for stat sanity is a complex approach. What we really need to do is fix the code
// 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.
uint thisFrame = m_scene.Frame;
uint numFrames = thisFrame - m_lastUpdateFrame;
float framesUpdated = (float)numFrames * m_reportedFpsCorrectionFactor;
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 < m_statisticArraySize; i++)
{
sb[i] = new SimStatsPacket.StatBlock();
}
// Resetting the sums of the frame times to prevent any errors
// in calculating the moving average for frame time
//.........这里部分代码省略.........
示例9: statsHeartBeat
private void statsHeartBeat(object sender, EventArgs e)
{
if (statsRunning) return;
try
{
statsRunning = true;
SimStatsPacket.StatBlock[] sb = new SimStatsPacket.StatBlock[21];
SimStatsPacket.RegionBlock rb = new SimStatsPacket.RegionBlock();
uint regionFlags = 0;
try
{
if (estateModule == null)
estateModule = m_scene.RequestModuleInterface<IEstateModule>();
regionFlags = estateModule != null ? estateModule.GetRegionFlags() : (uint)0;
}
catch (Exception)
{
// leave region flags at 0
}
float simfps = (int)m_fps;
// save the reported value so there is something available for llGetRegionFPS
lastReportedSimFPS = (float)simfps / statsUpdateFactor;
float physfps = m_pfps;
if (physfps < 0)
physfps = 0;
//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.
for (int i = 0; i < 21; i++)
{
sb[i] = new SimStatsPacket.StatBlock();
}
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[1].StatID = (uint)Stats.SimFPS;
sb[1].StatValue = simfps / statsUpdateFactor;
sb[2].StatID = (uint)Stats.PhysicsFPS;
sb[2].StatValue = physfps;
sb[3].StatID = (uint)Stats.AgentUpdates;
sb[3].StatValue = (m_agentUpdates / statsUpdateFactor);
sb[4].StatID = (uint)Stats.Agents;
sb[4].StatValue = m_rootAgents;
sb[5].StatID = (uint)Stats.ChildAgents;
sb[5].StatValue = m_childAgents;
sb[6].StatID = (uint)Stats.TotalPrim;
sb[6].StatValue = m_numPrim;
sb[7].StatID = (uint)Stats.ActivePrim;
sb[7].StatValue = m_activePrim;
sb[8].StatID = (uint)Stats.FrameMS;
sb[8].StatValue = m_frameMS / statsUpdateFactor;
sb[9].StatID = (uint)Stats.NetMS;
sb[9].StatValue = m_netMS / statsUpdateFactor;
sb[10].StatID = (uint)Stats.PhysicsMS;
sb[10].StatValue = m_physicsMS / statsUpdateFactor;
sb[11].StatID = (uint)Stats.ImageMS;
sb[11].StatValue = m_imageMS / statsUpdateFactor;
sb[12].StatID = (uint)Stats.OtherMS;
sb[12].StatValue = m_otherMS / statsUpdateFactor;
sb[13].StatID = (uint)Stats.InPacketsPerSecond;
sb[13].StatValue = (m_inPacketsPerSecond);
sb[14].StatID = (uint)Stats.OutPacketsPerSecond;
sb[14].StatValue = (m_outPacketsPerSecond / statsUpdateFactor);
sb[15].StatID = (uint)Stats.UnAckedBytes;
sb[15].StatValue = m_unAckedBytes;
sb[16].StatID = (uint)Stats.AgentMS;
sb[16].StatValue = m_agentMS / statsUpdateFactor;
sb[17].StatID = (uint)Stats.PendingDownloads;
sb[17].StatValue = m_pendingDownloads;
sb[18].StatID = (uint)Stats.PendingUploads;
//.........这里部分代码省略.........
示例10: statsHeartBeat
/// <summary>
/// This is called by a timer and makes a SimStats class of the current stats that we have in this simulator.
/// It then sends the packet to the client and triggers the events to tell followers about the updated stats
/// and updates the LastSet* values for monitors.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void statsHeartBeat(object sender, EventArgs e)
{
SimStatsPacket.RegionBlock rb = new SimStatsPacket.RegionBlock();
// Know what's not thread safe in Mono... modifying timers.
lock (m_report)
{
uint regionFlags = 0;
try
{
if (m_estateModule == null)
m_estateModule = m_currentScene.RequestModuleInterface<IEstateModule>();
regionFlags = m_estateModule != null ? m_estateModule.GetRegionFlags() : (uint)0;
}
catch (Exception)
{
// leave region flags at 0
}
rb.ObjectCapacity = (uint)m_currentScene.RegionInfo.ObjectCapacity;
rb.RegionFlags = regionFlags;
rb.RegionX = (uint)m_currentScene.RegionInfo.RegionLocX / Constants.RegionSize;
rb.RegionY = (uint)m_currentScene.RegionInfo.RegionLocY / Constants.RegionSize;
ISimFrameMonitor simFrameMonitor = (ISimFrameMonitor)GetMonitor("SimFrameStats");
ITimeDilationMonitor timeDilationMonitor = (ITimeDilationMonitor)GetMonitor("Time Dilation");
ITotalFrameTimeMonitor totalFrameMonitor = (ITotalFrameTimeMonitor)GetMonitor("Total Frame Time");
ITimeMonitor sleepFrameMonitor = (ITimeMonitor)GetMonitor("Sleep Frame Time");
ITimeMonitor otherFrameMonitor = (ITimeMonitor)GetMonitor("Other Frame Time");
IPhysicsFrameMonitor physicsFrameMonitor = (IPhysicsFrameMonitor)GetMonitor("Total Physics Frame Time");
ITimeMonitor physicsSyncFrameMonitor = (ITimeMonitor)GetMonitor("Physics Sync Frame Time");
ITimeMonitor physicsTimeFrameMonitor = (ITimeMonitor)GetMonitor("Physics Update Frame Time");
IAgentUpdateMonitor agentUpdateFrameMonitor = (IAgentUpdateMonitor)GetMonitor("Agent Update Count");
INetworkMonitor networkMonitor = (INetworkMonitor)GetMonitor("Network Monitor");
IMonitor imagesMonitor = GetMonitor("Images Frame Time");
ITimeMonitor scriptMonitor = (ITimeMonitor)GetMonitor("Script Frame Time");
IScriptCountMonitor totalScriptMonitor = (IScriptCountMonitor)GetMonitor("Total Script Count");
#region various statistic googly moogly
float simfps = simFrameMonitor.SimFPS / statsUpdateFactor;
// save the reported value so there is something available for llGetRegionFPS
simFrameMonitor.LastReportedSimFPS = simfps;
float physfps = (float)physicsFrameMonitor.PhysicsFPS / statsUpdateFactor;
physicsFrameMonitor.LastReportedPhysicsFPS = physfps;
//Update the time dilation with the newest physicsFPS
timeDilationMonitor.SetPhysicsFPS(physfps);
#endregion
#region Add the stats packets
//Some info on this packet http://wiki.secondlife.com/wiki/Statistics_Bar_Guide
sb[0].StatID = (uint)Stats.TimeDilation;
sb[0].StatValue = (float)timeDilationMonitor.GetValue();
sb[1].StatID = (uint)Stats.FPS;
sb[1].StatValue = simfps;
float realsimfps = simfps * 2;
sb[2].StatID = (uint)Stats.PhysFPS;
sb[2].StatValue = physfps;
sb[3].StatID = (uint)Stats.AgentUpdates;
sb[3].StatValue = (agentUpdateFrameMonitor.AgentUpdates / realsimfps);
sb[4].StatID = (uint)Stats.FrameMS;
float TotalFrames = (float)(totalFrameMonitor.GetValue() / realsimfps);
sb[4].StatValue = TotalFrames;
sb[5].StatID = (uint)Stats.NetMS;
sb[5].StatValue = 0;//TODO: Implement this
sb[6].StatID = (uint)Stats.SimOtherMS;
sb[6].StatValue = (float)(otherFrameMonitor.GetValue() / realsimfps);
sb[7].StatID = (uint)Stats.SimPhysicsMS;
float PhysicsMS = (float)(physicsTimeFrameMonitor.GetValue() / realsimfps);
sb[7].StatValue = PhysicsMS;
sb[8].StatID = (uint)Stats.AgentMS;
sb[8].StatValue = (agentUpdateFrameMonitor.AgentFrameTime / realsimfps);
sb[9].StatID = (uint)Stats.ImagesMS;
sb[9].StatValue = (float)(imagesMonitor.GetValue() / realsimfps);
sb[10].StatID = (uint)Stats.ScriptMS;
float ScriptMS = (float)(scriptMonitor.GetValue() / realsimfps);
sb[10].StatValue = ScriptMS;
//.........这里部分代码省略.........
示例11: SendSimStatsPackets
/// <summary>
/// Send out simstats data to all clients
/// </summary>
/// <param name="stats">Stats on the Simulator's performance</param>
private void SendSimStatsPackets(SimStats stats)
{
ForEachScenePresence(
delegate(ScenePresence agent)
{
if (!agent.IsChildAgent)
agent.ControllingClient.SendSimStats(stats);
}
);
}
示例12: SendStatsResults
public void SendStatsResults(SimStats simStats)
{
SendStatResult handlerSendStatResult = OnSendStatsResult;
if (handlerSendStatResult != null)
{
handlerSendStatResult(simStats);
}
}
示例13: statsHeartBeat
private void statsHeartBeat(object sender, EventArgs e)
{
SimStatsPacket.StatBlock[] sb = new SimStatsPacket.StatBlock[22];
SimStatsPacket.RegionBlock rb = new SimStatsPacket.RegionBlock();
// Know what's not thread safe in Mono... modifying timers.
// m_log.Debug("Firing Stats Heart Beat");
lock (m_report)
{
uint regionFlags = 0;
try
{
if (estateModule == null)
estateModule = m_scene.RequestModuleInterface<IEstateModule>();
regionFlags = estateModule != null ? estateModule.GetRegionFlags() : (uint) 0;
}
catch (Exception)
{
// leave region flags at 0
}
#region various statistic googly moogly
// 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.
int reportedFPS = (int)(m_fps * m_reportedFpsCorrectionFactor);
// save the reported value so there is something available for llGetRegionFPS
lastReportedSimFPS = reportedFPS / m_statsUpdateFactor;
float physfps = ((m_pfps / 1000));
//if (physfps > 600)
//physfps = physfps - (physfps - 600);
if (physfps < 0)
physfps = 0;
#endregion
m_rootAgents = m_scene.SceneGraph.GetRootAgentCount();
m_childAgents = m_scene.SceneGraph.GetChildAgentCount();
m_numPrim = m_scene.SceneGraph.GetTotalObjectsCount();
m_activePrim = m_scene.SceneGraph.GetActiveObjectsCount();
m_activeScripts = m_scene.SceneGraph.GetActiveScriptsCount();
// FIXME: Checking for stat sanity is a complex approach. What we really need to do is fix the code
// 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.
uint thisFrame = m_scene.Frame;
float framesUpdated = (float)(thisFrame - m_lastUpdateFrame) * m_reportedFpsCorrectionFactor;
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 < 22; i++)
{
sb[i] = new SimStatsPacket.StatBlock();
}
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[1].StatID = (uint) Stats.SimFPS;
sb[1].StatValue = reportedFPS / m_statsUpdateFactor;
sb[2].StatID = (uint) Stats.PhysicsFPS;
sb[2].StatValue = physfps / m_statsUpdateFactor;
sb[3].StatID = (uint) Stats.AgentUpdates;
sb[3].StatValue = (m_agentUpdates / m_statsUpdateFactor);
sb[4].StatID = (uint) Stats.Agents;
sb[4].StatValue = m_rootAgents;
sb[5].StatID = (uint) Stats.ChildAgents;
sb[5].StatValue = m_childAgents;
sb[6].StatID = (uint) Stats.TotalPrim;
sb[6].StatValue = m_numPrim;
sb[7].StatID = (uint) Stats.ActivePrim;
sb[7].StatValue = m_activePrim;
sb[8].StatID = (uint)Stats.FrameMS;
sb[8].StatValue = m_frameMS / framesUpdated;
//.........这里部分代码省略.........
示例14: ReceiveClassicSimStatsPacket
private void ReceiveClassicSimStatsPacket(SimStats stats)
{
if (!enabled)
{
return;
}
try
{
// Ignore the update if there's a report running right now
// ignore the update if there hasn't been a hit in 30 seconds.
if (concurrencyCounter > 0 || System.Environment.TickCount - lastHit > 30000)
return;
if ((updateLogCounter++ % updateLogMod) == 0)
{
m_loglines = readLogLines(10);
if (updateLogCounter > 10000) updateLogCounter = 1;
}
USimStatsData ss = m_simstatsCounters[stats.RegionUUID];
if ((++ss.StatsCounter % updateStatsMod) == 0)
{
ss.ConsumeSimStats(stats);
}
}
catch (KeyNotFoundException)
{
}
}
示例15: SendSimStatsPackets
/// <summary>
/// Send out simstats data to all clients
/// </summary>
/// <param name="stats">Stats on the Simulator's performance</param>
private void SendSimStatsPackets(SimStats stats)
{
ForEachRootClient(delegate(IClientAPI client)
{
client.SendSimStats(stats);
});
}