aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment
diff options
context:
space:
mode:
authorTeravus Ovares2008-02-06 08:03:22 +0000
committerTeravus Ovares2008-02-06 08:03:22 +0000
commit9cd9e90e7f174ab0d84af2df6aff7d23b3493552 (patch)
treeba54a04de7b6f2a64ff0edd6db8d59c4717552c0 /OpenSim/Region/Environment
parentRevert color console changes until a cross-platform method is found. (diff)
downloadopensim-SC_OLD-9cd9e90e7f174ab0d84af2df6aff7d23b3493552.zip
opensim-SC_OLD-9cd9e90e7f174ab0d84af2df6aff7d23b3493552.tar.gz
opensim-SC_OLD-9cd9e90e7f174ab0d84af2df6aff7d23b3493552.tar.bz2
opensim-SC_OLD-9cd9e90e7f174ab0d84af2df6aff7d23b3493552.tar.xz
* Added Active Scripts to report the number of scripts running to Sim Stats
* Added Script Performance to report the number of functions run per second to Sim Stats. * Removed a few warnings (@.@ up to 50 now)
Diffstat (limited to 'OpenSim/Region/Environment')
-rw-r--r--OpenSim/Region/Environment/Scenes/InnerScene.cs28
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs2
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs11
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs12
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs22
-rw-r--r--OpenSim/Region/Environment/Scenes/SimStatsReporter.cs31
6 files changed, 100 insertions, 6 deletions
diff --git a/OpenSim/Region/Environment/Scenes/InnerScene.cs b/OpenSim/Region/Environment/Scenes/InnerScene.cs
index 49aeaf9..8a7402c 100644
--- a/OpenSim/Region/Environment/Scenes/InnerScene.cs
+++ b/OpenSim/Region/Environment/Scenes/InnerScene.cs
@@ -67,6 +67,9 @@ namespace OpenSim.Region.Environment.Scenes
67 protected int m_numChildAgents = 0; 67 protected int m_numChildAgents = 0;
68 protected int m_physicalPrim = 0; 68 protected int m_physicalPrim = 0;
69 69
70 protected int m_activeScripts = 0;
71 protected int m_scriptLPS = 0;
72
70 internal object m_syncRoot = new object(); 73 internal object m_syncRoot = new object();
71 74
72 public PhysicsScene _PhyScene; 75 public PhysicsScene _PhyScene;
@@ -201,6 +204,16 @@ namespace OpenSim.Region.Environment.Scenes
201 m_physicalPrim--; 204 m_physicalPrim--;
202 } 205 }
203 206
207 public void AddToScriptLPS(int number)
208 {
209 m_scriptLPS += number;
210 }
211
212 public void AddActiveScripts(int number)
213 {
214 m_activeScripts += number;
215 }
216
204 public void RemovePrim(uint localID, LLUUID avatar_deleter) 217 public void RemovePrim(uint localID, LLUUID avatar_deleter)
205 { 218 {
206 List<EntityBase> EntityList = GetEntities(); 219 List<EntityBase> EntityList = GetEntities();
@@ -322,6 +335,17 @@ namespace OpenSim.Region.Environment.Scenes
322 return m_physicalPrim; 335 return m_physicalPrim;
323 } 336 }
324 337
338 public int GetActiveScripts()
339 {
340 return m_activeScripts;
341 }
342
343 public int GetScriptLPS()
344 {
345 int returnval = m_scriptLPS;
346 m_scriptLPS = 0;
347 return returnval;
348 }
325 #endregion 349 #endregion
326 350
327 #region Get Methods 351 #region Get Methods
@@ -546,10 +570,6 @@ namespace OpenSim.Region.Environment.Scenes
546 570
547 //m_log.Info("[DISTANCE]: " + distResult.ToString()); 571 //m_log.Info("[DISTANCE]: " + distResult.ToString());
548 572
549 if (distResult > 60)
550 {
551 int x = 0;
552 }
553 if (distResult < presence.DrawDistance) 573 if (distResult < presence.DrawDistance)
554 { 574 {
555 // Send Only if we don't already know about it. 575 // Send Only if we don't already know about it.
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index a724ac0..d0acded 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -639,6 +639,8 @@ namespace OpenSim.Region.Environment.Scenes
639 m_statsReporter.addFrameMS(frameMS); 639 m_statsReporter.addFrameMS(frameMS);
640 m_statsReporter.addPhysicsMS(physicsMS); 640 m_statsReporter.addPhysicsMS(physicsMS);
641 m_statsReporter.addOtherMS(otherMS); 641 m_statsReporter.addOtherMS(otherMS);
642 m_statsReporter.SetActiveScripts(m_innerScene.GetActiveScripts());
643 m_statsReporter.addScriptLines(m_innerScene.GetScriptLPS());
642 644
643 } 645 }
644 catch (NotImplementedException) 646 catch (NotImplementedException)
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs
index 0956f74..1e99079 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs
@@ -93,6 +93,17 @@ namespace OpenSim.Region.Environment.Scenes
93 part.StartScripts(); 93 part.StartScripts();
94 } 94 }
95 } 95 }
96
97 public void StopScripts()
98 {
99 lock (m_parts)
100 {
101 foreach (SceneObjectPart part in m_parts.Values)
102 {
103 part.StopScripts();
104 }
105 }
106 }
96 107
97 /// Start a given script. 108 /// Start a given script.
98 /// </summary> 109 /// </summary>
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
index 4fe7b55..eb5a80c 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
@@ -1702,6 +1702,18 @@ namespace OpenSim.Region.Environment.Scenes
1702 m_parts.Clear(); 1702 m_parts.Clear();
1703 } 1703 }
1704 1704
1705 public void AddScriptLPS(int count)
1706 {
1707 InnerScene d = m_scene.m_innerScene;
1708 d.AddToScriptLPS(count);
1709 }
1710
1711 public void AddActiveScriptCount(int count)
1712 {
1713 InnerScene d = m_scene.m_innerScene;
1714 d.AddActiveScripts(count);
1715 }
1716
1705 public override void SetText(string text, Vector3 color, double alpha) 1717 public override void SetText(string text, Vector3 color, double alpha)
1706 { 1718 {
1707 Color = Color.FromArgb(0xff - (int) (alpha*0xff), 1719 Color = Color.FromArgb(0xff - (int) (alpha*0xff),
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs
index d9ee94c..e8ffe0e 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs
@@ -125,6 +125,20 @@ namespace OpenSim.Region.Environment.Scenes
125 } 125 }
126 } 126 }
127 } 127 }
128
129 public void StopScripts()
130 {
131 lock (m_taskInventory)
132 {
133 foreach (TaskInventoryItem item in m_taskInventory.Values)
134 {
135 if (10 == item.Type)
136 {
137 StopScript(item.ItemID);
138 }
139 }
140 }
141 }
128 142
129 /// <summary> 143 /// <summary>
130 /// Start a script which is in this prim's inventory. 144 /// Start a script which is in this prim's inventory.
@@ -144,6 +158,7 @@ namespace OpenSim.Region.Environment.Scenes
144 { 158 {
145 string script = Helpers.FieldToUTF8String(rezAsset.Data); 159 string script = Helpers.FieldToUTF8String(rezAsset.Data);
146 m_parentGroup.Scene.EventManager.TriggerRezScript(LocalID, item.ItemID, script); 160 m_parentGroup.Scene.EventManager.TriggerRezScript(LocalID, item.ItemID, script);
161
147 } 162 }
148 else 163 else
149 { 164 {
@@ -167,6 +182,7 @@ namespace OpenSim.Region.Environment.Scenes
167 if (m_taskInventory.ContainsKey(itemId)) 182 if (m_taskInventory.ContainsKey(itemId))
168 { 183 {
169 StartScript(m_taskInventory[itemId]); 184 StartScript(m_taskInventory[itemId]);
185 m_parentGroup.AddActiveScriptCount(1);
170 } 186 }
171 else 187 else
172 { 188 {
@@ -187,6 +203,7 @@ namespace OpenSim.Region.Environment.Scenes
187 if (m_taskInventory.ContainsKey(itemId)) 203 if (m_taskInventory.ContainsKey(itemId))
188 { 204 {
189 m_parentGroup.Scene.EventManager.TriggerRemoveScript(LocalID, itemId); 205 m_parentGroup.Scene.EventManager.TriggerRemoveScript(LocalID, itemId);
206 m_parentGroup.AddActiveScriptCount(-1);
190 } 207 }
191 else 208 else
192 { 209 {
@@ -295,6 +312,11 @@ namespace OpenSim.Region.Environment.Scenes
295 return false; 312 return false;
296 } 313 }
297 314
315 public void AddScriptLPS(int count)
316 {
317 m_parentGroup.AddScriptLPS(count);
318 }
319
298 /// <summary> 320 /// <summary>
299 /// Remove an item from this prim's inventory 321 /// Remove an item from this prim's inventory
300 /// </summary> 322 /// </summary>
diff --git a/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs b/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs
index 3bd7e4a..f2cefb5 100644
--- a/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs
+++ b/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs
@@ -51,10 +51,13 @@ namespace OpenSim.Region.Environment.Scenes
51 PhysicsMS = 7, 51 PhysicsMS = 7,
52 AgentMS = 8, 52 AgentMS = 8,
53 ImageMS = 9, 53 ImageMS = 9,
54 ScriptMS = 10,
54 TotalPrim = 11, 55 TotalPrim = 11,
55 ActivePrim = 12, 56 ActivePrim = 12,
56 Agents = 13, 57 Agents = 13,
57 ChildAgents = 14, 58 ChildAgents = 14,
59 ActiveScripts = 15,
60 ScriptLinesPerSecond = 16,
58 InPacketsPerSecond = 17, 61 InPacketsPerSecond = 17,
59 OutPacketsPerSecond = 18, 62 OutPacketsPerSecond = 18,
60 PendingDownloads = 19, 63 PendingDownloads = 19,
@@ -74,12 +77,15 @@ namespace OpenSim.Region.Environment.Scenes
74 private int m_fps = 0; 77 private int m_fps = 0;
75 private float m_pfps = 0; 78 private float m_pfps = 0;
76 private int m_agentUpdates = 0; 79 private int m_agentUpdates = 0;
80
77 private int m_frameMS = 0; 81 private int m_frameMS = 0;
78 private int m_netMS = 0; 82 private int m_netMS = 0;
79 private int m_agentMS = 0; 83 private int m_agentMS = 0;
80 private int m_physicsMS = 0; 84 private int m_physicsMS = 0;
81 private int m_imageMS = 0; 85 private int m_imageMS = 0;
82 private int m_otherMS = 0; 86 private int m_otherMS = 0;
87 private int m_scriptMS = 0;
88
83 private int m_rootAgents = 0; 89 private int m_rootAgents = 0;
84 private int m_childAgents = 0; 90 private int m_childAgents = 0;
85 private int m_numPrim = 0; 91 private int m_numPrim = 0;
@@ -89,9 +95,11 @@ namespace OpenSim.Region.Environment.Scenes
89 private int m_unAckedBytes = 0; 95 private int m_unAckedBytes = 0;
90 private int m_pendingDownloads = 0; 96 private int m_pendingDownloads = 0;
91 private int m_pendingUploads = 0; 97 private int m_pendingUploads = 0;
98 private int m_activeScripts = 0;
99 private int m_scriptLinesPerSecond = 0;
92 100
93 101
94 SimStatsPacket.StatBlock[] sb = new SimStatsPacket.StatBlock[19]; 102 SimStatsPacket.StatBlock[] sb = new SimStatsPacket.StatBlock[21];
95 SimStatsPacket.RegionBlock rb = new SimStatsPacket.RegionBlock(); 103 SimStatsPacket.RegionBlock rb = new SimStatsPacket.RegionBlock();
96 SimStatsPacket statpack = (SimStatsPacket)PacketPool.Instance.GetPacket(PacketType.SimStats); 104 SimStatsPacket statpack = (SimStatsPacket)PacketPool.Instance.GetPacket(PacketType.SimStats);
97 105
@@ -106,7 +114,7 @@ namespace OpenSim.Region.Environment.Scenes
106 114
107 statsUpdateFactor = (float)(statsUpdatesEveryMS / 1000); 115 statsUpdateFactor = (float)(statsUpdatesEveryMS / 1000);
108 ReportingRegion = regionData; 116 ReportingRegion = regionData;
109 for (int i = 0; i<19;i++) 117 for (int i = 0; i<21;i++)
110 { 118 {
111 sb[i] = new SimStatsPacket.StatBlock(); 119 sb[i] = new SimStatsPacket.StatBlock();
112 } 120 }
@@ -222,6 +230,12 @@ namespace OpenSim.Region.Environment.Scenes
222 sb[18].StatID = (uint)Stats.PendingUploads; 230 sb[18].StatID = (uint)Stats.PendingUploads;
223 sb[18].StatValue = m_pendingUploads; 231 sb[18].StatValue = m_pendingUploads;
224 232
233 sb[19].StatID = (uint)Stats.ActiveScripts;
234 sb[19].StatValue = m_activeScripts;
235
236 sb[20].StatID = (uint)Stats.ScriptLinesPerSecond;
237 sb[20].StatValue = m_scriptLinesPerSecond / statsUpdateFactor;
238
225 statpack.Stat = sb; 239 statpack.Stat = sb;
226 240
227 if (OnSendStatsResult != null) 241 if (OnSendStatsResult != null)
@@ -241,12 +255,15 @@ namespace OpenSim.Region.Environment.Scenes
241 m_inPacketsPerSecond = 0; 255 m_inPacketsPerSecond = 0;
242 m_outPacketsPerSecond = 0; 256 m_outPacketsPerSecond = 0;
243 m_unAckedBytes = 0; 257 m_unAckedBytes = 0;
258 m_scriptLinesPerSecond = 0;
259
244 m_frameMS = 0; 260 m_frameMS = 0;
245 m_agentMS = 0; 261 m_agentMS = 0;
246 m_netMS = 0; 262 m_netMS = 0;
247 m_physicsMS = 0; 263 m_physicsMS = 0;
248 m_imageMS = 0; 264 m_imageMS = 0;
249 m_otherMS = 0; 265 m_otherMS = 0;
266 m_scriptMS = 0;
250 } 267 }
251 268
252 # region methods called from Scene 269 # region methods called from Scene
@@ -344,6 +361,16 @@ namespace OpenSim.Region.Environment.Scenes
344 m_pendingDownloads += count; 361 m_pendingDownloads += count;
345 } 362 }
346 363
364 public void addScriptLines(int count)
365 {
366 m_scriptLinesPerSecond += count;
367 }
368
369 public void SetActiveScripts(int count)
370 {
371 m_activeScripts = count;
372 }
373
347 #endregion 374 #endregion
348 375
349 } 376 }