aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJeff Lee2009-11-22 18:10:46 -0500
committerMelanie2009-11-26 17:43:00 +0000
commitd39c300d11109553b75ca761d26dda278c0ad7dd (patch)
tree5e45b10aa3389eaddc4e2b5b39ba872af3087fc5
parentFix a small bug. Trusted script crossings now work again (diff)
downloadopensim-SC-d39c300d11109553b75ca761d26dda278c0ad7dd.zip
opensim-SC-d39c300d11109553b75ca761d26dda278c0ad7dd.tar.gz
opensim-SC-d39c300d11109553b75ca761d26dda278c0ad7dd.tar.bz2
opensim-SC-d39c300d11109553b75ca761d26dda278c0ad7dd.tar.xz
Added osGetRegionStats() function, to return a number of sim statistics
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs5
-rw-r--r--OpenSim/Region/Framework/Scenes/SimStatsReporter.cs11
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs1
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs15
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs1
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs23
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs5
7 files changed, 61 insertions, 0 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index eb8567f..2558757 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -387,6 +387,11 @@ namespace OpenSim.Region.Framework.Scenes
387 { 387 {
388 get { return StatsReporter.getLastReportedSimFPS(); } 388 get { return StatsReporter.getLastReportedSimFPS(); }
389 } 389 }
390
391 public float[] SimulatorStats
392 {
393 get { return StatsReporter.getLastReportedSimStats(); }
394 }
390 395
391 public string DefaultScriptEngine 396 public string DefaultScriptEngine
392 { 397 {
diff --git a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs
index ee288b3..56c6ed6 100644
--- a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs
+++ b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs
@@ -82,6 +82,7 @@ namespace OpenSim.Region.Framework.Scenes
82 private int m_fps = 0; 82 private int m_fps = 0;
83 // saved last reported value so there is something available for llGetRegionFPS 83 // saved last reported value so there is something available for llGetRegionFPS
84 private float lastReportedSimFPS = 0; 84 private float lastReportedSimFPS = 0;
85 private float[] lastReportedSimStats = new float[21];
85 private float m_pfps = 0; 86 private float m_pfps = 0;
86 private int m_agentUpdates = 0; 87 private int m_agentUpdates = 0;
87 88
@@ -259,6 +260,11 @@ namespace OpenSim.Region.Framework.Scenes
259 260
260 sb[20].StatID = (uint)Stats.ScriptLinesPerSecond; 261 sb[20].StatID = (uint)Stats.ScriptLinesPerSecond;
261 sb[20].StatValue = m_scriptLinesPerSecond / statsUpdateFactor; 262 sb[20].StatValue = m_scriptLinesPerSecond / statsUpdateFactor;
263
264 for (int i = 0; i < 21; i++)
265 {
266 lastReportedSimStats[i] = sb[i].StatValue;
267 }
262 268
263 SimStats simStats 269 SimStats simStats
264 = new SimStats( 270 = new SimStats(
@@ -438,6 +444,11 @@ namespace OpenSim.Region.Framework.Scenes
438 { 444 {
439 return lastReportedSimFPS; 445 return lastReportedSimFPS;
440 } 446 }
447
448 public float[] getLastReportedSimStats()
449 {
450 return lastReportedSimStats;
451 }
441 452
442 public void AddPacketsStats(int inPackets, int outPackets, int unAckedBytes) 453 public void AddPacketsStats(int inPackets, int outPackets, int unAckedBytes)
443 { 454 {
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index fbbbfdc..5de23ad 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
5784 m_host.AddScriptLPS(1); 5784 m_host.AddScriptLPS(1);
5785 return World.SimulatorFPS; 5785 return World.SimulatorFPS;
5786 } 5786 }
5787
5787 5788
5788 /* particle system rules should be coming into this routine as doubles, that is 5789 /* particle system rules should be coming into this routine as doubles, that is
5789 rule[0] should be an integer from this list and rule[1] should be the arg 5790 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 e72fa70..482bfbc 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
1948 1948
1949 return key.ToString(); 1949 return key.ToString();
1950 } 1950 }
1951
1952 public LSL_List osGetRegionStats()
1953 {
1954 CheckThreatLevel(ThreatLevel.High, "osGetRegionStats");
1955 m_host.AddScriptLPS(1);
1956 LSL_List ret = new LSL_List();
1957 float[] stats = World.SimulatorStats;
1958
1959 for (int i = 0; i < 21; i++)
1960 {
1961 ret.Add(new LSL_Float( stats[i] ));
1962 }
1963 return ret;
1964 }
1965
1951 } 1966 }
1952} 1967}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
index 470946a..0b0dc00 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
162 162
163 key osGetMapTexture(); 163 key osGetMapTexture();
164 key osGetRegionMapTexture(string regionName); 164 key osGetRegionMapTexture(string regionName);
165 LSL_List osGetRegionStats();
165 } 166 }
166} 167}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
index 753ca55..acff8fb 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
515 public const string TEXTURE_PLYWOOD = "89556747-24cb-43ed-920b-47caed15465f"; 515 public const string TEXTURE_PLYWOOD = "89556747-24cb-43ed-920b-47caed15465f";
516 public const string TEXTURE_TRANSPARENT = "8dcd4a48-2d37-4909-9f78-f7a9eb4ef903"; 516 public const string TEXTURE_TRANSPARENT = "8dcd4a48-2d37-4909-9f78-f7a9eb4ef903";
517 public const string TEXTURE_MEDIA = "8b5fec65-8d8d-9dc5-cda8-8fdf2716e361"; 517 public const string TEXTURE_MEDIA = "8b5fec65-8d8d-9dc5-cda8-8fdf2716e361";
518
519 // Constants for osGetRegionStats
520 public const int STATS_TIME_DILATION = 0;
521 public const int STATS_SIM_FPS = 1;
522 public const int STATS_PHYSICS_FPS = 2;
523 public const int STATS_AGENT_UPDATES = 3;
524 public const int STATS_ROOT_AGENTS = 4;
525 public const int STATS_CHILD_AGENTS = 5;
526 public const int STATS_TOTAL_PRIMS = 6;
527 public const int STATS_ACTIVE_PRIMS = 7;
528 public const int STATS_FRAME_MS = 8;
529 public const int STATS_NET_MS = 9;
530 public const int STATS_PHYSICS_MS = 10;
531 public const int STATS_IMAGE_MS = 11;
532 public const int STATS_OTHER_MS = 12;
533 public const int STATS_IN_PACKETS_PER_SECOND = 13;
534 public const int STATS_OUT_PACKETS_PER_SECOND = 14;
535 public const int STATS_UNACKED_BYTES = 15;
536 public const int STATS_AGENT_MS = 16;
537 public const int STATS_PENDING_DOWNLOADS = 17;
538 public const int STATS_PENDING_UPLOADS = 18;
539 public const int STATS_ACTIVE_SCRIPTS = 19;
540 public const int STATS_SCRIPT_LPS = 20;
518 541
519 } 542 }
520} 543}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
index 6b88834..519463e 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
632 { 632 {
633 return m_OSSL_Functions.osGetRegionMapTexture(regionName); 633 return m_OSSL_Functions.osGetRegionMapTexture(regionName);
634 } 634 }
635
636 public LSL_List osGetRegionStats()
637 {
638 return m_OSSL_Functions.osGetRegionStats();
639 }
635 } 640 }
636} 641}