Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
commit
ccee2959f7
|
@ -224,5 +224,26 @@ public class CounterStat : Stat
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CounterStat is a basic stat plus histograms
|
||||||
|
public override OSDMap ToOSDMap()
|
||||||
|
{
|
||||||
|
// Get the foundational instance
|
||||||
|
OSDMap map = base.ToOSDMap();
|
||||||
|
|
||||||
|
map["StatType"] = "CounterStat";
|
||||||
|
|
||||||
|
// If there are any histograms, add a new field that is an array of histograms as OSDMaps
|
||||||
|
if (m_histograms.Count > 0)
|
||||||
|
{
|
||||||
|
OSDArray histos = new OSDArray();
|
||||||
|
foreach (EventHistogram histo in m_histograms.Values)
|
||||||
|
{
|
||||||
|
histos.Add(histo.GetHistogramAsOSDMap());
|
||||||
|
}
|
||||||
|
map.Add("Histograms", histos);
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -242,6 +242,7 @@ namespace OpenSim.Framework.Monitoring
|
||||||
ret.Add("Description", OSD.FromString(Description));
|
ret.Add("Description", OSD.FromString(Description));
|
||||||
ret.Add("UnitName", OSD.FromString(UnitName));
|
ret.Add("UnitName", OSD.FromString(UnitName));
|
||||||
ret.Add("Value", OSD.FromReal(Value));
|
ret.Add("Value", OSD.FromReal(Value));
|
||||||
|
ret.Add("StatType", "Stat"); // used by overloading classes to denote type of stat
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,8 @@ using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
|
using OpenMetaverse.StructuredData;
|
||||||
|
|
||||||
namespace OpenSim.Framework.Monitoring
|
namespace OpenSim.Framework.Monitoring
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -168,6 +170,70 @@ namespace OpenSim.Framework.Monitoring
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Creates an OSDMap of the format:
|
||||||
|
// { categoryName: {
|
||||||
|
// containerName: {
|
||||||
|
// statName: {
|
||||||
|
// "Name": name,
|
||||||
|
// "ShortName": shortName,
|
||||||
|
// ...
|
||||||
|
// },
|
||||||
|
// statName: {
|
||||||
|
// "Name": name,
|
||||||
|
// "ShortName": shortName,
|
||||||
|
// ...
|
||||||
|
// },
|
||||||
|
// ...
|
||||||
|
// },
|
||||||
|
// containerName: {
|
||||||
|
// ...
|
||||||
|
// },
|
||||||
|
// ...
|
||||||
|
// },
|
||||||
|
// categoryName: {
|
||||||
|
// ...
|
||||||
|
// },
|
||||||
|
// ...
|
||||||
|
// }
|
||||||
|
// The passed in parameters will filter the categories, containers and stats returned. If any of the
|
||||||
|
// parameters are either EmptyOrNull or the AllSubCommand value, all of that type will be returned.
|
||||||
|
// Case matters.
|
||||||
|
public static OSDMap GetStatsAsOSDMap(string pCategoryName, string pContainerName, string pStatName)
|
||||||
|
{
|
||||||
|
OSDMap map = new OSDMap();
|
||||||
|
|
||||||
|
foreach (string catName in RegisteredStats.Keys)
|
||||||
|
{
|
||||||
|
// Do this category if null spec, "all" subcommand or category name matches passed parameter.
|
||||||
|
// Skip category if none of the above.
|
||||||
|
if (!(String.IsNullOrEmpty(pCategoryName) || pCategoryName == AllSubCommand || pCategoryName == catName))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
OSDMap contMap = new OSDMap();
|
||||||
|
foreach (string contName in RegisteredStats[catName].Keys)
|
||||||
|
{
|
||||||
|
if (!(string.IsNullOrEmpty(pContainerName) || pContainerName == AllSubCommand || pContainerName == contName))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
OSDMap statMap = new OSDMap();
|
||||||
|
|
||||||
|
SortedDictionary<string, Stat> theStats = RegisteredStats[catName][contName];
|
||||||
|
foreach (string statName in theStats.Keys)
|
||||||
|
{
|
||||||
|
if (!(String.IsNullOrEmpty(pStatName) || pStatName == AllSubCommand || pStatName == statName))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
statMap.Add(statName, theStats[statName].ToOSDMap());
|
||||||
|
}
|
||||||
|
|
||||||
|
contMap.Add(contName, statMap);
|
||||||
|
}
|
||||||
|
map.Add(catName, contMap);
|
||||||
|
}
|
||||||
|
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
// /// <summary>
|
// /// <summary>
|
||||||
// /// Start collecting statistics related to assets.
|
// /// Start collecting statistics related to assets.
|
||||||
// /// Should only be called once.
|
// /// Should only be called once.
|
||||||
|
|
|
@ -4272,10 +4272,14 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// m_log.DebugFormat("[SCENE OBJECT PART]: Updated PrimFlags on {0} {1} to {2}", Name, LocalId, Flags);
|
// m_log.DebugFormat("[SCENE OBJECT PART]: Updated PrimFlags on {0} {1} to {2}", Name, LocalId, Flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Subscribe for physics collision events if needed for scripts and sounds
|
/// <summary>
|
||||||
|
/// Subscribe for physics collision events if needed for scripts and sounds
|
||||||
|
/// </summary>
|
||||||
public void SubscribeForCollisionEvents()
|
public void SubscribeForCollisionEvents()
|
||||||
{
|
{
|
||||||
if (PhysActor != null)
|
PhysicsActor pa = PhysActor;
|
||||||
|
|
||||||
|
if (pa != null)
|
||||||
{
|
{
|
||||||
if (
|
if (
|
||||||
((AggregateScriptEvents & scriptEvents.collision) != 0) ||
|
((AggregateScriptEvents & scriptEvents.collision) != 0) ||
|
||||||
|
@ -4293,20 +4297,20 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
(CollisionSound != UUID.Zero)
|
(CollisionSound != UUID.Zero)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (!PhysActor.SubscribedEvents())
|
if (!pa.SubscribedEvents())
|
||||||
{
|
{
|
||||||
// If not already subscribed for event, set up for a collision event.
|
// If not already subscribed for event, set up for a collision event.
|
||||||
PhysActor.OnCollisionUpdate += PhysicsCollision;
|
pa.OnCollisionUpdate += PhysicsCollision;
|
||||||
PhysActor.SubscribeEvents(1000);
|
pa.SubscribeEvents(1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// There is no need to be subscribed to collisions so, if subscribed, remove subscription
|
// There is no need to be subscribed to collisions so, if subscribed, remove subscription
|
||||||
if (PhysActor.SubscribedEvents())
|
if (pa.SubscribedEvents())
|
||||||
{
|
{
|
||||||
PhysActor.OnCollisionUpdate -= PhysicsCollision;
|
pa.OnCollisionUpdate -= PhysicsCollision;
|
||||||
PhysActor.UnSubscribeEvents();
|
pa.UnSubscribeEvents();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -241,7 +241,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
||||||
if (Engine.Config.GetString("ScriptStopStrategy", "abort") == "co-op")
|
if (Engine.Config.GetString("ScriptStopStrategy", "abort") == "co-op")
|
||||||
{
|
{
|
||||||
m_coopTermination = true;
|
m_coopTermination = true;
|
||||||
m_coopSleepHandle = new AutoResetEvent(false);
|
m_coopSleepHandle = new XEngineEventWaitHandle(false, EventResetMode.AutoReset);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1201,4 +1201,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
||||||
Suspended = false;
|
Suspended = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Xengine event wait handle.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// This class exists becase XEngineScriptBase gets a reference to this wait handle. We need to make sure that
|
||||||
|
/// when scripts are running in different AppDomains the lease does not expire.
|
||||||
|
/// FIXME: Like LSL_Api, etc., this effectively leaks memory since the GC will never collect it. To avoid this,
|
||||||
|
/// proper remoting sponsorship needs to be implemented across the board.
|
||||||
|
/// </remarks>
|
||||||
|
public class XEngineEventWaitHandle : EventWaitHandle
|
||||||
|
{
|
||||||
|
public XEngineEventWaitHandle(bool initialState, EventResetMode mode) : base(initialState, mode) {}
|
||||||
|
|
||||||
|
public override Object InitializeLifetimeService()
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue