Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
commit
05bb2e4275
|
@ -26,8 +26,8 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using OpenMetaverse.StructuredData;
|
using OpenMetaverse.StructuredData;
|
||||||
|
|
||||||
|
@ -46,8 +46,12 @@ namespace OpenSim.Framework.Statistics
|
||||||
sb.Append(Environment.NewLine);
|
sb.Append(Environment.NewLine);
|
||||||
sb.Append(
|
sb.Append(
|
||||||
string.Format(
|
string.Format(
|
||||||
"Allocated to OpenSim : {0} MB" + Environment.NewLine,
|
"Allocated to OpenSim objects: {0} MB\n",
|
||||||
Math.Round(GC.GetTotalMemory(false) / 1024.0 / 1024.0)));
|
Math.Round(GC.GetTotalMemory(false) / 1024.0 / 1024.0)));
|
||||||
|
sb.Append(
|
||||||
|
string.Format(
|
||||||
|
"Process memory : {0} MB\n",
|
||||||
|
Math.Round(Process.GetCurrentProcess().WorkingSet64 / 1024.0 / 1024.0)));
|
||||||
|
|
||||||
return sb.ToString();
|
return sb.ToString();
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,12 +81,15 @@ namespace OpenSim.Framework
|
||||||
|
|
||||||
private static uint nextXferID = 5000;
|
private static uint nextXferID = 5000;
|
||||||
private static Random randomClass = new Random();
|
private static Random randomClass = new Random();
|
||||||
|
|
||||||
// Get a list of invalid file characters (OS dependent)
|
// Get a list of invalid file characters (OS dependent)
|
||||||
private static string regexInvalidFileChars = "[" + new String(Path.GetInvalidFileNameChars()) + "]";
|
private static string regexInvalidFileChars = "[" + new String(Path.GetInvalidFileNameChars()) + "]";
|
||||||
private static string regexInvalidPathChars = "[" + new String(Path.GetInvalidPathChars()) + "]";
|
private static string regexInvalidPathChars = "[" + new String(Path.GetInvalidPathChars()) + "]";
|
||||||
private static object XferLock = new object();
|
private static object XferLock = new object();
|
||||||
/// <summary>Thread pool used for Util.FireAndForget if
|
|
||||||
/// FireAndForgetMethod.SmartThreadPool is used</summary>
|
/// <summary>
|
||||||
|
/// Thread pool used for Util.FireAndForget if FireAndForgetMethod.SmartThreadPool is used
|
||||||
|
/// </summary>
|
||||||
private static SmartThreadPool m_ThreadPool;
|
private static SmartThreadPool m_ThreadPool;
|
||||||
|
|
||||||
// Unix-epoch starts at January 1st 1970, 00:00:00 UTC. And all our times in the server are (or at least should be) in UTC.
|
// Unix-epoch starts at January 1st 1970, 00:00:00 UTC. And all our times in the server are (or at least should be) in UTC.
|
||||||
|
|
|
@ -503,7 +503,11 @@ namespace OpenSim
|
||||||
string currentCommand;
|
string currentCommand;
|
||||||
while ((currentCommand = readFile.ReadLine()) != null)
|
while ((currentCommand = readFile.ReadLine()) != null)
|
||||||
{
|
{
|
||||||
if (currentCommand != String.Empty)
|
currentCommand = currentCommand.Trim();
|
||||||
|
if (!(currentCommand == ""
|
||||||
|
|| currentCommand.StartsWith(";")
|
||||||
|
|| currentCommand.StartsWith("//")
|
||||||
|
|| currentCommand.StartsWith("#")))
|
||||||
{
|
{
|
||||||
m_log.Info("[COMMANDFILE]: Running '" + currentCommand + "'");
|
m_log.Info("[COMMANDFILE]: Running '" + currentCommand + "'");
|
||||||
m_console.RunCommand(currentCommand);
|
m_console.RunCommand(currentCommand);
|
||||||
|
|
|
@ -26,8 +26,10 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Security;
|
using System.Security;
|
||||||
using log4net;
|
using log4net;
|
||||||
|
@ -45,8 +47,6 @@ namespace OpenSim.Region.CoreModules.World.Estate
|
||||||
{
|
{
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
private delegate void LookupUUIDS(List<UUID> uuidLst);
|
|
||||||
|
|
||||||
public Scene Scene { get; private set; }
|
public Scene Scene { get; private set; }
|
||||||
public IUserManagement UserManager { get; private set; }
|
public IUserManagement UserManager { get; private set; }
|
||||||
|
|
||||||
|
@ -876,98 +876,77 @@ namespace OpenSim.Region.CoreModules.World.Estate
|
||||||
if (!Scene.Permissions.CanIssueEstateCommand(remoteClient.AgentId, false))
|
if (!Scene.Permissions.CanIssueEstateCommand(remoteClient.AgentId, false))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Dictionary<uint, float> SceneData = new Dictionary<uint,float>();
|
Dictionary<uint, float> sceneData = null;
|
||||||
List<UUID> uuidNameLookupList = new List<UUID>();
|
List<UUID> uuidNameLookupList = new List<UUID>();
|
||||||
|
|
||||||
if (reportType == 1)
|
if (reportType == 1)
|
||||||
{
|
{
|
||||||
SceneData = Scene.PhysicsScene.GetTopColliders();
|
sceneData = Scene.PhysicsScene.GetTopColliders();
|
||||||
}
|
}
|
||||||
else if (reportType == 0)
|
else if (reportType == 0)
|
||||||
{
|
{
|
||||||
SceneData = Scene.SceneGraph.GetTopScripts();
|
IScriptModule scriptModule = Scene.RequestModuleInterface<IScriptModule>();
|
||||||
|
|
||||||
|
if (scriptModule != null)
|
||||||
|
sceneData = scriptModule.GetObjectScriptsExecutionTimes();
|
||||||
}
|
}
|
||||||
|
|
||||||
List<LandStatReportItem> SceneReport = new List<LandStatReportItem>();
|
List<LandStatReportItem> SceneReport = new List<LandStatReportItem>();
|
||||||
lock (SceneData)
|
if (sceneData != null)
|
||||||
{
|
{
|
||||||
foreach (uint obj in SceneData.Keys)
|
var sortedSceneData
|
||||||
|
= sceneData.Select(
|
||||||
|
item => new { Measurement = item.Value, Part = Scene.GetSceneObjectPart(item.Key) });
|
||||||
|
|
||||||
|
sortedSceneData.OrderBy(item => item.Measurement);
|
||||||
|
|
||||||
|
int items = 0;
|
||||||
|
|
||||||
|
foreach (var entry in sortedSceneData)
|
||||||
{
|
{
|
||||||
SceneObjectPart prt = Scene.GetSceneObjectPart(obj);
|
// The object may have been deleted since we received the data.
|
||||||
if (prt != null)
|
if (entry.Part == null)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// Don't show scripts that haven't executed or where execution time is below one microsecond in
|
||||||
|
// order to produce a more readable report.
|
||||||
|
if (entry.Measurement < 0.001)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
items++;
|
||||||
|
SceneObjectGroup so = entry.Part.ParentGroup;
|
||||||
|
|
||||||
|
LandStatReportItem lsri = new LandStatReportItem();
|
||||||
|
lsri.LocationX = so.AbsolutePosition.X;
|
||||||
|
lsri.LocationY = so.AbsolutePosition.Y;
|
||||||
|
lsri.LocationZ = so.AbsolutePosition.Z;
|
||||||
|
lsri.Score = entry.Measurement;
|
||||||
|
lsri.TaskID = so.UUID;
|
||||||
|
lsri.TaskLocalID = so.LocalId;
|
||||||
|
lsri.TaskName = entry.Part.Name;
|
||||||
|
lsri.OwnerName = UserManager.GetUserName(so.OwnerID);
|
||||||
|
|
||||||
|
if (filter.Length != 0)
|
||||||
{
|
{
|
||||||
SceneObjectGroup sog = prt.ParentGroup;
|
if ((lsri.OwnerName.Contains(filter) || lsri.TaskName.Contains(filter)))
|
||||||
LandStatReportItem lsri = new LandStatReportItem();
|
|
||||||
lsri.LocationX = sog.AbsolutePosition.X;
|
|
||||||
lsri.LocationY = sog.AbsolutePosition.Y;
|
|
||||||
lsri.LocationZ = sog.AbsolutePosition.Z;
|
|
||||||
lsri.Score = SceneData[obj];
|
|
||||||
lsri.TaskID = sog.UUID;
|
|
||||||
lsri.TaskLocalID = sog.LocalId;
|
|
||||||
lsri.TaskName = sog.GetPartName(obj);
|
|
||||||
lsri.OwnerName = "waiting";
|
|
||||||
lock (uuidNameLookupList)
|
|
||||||
uuidNameLookupList.Add(sog.OwnerID);
|
|
||||||
|
|
||||||
if (filter.Length != 0)
|
|
||||||
{
|
{
|
||||||
if ((lsri.OwnerName.Contains(filter) || lsri.TaskName.Contains(filter)))
|
|
||||||
{
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
SceneReport.Add(lsri);
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SceneReport.Add(lsri);
|
||||||
|
|
||||||
|
if (items >= 100)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
remoteClient.SendLandStatReply(reportType, requestFlags, (uint)SceneReport.Count,SceneReport.ToArray());
|
remoteClient.SendLandStatReply(reportType, requestFlags, (uint)SceneReport.Count,SceneReport.ToArray());
|
||||||
|
|
||||||
if (uuidNameLookupList.Count > 0)
|
|
||||||
LookupUUID(uuidNameLookupList);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void LookupUUIDSCompleted(IAsyncResult iar)
|
|
||||||
{
|
|
||||||
LookupUUIDS icon = (LookupUUIDS)iar.AsyncState;
|
|
||||||
icon.EndInvoke(iar);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void LookupUUID(List<UUID> uuidLst)
|
|
||||||
{
|
|
||||||
LookupUUIDS d = LookupUUIDsAsync;
|
|
||||||
|
|
||||||
d.BeginInvoke(uuidLst,
|
|
||||||
LookupUUIDSCompleted,
|
|
||||||
d);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void LookupUUIDsAsync(List<UUID> uuidLst)
|
|
||||||
{
|
|
||||||
UUID[] uuidarr;
|
|
||||||
|
|
||||||
lock (uuidLst)
|
|
||||||
{
|
|
||||||
uuidarr = uuidLst.ToArray();
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 0; i < uuidarr.Length; i++)
|
|
||||||
{
|
|
||||||
// string lookupname = m_scene.CommsManager.UUIDNameRequestString(uuidarr[i]);
|
|
||||||
|
|
||||||
IUserManagement userManager = Scene.RequestModuleInterface<IUserManagement>();
|
|
||||||
if (userManager != null)
|
|
||||||
userManager.GetUserName(uuidarr[i]);
|
|
||||||
|
|
||||||
// we drop it. It gets cached though... so we're ready for the next request.
|
|
||||||
// diva commnent 11/21/2010: uh?!? wft?
|
|
||||||
// justincc comment 21/01/2011: A side effect of userManager.GetUserName() I presume.
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Outgoing Packets
|
#region Outgoing Packets
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
|
|
||||||
namespace OpenSim.Region.Framework.Interfaces
|
namespace OpenSim.Region.Framework.Interfaces
|
||||||
|
@ -74,5 +75,14 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||||
/// Starts the processing threads.
|
/// Starts the processing threads.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void StartProcessing();
|
void StartProcessing();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get the execution times of all scripts in each object.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>
|
||||||
|
/// A dictionary where the key is the root object ID of a linkset
|
||||||
|
/// and the value is a representative execution time in milliseconds of all scripts in that linkset.
|
||||||
|
/// </returns>
|
||||||
|
Dictionary<uint, float> GetObjectScriptsExecutionTimes();
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -733,6 +733,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Get Methods
|
#region Get Methods
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get the controlling client for the given avatar, if there is one.
|
/// Get the controlling client for the given avatar, if there is one.
|
||||||
///
|
///
|
||||||
|
@ -1074,36 +1075,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
return Entities.GetEntities();
|
return Entities.GetEntities();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Dictionary<uint, float> GetTopScripts()
|
|
||||||
{
|
|
||||||
Dictionary<uint, float> topScripts = new Dictionary<uint, float>();
|
|
||||||
|
|
||||||
EntityBase[] EntityList = GetEntities();
|
|
||||||
int limit = 0;
|
|
||||||
foreach (EntityBase ent in EntityList)
|
|
||||||
{
|
|
||||||
if (ent is SceneObjectGroup)
|
|
||||||
{
|
|
||||||
SceneObjectGroup grp = (SceneObjectGroup)ent;
|
|
||||||
if ((grp.RootPart.GetEffectiveObjectFlags() & (uint)PrimFlags.Scripted) != 0)
|
|
||||||
{
|
|
||||||
if (grp.scriptScore >= 0.01)
|
|
||||||
{
|
|
||||||
topScripts.Add(grp.LocalId, grp.scriptScore);
|
|
||||||
limit++;
|
|
||||||
if (limit >= 100)
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
grp.scriptScore = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return topScripts;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Other Methods
|
#region Other Methods
|
||||||
|
|
|
@ -229,8 +229,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
get { return RootPart.VolumeDetectActive; }
|
get { return RootPart.VolumeDetectActive; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public float scriptScore;
|
|
||||||
|
|
||||||
private Vector3 lastPhysGroupPos;
|
private Vector3 lastPhysGroupPos;
|
||||||
private Quaternion lastPhysGroupRot;
|
private Quaternion lastPhysGroupRot;
|
||||||
|
|
||||||
|
@ -1184,12 +1182,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
public void AddScriptLPS(int count)
|
public void AddScriptLPS(int count)
|
||||||
{
|
{
|
||||||
if (scriptScore + count >= float.MaxValue - count)
|
m_scene.SceneGraph.AddToScriptLPS(count);
|
||||||
scriptScore = 0;
|
|
||||||
|
|
||||||
scriptScore += (float)count;
|
|
||||||
SceneGraph d = m_scene.SceneGraph;
|
|
||||||
d.AddToScriptLPS(count);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddActiveScriptCount(int count)
|
public void AddActiveScriptCount(int count)
|
||||||
|
|
|
@ -78,12 +78,38 @@ namespace OpenSim.Region.ScriptEngine.Interfaces
|
||||||
/// </summary>
|
/// </summary>
|
||||||
string State { get; set; }
|
string State { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Time the script was last started
|
||||||
|
/// </summary>
|
||||||
|
DateTime TimeStarted { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Tick the last measurement period was started.
|
||||||
|
/// </summary>
|
||||||
|
long MeasurementPeriodTickStart { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Ticks spent executing in the last measurement period.
|
||||||
|
/// </summary>
|
||||||
|
long MeasurementPeriodExecutionTime { get; }
|
||||||
|
|
||||||
IScriptEngine Engine { get; }
|
IScriptEngine Engine { get; }
|
||||||
UUID AppDomain { get; set; }
|
UUID AppDomain { get; set; }
|
||||||
string PrimName { get; }
|
string PrimName { get; }
|
||||||
string ScriptName { get; }
|
string ScriptName { get; }
|
||||||
UUID ItemID { get; }
|
UUID ItemID { get; }
|
||||||
UUID ObjectID { get; }
|
UUID ObjectID { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// UUID of the root object for the linkset that the script is in.
|
||||||
|
/// </summary>
|
||||||
|
UUID RootObjectID { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Local id of the root object for the linkset that the script is in.
|
||||||
|
/// </summary>
|
||||||
|
uint RootLocalID { get; }
|
||||||
|
|
||||||
uint LocalID { get; }
|
uint LocalID { get; }
|
||||||
UUID AssetID { get; }
|
UUID AssetID { get; }
|
||||||
Queue EventQueue { get; }
|
Queue EventQueue { get; }
|
||||||
|
|
|
@ -164,6 +164,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
||||||
|
|
||||||
public uint LocalID { get; private set; }
|
public uint LocalID { get; private set; }
|
||||||
|
|
||||||
|
public UUID RootObjectID { get; private set; }
|
||||||
|
|
||||||
|
public uint RootLocalID { get; private set; }
|
||||||
|
|
||||||
public UUID AssetID { get; private set; }
|
public UUID AssetID { get; private set; }
|
||||||
|
|
||||||
public Queue EventQueue { get; private set; }
|
public Queue EventQueue { get; private set; }
|
||||||
|
@ -172,6 +176,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
||||||
|
|
||||||
public TaskInventoryItem ScriptTask { get; private set; }
|
public TaskInventoryItem ScriptTask { get; private set; }
|
||||||
|
|
||||||
|
public DateTime TimeStarted { get; private set; }
|
||||||
|
|
||||||
|
public long MeasurementPeriodTickStart { get; private set; }
|
||||||
|
|
||||||
|
public long MeasurementPeriodExecutionTime { get; private set; }
|
||||||
|
|
||||||
|
public static readonly long MaxMeasurementPeriod = 30 * TimeSpan.TicksPerMinute;
|
||||||
|
|
||||||
public void ClearQueue()
|
public void ClearQueue()
|
||||||
{
|
{
|
||||||
m_TimerQueued = false;
|
m_TimerQueued = false;
|
||||||
|
@ -190,6 +202,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
||||||
Engine = engine;
|
Engine = engine;
|
||||||
LocalID = part.LocalId;
|
LocalID = part.LocalId;
|
||||||
ObjectID = part.UUID;
|
ObjectID = part.UUID;
|
||||||
|
RootLocalID = part.ParentGroup.LocalId;
|
||||||
|
RootObjectID = part.ParentGroup.UUID;
|
||||||
ItemID = itemID;
|
ItemID = itemID;
|
||||||
AssetID = assetID;
|
AssetID = assetID;
|
||||||
PrimName = primName;
|
PrimName = primName;
|
||||||
|
@ -458,6 +472,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
||||||
|
|
||||||
Running = true;
|
Running = true;
|
||||||
|
|
||||||
|
TimeStarted = DateTime.Now;
|
||||||
|
MeasurementPeriodTickStart = Util.EnvironmentTickCount();
|
||||||
|
MeasurementPeriodExecutionTime = 0;
|
||||||
|
|
||||||
if (EventQueue.Count > 0)
|
if (EventQueue.Count > 0)
|
||||||
{
|
{
|
||||||
if (m_CurrentWorkItem == null)
|
if (m_CurrentWorkItem == null)
|
||||||
|
@ -710,8 +728,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
||||||
m_EventStart = DateTime.Now;
|
m_EventStart = DateTime.Now;
|
||||||
m_InEvent = true;
|
m_InEvent = true;
|
||||||
|
|
||||||
|
int start = Util.EnvironmentTickCount();
|
||||||
|
|
||||||
|
// Reset the measurement period when we reach the end of the current one.
|
||||||
|
if (start - MeasurementPeriodTickStart > MaxMeasurementPeriod)
|
||||||
|
MeasurementPeriodTickStart = start;
|
||||||
|
|
||||||
m_Script.ExecuteEvent(State, data.EventName, data.Params);
|
m_Script.ExecuteEvent(State, data.EventName, data.Params);
|
||||||
|
|
||||||
|
MeasurementPeriodExecutionTime += Util.EnvironmentTickCount() - start;
|
||||||
|
|
||||||
m_InEvent = false;
|
m_InEvent = false;
|
||||||
m_CurrentEvent = String.Empty;
|
m_CurrentEvent = String.Empty;
|
||||||
|
|
||||||
|
@ -720,7 +746,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
||||||
// This will be the very first event we deliver
|
// This will be the very first event we deliver
|
||||||
// (state_entry) in default state
|
// (state_entry) in default state
|
||||||
//
|
//
|
||||||
|
|
||||||
SaveState(m_Assembly);
|
SaveState(m_Assembly);
|
||||||
|
|
||||||
m_SaveState = false;
|
m_SaveState = false;
|
||||||
|
|
|
@ -1083,7 +1083,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
|
|
||||||
if (!m_PrimObjects[localID].Contains(itemID))
|
if (!m_PrimObjects[localID].Contains(itemID))
|
||||||
m_PrimObjects[localID].Add(itemID);
|
m_PrimObjects[localID].Add(itemID);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!m_Assemblies.ContainsKey(assetID))
|
if (!m_Assemblies.ContainsKey(assetID))
|
||||||
|
@ -1891,6 +1890,59 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Dictionary<uint, float> GetObjectScriptsExecutionTimes()
|
||||||
|
{
|
||||||
|
long tickNow = Util.EnvironmentTickCount();
|
||||||
|
Dictionary<uint, float> topScripts = new Dictionary<uint, float>();
|
||||||
|
|
||||||
|
lock (m_Scripts)
|
||||||
|
{
|
||||||
|
foreach (IScriptInstance si in m_Scripts.Values)
|
||||||
|
{
|
||||||
|
if (!topScripts.ContainsKey(si.LocalID))
|
||||||
|
topScripts[si.RootLocalID] = 0;
|
||||||
|
|
||||||
|
// long ticksElapsed = tickNow - si.MeasurementPeriodTickStart;
|
||||||
|
// 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;
|
||||||
|
}
|
||||||
|
|
||||||
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);
|
||||||
|
|
|
@ -1,104 +0,0 @@
|
||||||
// autogenerated by generate_default_lsl.rb
|
|
||||||
integer touch_count = 0;
|
|
||||||
|
|
||||||
default {
|
|
||||||
touch_start(integer total_number) {
|
|
||||||
float angle45 = PI/4.0; // 45 degrees
|
|
||||||
float angle30 = PI/6.0; // 30 degrees
|
|
||||||
float sqrt2 = llSqrt(2.0);
|
|
||||||
if((llFabs(-1.5) != 1.5) || (llFabs(10.4) != 10.4)) {
|
|
||||||
llShout(0, "Houston, we have a big problem! llFabs() does not work! Need it for other tests!");
|
|
||||||
}
|
|
||||||
llSetText("This is a text by llSetText", <1,0,0>, 1);
|
|
||||||
llWhisper(0, "llWhispering a few random numbers between 0 and 100: " + llFrand(100) + "," + llFrand(100) + "," + llFrand(100) + "," + llFrand(100));
|
|
||||||
llShout(0, "llShouting the unix time: " + llGetUnixTime() + ", and region corner: " + llGetRegionCorner());
|
|
||||||
llShout(1, "Shouting a random number between 0 and 100 on the channel#1: " + llFrand(100));
|
|
||||||
if (llAbs(-1) != 1) {
|
|
||||||
llSay(0, "Assert failed: llAbs(-1) != 1");
|
|
||||||
}
|
|
||||||
if (llAbs(10) != 10) {
|
|
||||||
llSay(0, "Assert failed: llAbs(10) != 10");
|
|
||||||
}
|
|
||||||
if (llFabs((llCos(angle45) - sqrt2/2.0) - 0) > 0.000001) {
|
|
||||||
llSay(0, "Assert failed: (llCos(angle45) - sqrt2/2.0) differs from 0 by more than 0.000001");
|
|
||||||
llSay(0, " --> The actual result: " + (llCos(angle45) - sqrt2/2.0));
|
|
||||||
}
|
|
||||||
if (llFabs((llSin(angle30) - 0.5) - 0) > 0.000001) {
|
|
||||||
llSay(0, "Assert failed: (llSin(angle30) - 0.5) differs from 0 by more than 0.000001");
|
|
||||||
llSay(0, " --> The actual result: " + (llSin(angle30) - 0.5));
|
|
||||||
}
|
|
||||||
if (llFabs((llAtan2(1, 1)*4 - PI) - 0) > 0.000001) {
|
|
||||||
llSay(0, "Assert failed: (llAtan2(1, 1)*4 - PI) differs from 0 by more than 0.000001");
|
|
||||||
llSay(0, " --> The actual result: " + (llAtan2(1, 1)*4 - PI));
|
|
||||||
}
|
|
||||||
if (llFabs((llTan(PI)) - 0) > 0.000001) {
|
|
||||||
llSay(0, "Assert failed: (llTan(PI)) differs from 0 by more than 0.000001");
|
|
||||||
llSay(0, " --> The actual result: " + (llTan(PI)));
|
|
||||||
}
|
|
||||||
if (llFloor(2.4) != 2) {
|
|
||||||
llSay(0, "Assert failed: llFloor(2.4) != 2");
|
|
||||||
}
|
|
||||||
if (llCeil(2.4) != 3) {
|
|
||||||
llSay(0, "Assert failed: llCeil(2.4) != 3");
|
|
||||||
}
|
|
||||||
if (llRound(2.4) != 2) {
|
|
||||||
llSay(0, "Assert failed: llRound(2.4) != 2");
|
|
||||||
}
|
|
||||||
if (llFloor(2.5) != 2) {
|
|
||||||
llSay(0, "Assert failed: llFloor(2.5) != 2");
|
|
||||||
}
|
|
||||||
if (llCeil(2.5) != 3) {
|
|
||||||
llSay(0, "Assert failed: llCeil(2.5) != 3");
|
|
||||||
}
|
|
||||||
if (llRound(2.5) != 3) {
|
|
||||||
llSay(0, "Assert failed: llRound(2.5) != 3");
|
|
||||||
}
|
|
||||||
if (llFloor(2.51) != 2) {
|
|
||||||
llSay(0, "Assert failed: llFloor(2.51) != 2");
|
|
||||||
}
|
|
||||||
if (llCeil(2.51) != 3) {
|
|
||||||
llSay(0, "Assert failed: llCeil(2.51) != 3");
|
|
||||||
}
|
|
||||||
if (llRound(2.51) != 3) {
|
|
||||||
llSay(0, "Assert failed: llRound(2.51) != 3");
|
|
||||||
}
|
|
||||||
if (llFloor(3.49) != 3) {
|
|
||||||
llSay(0, "Assert failed: llFloor(3.49) != 3");
|
|
||||||
}
|
|
||||||
if (llCeil(3.49) != 4) {
|
|
||||||
llSay(0, "Assert failed: llCeil(3.49) != 4");
|
|
||||||
}
|
|
||||||
if (llRound(3.49) != 3) {
|
|
||||||
llSay(0, "Assert failed: llRound(3.49) != 3");
|
|
||||||
}
|
|
||||||
if (llFloor(3.5000001) != 3) {
|
|
||||||
llSay(0, "Assert failed: llFloor(3.5000001) != 3");
|
|
||||||
}
|
|
||||||
if (llCeil(3.5000001) != 4) {
|
|
||||||
llSay(0, "Assert failed: llCeil(3.5000001) != 4");
|
|
||||||
}
|
|
||||||
if (llRound(3.5000001) != 4) {
|
|
||||||
llSay(0, "Assert failed: llRound(3.5000001) != 4");
|
|
||||||
}
|
|
||||||
if (llFloor(3.51) != 3) {
|
|
||||||
llSay(0, "Assert failed: llFloor(3.51) != 3");
|
|
||||||
}
|
|
||||||
if (llCeil(3.51) != 4) {
|
|
||||||
llSay(0, "Assert failed: llCeil(3.51) != 4");
|
|
||||||
}
|
|
||||||
if (llRound(3.51) != 4) {
|
|
||||||
llSay(0, "Assert failed: llRound(3.51) != 4");
|
|
||||||
}
|
|
||||||
if ((llFabs(0-llPow(2, 16))) != 65536) {
|
|
||||||
llSay(0, "Assert failed: (llFabs(0-llPow(2, 16))) != 65536");
|
|
||||||
}
|
|
||||||
if (llMD5String("Hello, Avatar!",0) != "112abd47ceaae1c05a826828650434a6") {
|
|
||||||
llSay(0, "Assert failed: llMD5String('Hello, Avatar!',0) != '112abd47ceaae1c05a826828650434a6'");
|
|
||||||
}
|
|
||||||
if (llModPow(2, 16, 37) != 9) {
|
|
||||||
llSay(0, "Assert failed: llModPow(2, 16, 37) != 9");
|
|
||||||
}
|
|
||||||
touch_count++;
|
|
||||||
llSay(0, "Object was touched. Touch count: " + touch_count);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1 +1,3 @@
|
||||||
backup
|
; You can place simulator console commands here to execute when the simulator is shut down
|
||||||
|
; e.g. show stats
|
||||||
|
; Lines starting with ; are comments
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
; You can place region console commands here to execute once the simulator has finished starting up
|
||||||
|
; e.g. show stats
|
||||||
|
; Lines start with ; are comments.
|
|
@ -1,4 +0,0 @@
|
||||||
terrain load-tile f32 islandterrain_1024x512.raw 512 1024 1000 1000
|
|
||||||
terrain multiply 0.1
|
|
||||||
terrain add 5
|
|
||||||
|
|
Loading…
Reference in New Issue