From d39c300d11109553b75ca761d26dda278c0ad7dd Mon Sep 17 00:00:00 2001 From: Jeff Lee Date: Sun, 22 Nov 2009 18:10:46 -0500 Subject: [PATCH 1/3] Added osGetRegionStats() function, to return a number of sim statistics --- OpenSim/Region/Framework/Scenes/Scene.cs | 5 ++++ .../Framework/Scenes/SimStatsReporter.cs | 11 +++++++++ .../Shared/Api/Implementation/LSL_Api.cs | 1 + .../Shared/Api/Implementation/OSSL_Api.cs | 15 ++++++++++++ .../Shared/Api/Interface/IOSSL_Api.cs | 1 + .../Shared/Api/Runtime/LSL_Constants.cs | 23 +++++++++++++++++++ .../Shared/Api/Runtime/OSSL_Stub.cs | 5 ++++ 7 files changed, 61 insertions(+) diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index eb8567fc7c..2558757b86 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -387,6 +387,11 @@ namespace OpenSim.Region.Framework.Scenes { get { return StatsReporter.getLastReportedSimFPS(); } } + + public float[] SimulatorStats + { + get { return StatsReporter.getLastReportedSimStats(); } + } public string DefaultScriptEngine { diff --git a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs index ee288b3c84..56c6ed62ea 100644 --- a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs +++ b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs @@ -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; @@ -259,6 +260,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( @@ -438,6 +444,11 @@ namespace OpenSim.Region.Framework.Scenes { return lastReportedSimFPS; } + + public float[] getLastReportedSimStats() + { + return lastReportedSimStats; + } public void AddPacketsStats(int inPackets, int outPackets, int unAckedBytes) { diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index fbbbfdc727..5de23ad988 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -5784,6 +5784,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host.AddScriptLPS(1); 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 diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index e72fa70d8a..482bfbc064 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -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; + } + } } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index 470946a76e..0b0dc00507 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs @@ -162,5 +162,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces key osGetMapTexture(); key osGetRegionMapTexture(string regionName); + LSL_List osGetRegionStats(); } } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs index 753ca55d08..acff8fb545 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs @@ -515,6 +515,29 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase public const string TEXTURE_PLYWOOD = "89556747-24cb-43ed-920b-47caed15465f"; 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; } } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index 6b888344fc..519463e097 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs @@ -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(); + } } } From 9d05962029fe864408d287d5fa7ef81f312e098a Mon Sep 17 00:00:00 2001 From: Jeff Lee Date: Mon, 23 Nov 2009 11:53:37 -0500 Subject: [PATCH 2/3] Added osGetRegionStats() function, to return a number of sim statistics --- .../ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 482bfbc064..5501679744 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -1949,9 +1949,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return key.ToString(); } + /// + /// Return information regarding various simulator statistics (sim fps, physics fps, time + /// dilation, total number of prims, total number of active scripts, script lps, various + /// timing data, packets in/out, etc. Basically much the information that's shown in the + /// client's Statistics Bar (Ctrl-Shift-1) + /// + /// List of floats public LSL_List osGetRegionStats() { - CheckThreatLevel(ThreatLevel.High, "osGetRegionStats"); + CheckThreatLevel(ThreatLevel.Moderate, "osGetRegionStats"); m_host.AddScriptLPS(1); LSL_List ret = new LSL_List(); float[] stats = World.SimulatorStats; From 52dc9ec0038052f139c759ce15df08361be96666 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Thu, 26 Nov 2009 19:00:57 +0000 Subject: [PATCH 3/3] Bump trunk version number to 0.6.9. This is a place holder name and not necessarily the version number that will be used --- OpenSim/Framework/Servers/VersionInfo.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Framework/Servers/VersionInfo.cs b/OpenSim/Framework/Servers/VersionInfo.cs index 9f98310282..ec94b2db61 100644 --- a/OpenSim/Framework/Servers/VersionInfo.cs +++ b/OpenSim/Framework/Servers/VersionInfo.cs @@ -29,7 +29,7 @@ namespace OpenSim { public class VersionInfo { - private const string VERSION_NUMBER = "0.6.8"; + private const string VERSION_NUMBER = "0.6.9"; private const Flavour VERSION_FLAVOUR = Flavour.Dev; public enum Flavour