Added osGetRegionStats() function, to return a number of sim statistics
parent
c6bfecccaa
commit
d39c300d11
|
@ -388,6 +388,11 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
get { return StatsReporter.getLastReportedSimFPS(); }
|
||||
}
|
||||
|
||||
public float[] SimulatorStats
|
||||
{
|
||||
get { return StatsReporter.getLastReportedSimStats(); }
|
||||
}
|
||||
|
||||
public string DefaultScriptEngine
|
||||
{
|
||||
get { return m_defaultScriptEngine; }
|
||||
|
|
|
@ -82,6 +82,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
private int m_fps = 0;
|
||||
// saved last reported value so there is something available for llGetRegionFPS
|
||||
private float lastReportedSimFPS = 0;
|
||||
private float[] lastReportedSimStats = new float[21];
|
||||
private float m_pfps = 0;
|
||||
private int m_agentUpdates = 0;
|
||||
|
||||
|
@ -260,6 +261,11 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
sb[20].StatID = (uint)Stats.ScriptLinesPerSecond;
|
||||
sb[20].StatValue = m_scriptLinesPerSecond / statsUpdateFactor;
|
||||
|
||||
for (int i = 0; i < 21; i++)
|
||||
{
|
||||
lastReportedSimStats[i] = sb[i].StatValue;
|
||||
}
|
||||
|
||||
SimStats simStats
|
||||
= new SimStats(
|
||||
ReportingRegion.RegionLocX, ReportingRegion.RegionLocY, regionFlags, (uint)objectCapacity, rb, sb, m_scene.RegionInfo.originRegionID);
|
||||
|
@ -439,6 +445,11 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
return lastReportedSimFPS;
|
||||
}
|
||||
|
||||
public float[] getLastReportedSimStats()
|
||||
{
|
||||
return lastReportedSimStats;
|
||||
}
|
||||
|
||||
public void AddPacketsStats(int inPackets, int outPackets, int unAckedBytes)
|
||||
{
|
||||
AddInPackets(inPackets);
|
||||
|
|
|
@ -5785,6 +5785,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
return World.SimulatorFPS;
|
||||
}
|
||||
|
||||
|
||||
/* particle system rules should be coming into this routine as doubles, that is
|
||||
rule[0] should be an integer from this list and rule[1] should be the arg
|
||||
for the same integer. wiki.secondlife.com has most of this mapping, but some
|
||||
|
|
|
@ -1948,5 +1948,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
|
||||
return key.ToString();
|
||||
}
|
||||
|
||||
public LSL_List osGetRegionStats()
|
||||
{
|
||||
CheckThreatLevel(ThreatLevel.High, "osGetRegionStats");
|
||||
m_host.AddScriptLPS(1);
|
||||
LSL_List ret = new LSL_List();
|
||||
float[] stats = World.SimulatorStats;
|
||||
|
||||
for (int i = 0; i < 21; i++)
|
||||
{
|
||||
ret.Add(new LSL_Float( stats[i] ));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -162,5 +162,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
|
|||
|
||||
key osGetMapTexture();
|
||||
key osGetRegionMapTexture(string regionName);
|
||||
LSL_List osGetRegionStats();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -516,5 +516,28 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
|||
public const string TEXTURE_TRANSPARENT = "8dcd4a48-2d37-4909-9f78-f7a9eb4ef903";
|
||||
public const string TEXTURE_MEDIA = "8b5fec65-8d8d-9dc5-cda8-8fdf2716e361";
|
||||
|
||||
// Constants for osGetRegionStats
|
||||
public const int STATS_TIME_DILATION = 0;
|
||||
public const int STATS_SIM_FPS = 1;
|
||||
public const int STATS_PHYSICS_FPS = 2;
|
||||
public const int STATS_AGENT_UPDATES = 3;
|
||||
public const int STATS_ROOT_AGENTS = 4;
|
||||
public const int STATS_CHILD_AGENTS = 5;
|
||||
public const int STATS_TOTAL_PRIMS = 6;
|
||||
public const int STATS_ACTIVE_PRIMS = 7;
|
||||
public const int STATS_FRAME_MS = 8;
|
||||
public const int STATS_NET_MS = 9;
|
||||
public const int STATS_PHYSICS_MS = 10;
|
||||
public const int STATS_IMAGE_MS = 11;
|
||||
public const int STATS_OTHER_MS = 12;
|
||||
public const int STATS_IN_PACKETS_PER_SECOND = 13;
|
||||
public const int STATS_OUT_PACKETS_PER_SECOND = 14;
|
||||
public const int STATS_UNACKED_BYTES = 15;
|
||||
public const int STATS_AGENT_MS = 16;
|
||||
public const int STATS_PENDING_DOWNLOADS = 17;
|
||||
public const int STATS_PENDING_UPLOADS = 18;
|
||||
public const int STATS_ACTIVE_SCRIPTS = 19;
|
||||
public const int STATS_SCRIPT_LPS = 20;
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -632,5 +632,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
|||
{
|
||||
return m_OSSL_Functions.osGetRegionMapTexture(regionName);
|
||||
}
|
||||
|
||||
public LSL_List osGetRegionStats()
|
||||
{
|
||||
return m_OSSL_Functions.osGetRegionStats();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue