Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
commit
1ad3fdb40b
|
@ -162,7 +162,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void InitModule(IConfigSource config)
|
protected virtual void InitModule(IConfigSource config)
|
||||||
{
|
{
|
||||||
IConfig friendsConfig = config.Configs["Friends"];
|
IConfig friendsConfig = config.Configs["Friends"];
|
||||||
if (friendsConfig != null)
|
if (friendsConfig != null)
|
||||||
|
@ -546,7 +546,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnInstantMessage(IClientAPI client, GridInstantMessage im)
|
protected virtual void OnInstantMessage(IClientAPI client, GridInstantMessage im)
|
||||||
{
|
{
|
||||||
if ((InstantMessageDialog)im.dialog == InstantMessageDialog.FriendshipOffered)
|
if ((InstantMessageDialog)im.dialog == InstantMessageDialog.FriendshipOffered)
|
||||||
{
|
{
|
||||||
|
|
|
@ -50,6 +50,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
|
||||||
{
|
{
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
|
private int m_levelHGFriends = 0;
|
||||||
|
|
||||||
IUserManagement m_uMan;
|
IUserManagement m_uMan;
|
||||||
public IUserManagement UserManagementModule
|
public IUserManagement UserManagementModule
|
||||||
{
|
{
|
||||||
|
@ -87,6 +89,21 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
|
||||||
m_StatusNotifier = new HGStatusNotifier(this);
|
m_StatusNotifier = new HGStatusNotifier(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void InitModule(IConfigSource config)
|
||||||
|
{
|
||||||
|
base.InitModule(config);
|
||||||
|
|
||||||
|
// Additionally to the base method
|
||||||
|
IConfig friendsConfig = config.Configs["HGFriendsModule"];
|
||||||
|
if (friendsConfig != null)
|
||||||
|
{
|
||||||
|
m_levelHGFriends = friendsConfig.GetInt("LevelHGFriends", 0);
|
||||||
|
|
||||||
|
// TODO: read in all config variables pertaining to
|
||||||
|
// HG friendship permissions
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region IFriendsSimConnector
|
#region IFriendsSimConnector
|
||||||
|
@ -105,6 +122,35 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
protected override void OnInstantMessage(IClientAPI client, GridInstantMessage im)
|
||||||
|
{
|
||||||
|
if ((InstantMessageDialog)im.dialog == InstantMessageDialog.FriendshipOffered)
|
||||||
|
{
|
||||||
|
// we got a friendship offer
|
||||||
|
UUID principalID = new UUID(im.fromAgentID);
|
||||||
|
UUID friendID = new UUID(im.toAgentID);
|
||||||
|
|
||||||
|
// Check if friendID is foreigner and if principalID has the permission
|
||||||
|
// to request friendships with foreigners. If not, return immediately.
|
||||||
|
if (!UserManagementModule.IsLocalGridUser(friendID))
|
||||||
|
{
|
||||||
|
ScenePresence avatar = null;
|
||||||
|
((Scene)client.Scene).TryGetScenePresence(principalID, out avatar);
|
||||||
|
|
||||||
|
if (avatar == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (avatar.UserLevel < m_levelHGFriends)
|
||||||
|
{
|
||||||
|
client.SendAgentAlertMessage("Unable to send friendship invitation to foreigner. Insufficient permissions.", false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
base.OnInstantMessage(client, im);
|
||||||
|
}
|
||||||
|
|
||||||
protected override void OnApproveFriendRequest(IClientAPI client, UUID friendID, List<UUID> callingCardFolders)
|
protected override void OnApproveFriendRequest(IClientAPI client, UUID friendID, List<UUID> callingCardFolders)
|
||||||
{
|
{
|
||||||
// Update the local cache. Yes, we need to do it right here
|
// Update the local cache. Yes, we need to do it right here
|
||||||
|
|
|
@ -157,12 +157,18 @@ namespace OpenSim.Region.CoreModules.World.Estate
|
||||||
sendRegionInfoPacketToAll();
|
sendRegionInfoPacketToAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setEstateTerrainBaseTexture(IClientAPI remoteClient, int corner, UUID texture)
|
public void setEstateTerrainBaseTexture(int level, UUID texture)
|
||||||
|
{
|
||||||
|
setEstateTerrainBaseTexture(null, level, texture);
|
||||||
|
sendRegionHandshakeToAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEstateTerrainBaseTexture(IClientAPI remoteClient, int level, UUID texture)
|
||||||
{
|
{
|
||||||
if (texture == UUID.Zero)
|
if (texture == UUID.Zero)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
switch (corner)
|
switch (level)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
Scene.RegionInfo.RegionSettings.TerrainTexture1 = texture;
|
Scene.RegionInfo.RegionSettings.TerrainTexture1 = texture;
|
||||||
|
@ -182,6 +188,11 @@ namespace OpenSim.Region.CoreModules.World.Estate
|
||||||
sendRegionInfoPacketToAll();
|
sendRegionInfoPacketToAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setEstateTerrainTextureHeights(int corner, float lowValue, float highValue)
|
||||||
|
{
|
||||||
|
setEstateTerrainTextureHeights(null, corner, lowValue, highValue);
|
||||||
|
}
|
||||||
|
|
||||||
public void setEstateTerrainTextureHeights(IClientAPI client, int corner, float lowValue, float highValue)
|
public void setEstateTerrainTextureHeights(IClientAPI client, int corner, float lowValue, float highValue)
|
||||||
{
|
{
|
||||||
switch (corner)
|
switch (corner)
|
||||||
|
|
|
@ -173,6 +173,16 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||||
/// </returns>
|
/// </returns>
|
||||||
List<TaskInventoryItem> GetInventoryItems(string name);
|
List<TaskInventoryItem> GetInventoryItems(string name);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get inventory items by type.
|
||||||
|
/// </summary>
|
||||||
|
/// <param type="name"></param>
|
||||||
|
/// <returns>
|
||||||
|
/// A list of inventory items of that type.
|
||||||
|
/// If no inventory items of that type then an empty list is returned.
|
||||||
|
/// </returns>
|
||||||
|
List<TaskInventoryItem> GetInventoryItems(InventoryType type);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get the scene object referenced by an inventory item.
|
/// Get the scene object referenced by an inventory item.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -45,5 +45,8 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||||
/// Tell all clients about the current state of the region (terrain textures, water height, etc.).
|
/// Tell all clients about the current state of the region (terrain textures, water height, etc.).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void sendRegionHandshakeToAll();
|
void sendRegionHandshakeToAll();
|
||||||
|
|
||||||
|
void setEstateTerrainBaseTexture(int level, UUID texture);
|
||||||
|
void setEstateTerrainTextureHeights(int corner, float lowValue, float highValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,6 +82,14 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void StartProcessing();
|
void StartProcessing();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get the execution times of all scripts in the given array if they are currently running.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>
|
||||||
|
/// A float the value is a representative execution time in milliseconds of all scripts in that Array.
|
||||||
|
/// </returns>
|
||||||
|
float GetScriptExecutionTime(List<UUID> itemIDs);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get the execution times of all scripts in each object.
|
/// Get the execution times of all scripts in each object.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -3269,6 +3269,45 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A float the value is a representative execution time in milliseconds of all scripts in the link set.
|
||||||
|
/// </summary>
|
||||||
|
public float ScriptExecutionTime()
|
||||||
|
{
|
||||||
|
IScriptModule[] engines = Scene.RequestModuleInterfaces<IScriptModule>();
|
||||||
|
|
||||||
|
if (engines.Length == 0) // No engine at all
|
||||||
|
return 0.0f;
|
||||||
|
|
||||||
|
float time = 0.0f;
|
||||||
|
|
||||||
|
// get all the scripts in all parts
|
||||||
|
SceneObjectPart[] parts = m_parts.GetArray();
|
||||||
|
List<TaskInventoryItem> scripts = new List<TaskInventoryItem>();
|
||||||
|
for (int i = 0; i < parts.Length; i++)
|
||||||
|
{
|
||||||
|
scripts.AddRange(parts[i].Inventory.GetInventoryItems(InventoryType.LSL));
|
||||||
|
}
|
||||||
|
// extract the UUIDs
|
||||||
|
List<UUID> ids = new List<UUID>(scripts.Count);
|
||||||
|
foreach (TaskInventoryItem script in scripts)
|
||||||
|
{
|
||||||
|
if (!ids.Contains(script.ItemID))
|
||||||
|
{
|
||||||
|
ids.Add(script.ItemID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Offer the list of script UUIDs to each engine found and accumulate the time
|
||||||
|
foreach (IScriptModule e in engines)
|
||||||
|
{
|
||||||
|
if (e != null)
|
||||||
|
{
|
||||||
|
time += e.GetScriptExecutionTime(ids);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return time;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns a count of the number of running scripts in this groups parts.
|
/// Returns a count of the number of running scripts in this groups parts.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -222,7 +222,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void CreateScriptInstances(int startParam, bool postOnRez, string engine, int stateSource)
|
public void CreateScriptInstances(int startParam, bool postOnRez, string engine, int stateSource)
|
||||||
{
|
{
|
||||||
List<TaskInventoryItem> scripts = GetInventoryScripts();
|
List<TaskInventoryItem> scripts = GetInventoryItems(InventoryType.LSL);
|
||||||
foreach (TaskInventoryItem item in scripts)
|
foreach (TaskInventoryItem item in scripts)
|
||||||
CreateScriptInstance(item, startParam, postOnRez, engine, stateSource);
|
CreateScriptInstance(item, startParam, postOnRez, engine, stateSource);
|
||||||
}
|
}
|
||||||
|
@ -255,7 +255,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// </param>
|
/// </param>
|
||||||
public void RemoveScriptInstances(bool sceneObjectBeingDeleted)
|
public void RemoveScriptInstances(bool sceneObjectBeingDeleted)
|
||||||
{
|
{
|
||||||
List<TaskInventoryItem> scripts = GetInventoryScripts();
|
List<TaskInventoryItem> scripts = GetInventoryItems(InventoryType.LSL);
|
||||||
foreach (TaskInventoryItem item in scripts)
|
foreach (TaskInventoryItem item in scripts)
|
||||||
RemoveScriptInstance(item.ItemID, sceneObjectBeingDeleted);
|
RemoveScriptInstance(item.ItemID, sceneObjectBeingDeleted);
|
||||||
}
|
}
|
||||||
|
@ -1116,7 +1116,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
int count = 0;
|
int count = 0;
|
||||||
List<TaskInventoryItem> scripts = GetInventoryScripts();
|
List<TaskInventoryItem> scripts = GetInventoryItems(InventoryType.LSL);
|
||||||
|
|
||||||
foreach (TaskInventoryItem item in scripts)
|
foreach (TaskInventoryItem item in scripts)
|
||||||
{
|
{
|
||||||
|
@ -1157,14 +1157,14 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<TaskInventoryItem> GetInventoryScripts()
|
public List<TaskInventoryItem> GetInventoryItems(InventoryType type)
|
||||||
{
|
{
|
||||||
List<TaskInventoryItem> ret = new List<TaskInventoryItem>();
|
List<TaskInventoryItem> ret = new List<TaskInventoryItem>();
|
||||||
|
|
||||||
lock (m_items)
|
lock (m_items)
|
||||||
{
|
{
|
||||||
foreach (TaskInventoryItem item in m_items.Values)
|
foreach (TaskInventoryItem item in m_items.Values)
|
||||||
if (item.InvType == (int)InventoryType.LSL)
|
if (item.InvType == (int)type)
|
||||||
ret.Add(item);
|
ret.Add(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1183,7 +1183,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
if (engines.Length == 0) // No engine at all
|
if (engines.Length == 0) // No engine at all
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
List<TaskInventoryItem> scripts = GetInventoryScripts();
|
List<TaskInventoryItem> scripts = GetInventoryItems(InventoryType.LSL);
|
||||||
|
|
||||||
foreach (TaskInventoryItem item in scripts)
|
foreach (TaskInventoryItem item in scripts)
|
||||||
{
|
{
|
||||||
|
@ -1211,7 +1211,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
if (engines.Length == 0)
|
if (engines.Length == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
List<TaskInventoryItem> scripts = GetInventoryScripts();
|
List<TaskInventoryItem> scripts = GetInventoryItems(InventoryType.LSL);
|
||||||
|
|
||||||
foreach (TaskInventoryItem item in scripts)
|
foreach (TaskInventoryItem item in scripts)
|
||||||
{
|
{
|
||||||
|
|
|
@ -3437,6 +3437,25 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A float the value is a representative execution time in milliseconds of all scripts in all attachments.
|
||||||
|
/// </summary>
|
||||||
|
public float ScriptExecutionTime()
|
||||||
|
{
|
||||||
|
float time = 0.0f;
|
||||||
|
lock (m_attachments)
|
||||||
|
{
|
||||||
|
foreach (SceneObjectGroup gobj in m_attachments)
|
||||||
|
{
|
||||||
|
if (gobj != null)
|
||||||
|
{
|
||||||
|
time += gobj.ScriptExecutionTime();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return time;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns the total count of running scripts in all parts.
|
/// Returns the total count of running scripts in all parts.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -10367,7 +10367,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
ret.Add(new LSL_Integer(av.RunningScriptCount() * 16384));
|
ret.Add(new LSL_Integer(av.RunningScriptCount() * 16384));
|
||||||
break;
|
break;
|
||||||
case ScriptBaseClass.OBJECT_SCRIPT_TIME:
|
case ScriptBaseClass.OBJECT_SCRIPT_TIME:
|
||||||
ret.Add(new LSL_Float(0));
|
ret.Add(new LSL_Float(av.ScriptExecutionTime() / 1000.0f));
|
||||||
break;
|
break;
|
||||||
case ScriptBaseClass.OBJECT_PRIM_EQUIVALENCE:
|
case ScriptBaseClass.OBJECT_PRIM_EQUIVALENCE:
|
||||||
ret.Add(new LSL_Integer(1));
|
ret.Add(new LSL_Integer(1));
|
||||||
|
@ -10435,9 +10435,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
ret.Add(new LSL_Integer(obj.ParentGroup.RunningScriptCount() * 16384));
|
ret.Add(new LSL_Integer(obj.ParentGroup.RunningScriptCount() * 16384));
|
||||||
break;
|
break;
|
||||||
case ScriptBaseClass.OBJECT_SCRIPT_TIME:
|
case ScriptBaseClass.OBJECT_SCRIPT_TIME:
|
||||||
// Average cpu time per simulator frame expended on all scripts in the object
|
// Average cpu time in seconds per simulator frame expended on all scripts in the object
|
||||||
// Not currently available at Object level
|
ret.Add(new LSL_Float(obj.ParentGroup.ScriptExecutionTime() / 1000.0f));
|
||||||
ret.Add(new LSL_Float(0));
|
|
||||||
break;
|
break;
|
||||||
case ScriptBaseClass.OBJECT_PRIM_EQUIVALENCE:
|
case ScriptBaseClass.OBJECT_PRIM_EQUIVALENCE:
|
||||||
// according to the SL wiki A prim or linkset will have prim
|
// according to the SL wiki A prim or linkset will have prim
|
||||||
|
|
|
@ -3038,5 +3038,60 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
|
|
||||||
return ScriptBaseClass.TRUE;
|
return ScriptBaseClass.TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Sets terrain estate texture
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="level"></param>
|
||||||
|
/// <param name="texture"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public void osSetTerrainTexture(int level, LSL_Key texture)
|
||||||
|
{
|
||||||
|
CheckThreatLevel(ThreatLevel.High, "osSetTerrainTexture");
|
||||||
|
|
||||||
|
m_host.AddScriptLPS(1);
|
||||||
|
//Check to make sure that the script's owner is the estate manager/master
|
||||||
|
//World.Permissions.GenericEstatePermission(
|
||||||
|
if (World.Permissions.IsGod(m_host.OwnerID))
|
||||||
|
{
|
||||||
|
if (level < 0 || level > 3)
|
||||||
|
return;
|
||||||
|
|
||||||
|
UUID textureID = new UUID();
|
||||||
|
if (!UUID.TryParse(texture, out textureID))
|
||||||
|
return;
|
||||||
|
|
||||||
|
// estate module is required
|
||||||
|
IEstateModule estate = World.RequestModuleInterface<IEstateModule>();
|
||||||
|
if (estate != null)
|
||||||
|
estate.setEstateTerrainBaseTexture(level, textureID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Sets terrain heights of estate
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="corner"></param>
|
||||||
|
/// <param name="low"></param>
|
||||||
|
/// <param name="high"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public void osSetTerrainTextureHeight(int corner, double low, double high)
|
||||||
|
{
|
||||||
|
CheckThreatLevel(ThreatLevel.High, "osSetTerrainTextureHeight");
|
||||||
|
|
||||||
|
m_host.AddScriptLPS(1);
|
||||||
|
//Check to make sure that the script's owner is the estate manager/master
|
||||||
|
//World.Permissions.GenericEstatePermission(
|
||||||
|
if (World.Permissions.IsGod(m_host.OwnerID))
|
||||||
|
{
|
||||||
|
if (corner < 0 || corner > 3)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// estate module is required
|
||||||
|
IEstateModule estate = World.RequestModuleInterface<IEstateModule>();
|
||||||
|
if (estate != null)
|
||||||
|
estate.setEstateTerrainTextureHeights(corner, (float)low, (float)high);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -234,5 +234,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
|
||||||
|
|
||||||
LSL_Integer osInviteToGroup(LSL_Key agentId);
|
LSL_Integer osInviteToGroup(LSL_Key agentId);
|
||||||
LSL_Integer osEjectFromGroup(LSL_Key agentId);
|
LSL_Integer osEjectFromGroup(LSL_Key agentId);
|
||||||
|
|
||||||
|
void osSetTerrainTexture(int level, LSL_Key texture);
|
||||||
|
void osSetTerrainTextureHeight(int corner, double low, double high);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -878,5 +878,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
||||||
{
|
{
|
||||||
return m_OSSL_Functions.osEjectFromGroup(agentId);
|
return m_OSSL_Functions.osEjectFromGroup(agentId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void osSetTerrainTexture(int level, LSL_Key texture)
|
||||||
|
{
|
||||||
|
m_OSSL_Functions.osSetTerrainTexture(level, texture);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void osSetTerrainTextureHeight(int corner, double low, double high)
|
||||||
|
{
|
||||||
|
m_OSSL_Functions.osSetTerrainTextureHeight(corner, low, high);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1907,47 +1907,61 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
if (!topScripts.ContainsKey(si.LocalID))
|
if (!topScripts.ContainsKey(si.LocalID))
|
||||||
topScripts[si.RootLocalID] = 0;
|
topScripts[si.RootLocalID] = 0;
|
||||||
|
|
||||||
// long ticksElapsed = tickNow - si.MeasurementPeriodTickStart;
|
topScripts[si.RootLocalID] += CalculateAdjustedExectionTime(si, tickNow);
|
||||||
// float framesElapsed = ticksElapsed / (18.1818 * TimeSpan.TicksPerMillisecond);
|
|
||||||
|
|
||||||
// Execution time of the script adjusted by it's measurement period to make scripts started at
|
|
||||||
// different times comparable.
|
|
||||||
// float adjustedExecutionTime
|
|
||||||
// = (float)si.MeasurementPeriodExecutionTime
|
|
||||||
// / ((float)(tickNow - si.MeasurementPeriodTickStart) / ScriptInstance.MaxMeasurementPeriod)
|
|
||||||
// / TimeSpan.TicksPerMillisecond;
|
|
||||||
|
|
||||||
long ticksElapsed = tickNow - si.MeasurementPeriodTickStart;
|
|
||||||
|
|
||||||
// Avoid divide by zerp
|
|
||||||
if (ticksElapsed == 0)
|
|
||||||
ticksElapsed = 1;
|
|
||||||
|
|
||||||
// Scale execution time to the ideal 55 fps frame time for these reasons.
|
|
||||||
//
|
|
||||||
// 1) XEngine does not execute scripts per frame, unlike other script engines. Hence, there is no
|
|
||||||
// 'script execution time per frame', which is the original purpose of this value.
|
|
||||||
//
|
|
||||||
// 2) Giving the raw execution times is misleading since scripts start at different times, making
|
|
||||||
// it impossible to compare scripts.
|
|
||||||
//
|
|
||||||
// 3) Scaling the raw execution time to the time that the script has been running is better but
|
|
||||||
// is still misleading since a script that has just been rezzed may appear to have been running
|
|
||||||
// for much longer.
|
|
||||||
//
|
|
||||||
// 4) Hence, we scale execution time to an idealised frame time (55 fps). This is also not perfect
|
|
||||||
// since the figure does not represent actual execution time and very hard running scripts will
|
|
||||||
// never exceed 18ms (though this is a very high number for script execution so is a warning sign).
|
|
||||||
float adjustedExecutionTime
|
|
||||||
= ((float)si.MeasurementPeriodExecutionTime / ticksElapsed) * 18.1818f;
|
|
||||||
|
|
||||||
topScripts[si.RootLocalID] += adjustedExecutionTime;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return topScripts;
|
return topScripts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public float GetScriptExecutionTime(List<UUID> itemIDs)
|
||||||
|
{
|
||||||
|
if (itemIDs == null|| itemIDs.Count == 0)
|
||||||
|
{
|
||||||
|
return 0.0f;
|
||||||
|
}
|
||||||
|
float time = 0.0f;
|
||||||
|
long tickNow = Util.EnvironmentTickCount();
|
||||||
|
IScriptInstance si;
|
||||||
|
// Calculate the time for all scripts that this engine is executing
|
||||||
|
// Ignore any others
|
||||||
|
foreach (UUID id in itemIDs)
|
||||||
|
{
|
||||||
|
si = GetInstance(id);
|
||||||
|
if (si != null && si.Running)
|
||||||
|
{
|
||||||
|
time += CalculateAdjustedExectionTime(si, tickNow);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return time;
|
||||||
|
}
|
||||||
|
|
||||||
|
private float CalculateAdjustedExectionTime(IScriptInstance si, long tickNow)
|
||||||
|
{
|
||||||
|
long ticksElapsed = tickNow - si.MeasurementPeriodTickStart;
|
||||||
|
|
||||||
|
// Avoid divide by zero
|
||||||
|
if (ticksElapsed == 0)
|
||||||
|
ticksElapsed = 1;
|
||||||
|
|
||||||
|
// Scale execution time to the ideal 55 fps frame time for these reasons.
|
||||||
|
//
|
||||||
|
// 1) XEngine does not execute scripts per frame, unlike other script engines. Hence, there is no
|
||||||
|
// 'script execution time per frame', which is the original purpose of this value.
|
||||||
|
//
|
||||||
|
// 2) Giving the raw execution times is misleading since scripts start at different times, making
|
||||||
|
// it impossible to compare scripts.
|
||||||
|
//
|
||||||
|
// 3) Scaling the raw execution time to the time that the script has been running is better but
|
||||||
|
// is still misleading since a script that has just been rezzed may appear to have been running
|
||||||
|
// for much longer.
|
||||||
|
//
|
||||||
|
// 4) Hence, we scale execution time to an idealised frame time (55 fps). This is also not perfect
|
||||||
|
// since the figure does not represent actual execution time and very hard running scripts will
|
||||||
|
// never exceed 18ms (though this is a very high number for script execution so is a warning sign).
|
||||||
|
return ((float)si.MeasurementPeriodExecutionTime / ticksElapsed) * 18.1818f;
|
||||||
|
}
|
||||||
|
|
||||||
public void SuspendScript(UUID itemID)
|
public void SuspendScript(UUID itemID)
|
||||||
{
|
{
|
||||||
// m_log.DebugFormat("[XEngine]: Received request to suspend script with ID {0}", itemID);
|
// m_log.DebugFormat("[XEngine]: Received request to suspend script with ID {0}", itemID);
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
|
|
||||||
; How often {in hours} should the disk be checked for expired filed
|
; How often {in hours} should the disk be checked for expired filed
|
||||||
; Specify 0 to disable expiration checking
|
; Specify 0 to disable expiration checking
|
||||||
FileCleanupTimer = .166 ;roughly every 10 minutes
|
FileCleanupTimer = 1.0 ;every hour
|
||||||
|
|
||||||
; If WAIT_ON_INPROGRESS_REQUESTS has been defined then this specifies how
|
; If WAIT_ON_INPROGRESS_REQUESTS has been defined then this specifies how
|
||||||
; long (in miliseconds) to block a request thread while trying to complete
|
; long (in miliseconds) to block a request thread while trying to complete
|
||||||
|
@ -60,4 +60,4 @@
|
||||||
; cache, and request all assets that are found that are not already cached (this
|
; cache, and request all assets that are found that are not already cached (this
|
||||||
; will cause those assets to be cached)
|
; will cause those assets to be cached)
|
||||||
;
|
;
|
||||||
; DeepScanBeforePurge = false
|
DeepScanBeforePurge = true
|
||||||
|
|
|
@ -137,6 +137,10 @@
|
||||||
;; uncomment the next line. You may want to do this on sims that have licensed content.
|
;; uncomment the next line. You may want to do this on sims that have licensed content.
|
||||||
; OutboundPermission = False
|
; OutboundPermission = False
|
||||||
|
|
||||||
|
[HGFriendsModule]
|
||||||
|
; User level required to be able to send friendship invitations to foreign users
|
||||||
|
;LevelHGFriends = 0;
|
||||||
|
|
||||||
[UserAgentService]
|
[UserAgentService]
|
||||||
;
|
;
|
||||||
; === HG ONLY ===
|
; === HG ONLY ===
|
||||||
|
|
|
@ -61,6 +61,10 @@
|
||||||
;; uncomment the next line. You may want to do this on sims that have licensed content.
|
;; uncomment the next line. You may want to do this on sims that have licensed content.
|
||||||
; OutboundPermission = False
|
; OutboundPermission = False
|
||||||
|
|
||||||
|
[HGFriendsModule]
|
||||||
|
; User level required to be able to send friendship invitations to foreign users
|
||||||
|
;LevelHGFriends = 0;
|
||||||
|
|
||||||
[GridService]
|
[GridService]
|
||||||
;; For in-memory region storage (default)
|
;; For in-memory region storage (default)
|
||||||
StorageProvider = "OpenSim.Data.Null.dll:NullRegionData"
|
StorageProvider = "OpenSim.Data.Null.dll:NullRegionData"
|
||||||
|
|
Loading…
Reference in New Issue