aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorDiva Canto2013-07-13 09:53:05 -0700
committerDiva Canto2013-07-13 09:53:05 -0700
commitccee2959f73aeaa81b13b25eb1128244b4e9c0f4 (patch)
tree1cea06b53b07982e7e9fbfebf3e4aab6321471fe /OpenSim
parentMoved SendInitialDataToMe to earlier in CompleteMovement. Moved TriggerOnMake... (diff)
parentReinsert PhysicsActor variable back into SOP.SubscribeForCollisionEvents() in... (diff)
downloadopensim-SC-ccee2959f73aeaa81b13b25eb1128244b4e9c0f4.zip
opensim-SC-ccee2959f73aeaa81b13b25eb1128244b4e9c0f4.tar.gz
opensim-SC-ccee2959f73aeaa81b13b25eb1128244b4e9c0f4.tar.bz2
opensim-SC-ccee2959f73aeaa81b13b25eb1128244b4e9c0f4.tar.xz
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
Diffstat (limited to 'OpenSim')
-rwxr-xr-xOpenSim/Framework/Monitoring/Stats/CounterStat.cs21
-rw-r--r--OpenSim/Framework/Monitoring/Stats/Stat.cs1
-rw-r--r--OpenSim/Framework/Monitoring/StatsManager.cs66
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs20
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs23
5 files changed, 121 insertions, 10 deletions
diff --git a/OpenSim/Framework/Monitoring/Stats/CounterStat.cs b/OpenSim/Framework/Monitoring/Stats/CounterStat.cs
index caea30d..04442c3 100755
--- a/OpenSim/Framework/Monitoring/Stats/CounterStat.cs
+++ b/OpenSim/Framework/Monitoring/Stats/CounterStat.cs
@@ -224,5 +224,26 @@ public class CounterStat : Stat
224 } 224 }
225 } 225 }
226 } 226 }
227
228 // CounterStat is a basic stat plus histograms
229 public override OSDMap ToOSDMap()
230 {
231 // Get the foundational instance
232 OSDMap map = base.ToOSDMap();
233
234 map["StatType"] = "CounterStat";
235
236 // If there are any histograms, add a new field that is an array of histograms as OSDMaps
237 if (m_histograms.Count > 0)
238 {
239 OSDArray histos = new OSDArray();
240 foreach (EventHistogram histo in m_histograms.Values)
241 {
242 histos.Add(histo.GetHistogramAsOSDMap());
243 }
244 map.Add("Histograms", histos);
245 }
246 return map;
247 }
227} 248}
228} 249}
diff --git a/OpenSim/Framework/Monitoring/Stats/Stat.cs b/OpenSim/Framework/Monitoring/Stats/Stat.cs
index c57ee0c..9629b6e 100644
--- a/OpenSim/Framework/Monitoring/Stats/Stat.cs
+++ b/OpenSim/Framework/Monitoring/Stats/Stat.cs
@@ -242,6 +242,7 @@ namespace OpenSim.Framework.Monitoring
242 ret.Add("Description", OSD.FromString(Description)); 242 ret.Add("Description", OSD.FromString(Description));
243 ret.Add("UnitName", OSD.FromString(UnitName)); 243 ret.Add("UnitName", OSD.FromString(UnitName));
244 ret.Add("Value", OSD.FromReal(Value)); 244 ret.Add("Value", OSD.FromReal(Value));
245 ret.Add("StatType", "Stat"); // used by overloading classes to denote type of stat
245 246
246 return ret; 247 return ret;
247 } 248 }
diff --git a/OpenSim/Framework/Monitoring/StatsManager.cs b/OpenSim/Framework/Monitoring/StatsManager.cs
index 12d3a75..a5b54c9 100644
--- a/OpenSim/Framework/Monitoring/StatsManager.cs
+++ b/OpenSim/Framework/Monitoring/StatsManager.cs
@@ -30,6 +30,8 @@ using System.Collections.Generic;
30using System.Linq; 30using System.Linq;
31using System.Text; 31using System.Text;
32 32
33using OpenMetaverse.StructuredData;
34
33namespace OpenSim.Framework.Monitoring 35namespace OpenSim.Framework.Monitoring
34{ 36{
35 /// <summary> 37 /// <summary>
@@ -168,6 +170,70 @@ namespace OpenSim.Framework.Monitoring
168 } 170 }
169 } 171 }
170 172
173 // Creates an OSDMap of the format:
174 // { categoryName: {
175 // containerName: {
176 // statName: {
177 // "Name": name,
178 // "ShortName": shortName,
179 // ...
180 // },
181 // statName: {
182 // "Name": name,
183 // "ShortName": shortName,
184 // ...
185 // },
186 // ...
187 // },
188 // containerName: {
189 // ...
190 // },
191 // ...
192 // },
193 // categoryName: {
194 // ...
195 // },
196 // ...
197 // }
198 // The passed in parameters will filter the categories, containers and stats returned. If any of the
199 // parameters are either EmptyOrNull or the AllSubCommand value, all of that type will be returned.
200 // Case matters.
201 public static OSDMap GetStatsAsOSDMap(string pCategoryName, string pContainerName, string pStatName)
202 {
203 OSDMap map = new OSDMap();
204
205 foreach (string catName in RegisteredStats.Keys)
206 {
207 // Do this category if null spec, "all" subcommand or category name matches passed parameter.
208 // Skip category if none of the above.
209 if (!(String.IsNullOrEmpty(pCategoryName) || pCategoryName == AllSubCommand || pCategoryName == catName))
210 continue;
211
212 OSDMap contMap = new OSDMap();
213 foreach (string contName in RegisteredStats[catName].Keys)
214 {
215 if (!(string.IsNullOrEmpty(pContainerName) || pContainerName == AllSubCommand || pContainerName == contName))
216 continue;
217
218 OSDMap statMap = new OSDMap();
219
220 SortedDictionary<string, Stat> theStats = RegisteredStats[catName][contName];
221 foreach (string statName in theStats.Keys)
222 {
223 if (!(String.IsNullOrEmpty(pStatName) || pStatName == AllSubCommand || pStatName == statName))
224 continue;
225
226 statMap.Add(statName, theStats[statName].ToOSDMap());
227 }
228
229 contMap.Add(contName, statMap);
230 }
231 map.Add(catName, contMap);
232 }
233
234 return map;
235 }
236
171// /// <summary> 237// /// <summary>
172// /// Start collecting statistics related to assets. 238// /// Start collecting statistics related to assets.
173// /// Should only be called once. 239// /// Should only be called once.
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 830fe31..eb3af42 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -4272,10 +4272,14 @@ namespace OpenSim.Region.Framework.Scenes
4272// m_log.DebugFormat("[SCENE OBJECT PART]: Updated PrimFlags on {0} {1} to {2}", Name, LocalId, Flags); 4272// m_log.DebugFormat("[SCENE OBJECT PART]: Updated PrimFlags on {0} {1} to {2}", Name, LocalId, Flags);
4273 } 4273 }
4274 4274
4275 // Subscribe for physics collision events if needed for scripts and sounds 4275 /// <summary>
4276 /// Subscribe for physics collision events if needed for scripts and sounds
4277 /// </summary>
4276 public void SubscribeForCollisionEvents() 4278 public void SubscribeForCollisionEvents()
4277 { 4279 {
4278 if (PhysActor != null) 4280 PhysicsActor pa = PhysActor;
4281
4282 if (pa != null)
4279 { 4283 {
4280 if ( 4284 if (
4281 ((AggregateScriptEvents & scriptEvents.collision) != 0) || 4285 ((AggregateScriptEvents & scriptEvents.collision) != 0) ||
@@ -4293,20 +4297,20 @@ namespace OpenSim.Region.Framework.Scenes
4293 (CollisionSound != UUID.Zero) 4297 (CollisionSound != UUID.Zero)
4294 ) 4298 )
4295 { 4299 {
4296 if (!PhysActor.SubscribedEvents()) 4300 if (!pa.SubscribedEvents())
4297 { 4301 {
4298 // If not already subscribed for event, set up for a collision event. 4302 // If not already subscribed for event, set up for a collision event.
4299 PhysActor.OnCollisionUpdate += PhysicsCollision; 4303 pa.OnCollisionUpdate += PhysicsCollision;
4300 PhysActor.SubscribeEvents(1000); 4304 pa.SubscribeEvents(1000);
4301 } 4305 }
4302 } 4306 }
4303 else 4307 else
4304 { 4308 {
4305 // There is no need to be subscribed to collisions so, if subscribed, remove subscription 4309 // There is no need to be subscribed to collisions so, if subscribed, remove subscription
4306 if (PhysActor.SubscribedEvents()) 4310 if (pa.SubscribedEvents())
4307 { 4311 {
4308 PhysActor.OnCollisionUpdate -= PhysicsCollision; 4312 pa.OnCollisionUpdate -= PhysicsCollision;
4309 PhysActor.UnSubscribeEvents(); 4313 pa.UnSubscribeEvents();
4310 } 4314 }
4311 } 4315 }
4312 } 4316 }
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
index 887a317..229180f 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
@@ -241,7 +241,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
241 if (Engine.Config.GetString("ScriptStopStrategy", "abort") == "co-op") 241 if (Engine.Config.GetString("ScriptStopStrategy", "abort") == "co-op")
242 { 242 {
243 m_coopTermination = true; 243 m_coopTermination = true;
244 m_coopSleepHandle = new AutoResetEvent(false); 244 m_coopSleepHandle = new XEngineEventWaitHandle(false, EventResetMode.AutoReset);
245 } 245 }
246 } 246 }
247 247
@@ -1201,4 +1201,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
1201 Suspended = false; 1201 Suspended = false;
1202 } 1202 }
1203 } 1203 }
1204} 1204
1205 /// <summary>
1206 /// Xengine event wait handle.
1207 /// </summary>
1208 /// <remarks>
1209 /// This class exists becase XEngineScriptBase gets a reference to this wait handle. We need to make sure that
1210 /// when scripts are running in different AppDomains the lease does not expire.
1211 /// FIXME: Like LSL_Api, etc., this effectively leaks memory since the GC will never collect it. To avoid this,
1212 /// proper remoting sponsorship needs to be implemented across the board.
1213 /// </remarks>
1214 public class XEngineEventWaitHandle : EventWaitHandle
1215 {
1216 public XEngineEventWaitHandle(bool initialState, EventResetMode mode) : base(initialState, mode) {}
1217
1218 public override Object InitializeLifetimeService()
1219 {
1220 return null;
1221 }
1222 }
1223} \ No newline at end of file