Commit Graph

185 Commits (7119de56ffb9c37b6baa57c5f30b81ac3f86c91c)

Author SHA1 Message Date
Oren Hurvitz 2f398231ac Minor improvements to logging
Eliminated an extra newline in the console if the log line doesn't contain a category (example of a category: "[ASSETS]").
2012-04-24 21:38:09 +01:00
Melanie beb7b8d189 Fix a logic error in app domain creation 2012-04-18 23:23:37 +01:00
Melanie ea73a03553 Don't re-add the assembly resolver for each script if not creating the appdomain 2012-04-18 20:01:41 +01:00
Talun 08e509978d Mantis 55025 Implement script time.
Signed-off-by: nebadon <michael@osgrid.org>
2012-04-12 18:44:00 -07:00
Justin Clark-Casey (justincc) 437f18bc41 Stop console command "xengine status" throwing an exception if there are no scripts in a region.
Addresses http://opensimulator.org/mantis/view.php?id=5940
2012-03-19 21:43:23 +00:00
Justin Clark-Casey (justincc) 9497a7c7bd refactor: separate out console and status report generation parts of XEngine 2012-03-16 03:32:14 +00:00
Justin Clark-Casey (justincc) c386b68373 Aggregate script execution times by linksets rather than individual prims.
This is for the top scripts report.
2012-03-16 01:31:53 +00:00
Justin Clark-Casey (justincc) a4b01ef38a Replace script-lines-per-second with the script execution time scaled by its measurement period and an idealised frame time.
The previous lines-per-second measurement used for top scripts report was inaccurate, since lines executed does not reflect time taken to execute.
Also, every fetch of the report would reset all the numbers limiting its usefulness and we weren't even guaranteed to see the top 100.
The actual measurement value should be script execution time per frame but XEngine does not work this way.
Therefore, we use actual script execution time scaled by the measurement period and an idealised frame time.
This is still not ideal but gives reasonable results and allows scripts to be compared.
This commit moves script execution time calculations from SceneGraph into IScriptModule implementations.
2012-03-16 00:34:30 +00:00
Justin Clark-Casey (justincc) 2f81e53f63 Fix a problem where multiple near simultaneous calls to llDie() from multiple scripts in the same linkset can cause unnecessary thread aborts.
The first llDie() could lock Scene.m_deleting_scene_object.
The second llDie() would then wait at this lock.
The first llDie() would go on to remove the second script but always abort it since the second script's WorkItem would not go away.
Easiest solution here is to remove the m_deleting_scene_object since it's no longer justified - we no longer lock m_parts but take a copy instead.
This also requires an adjustment in XEngine.OnRemoveScript not to use instance.ObjectID instead when firing the OnObjectRemoved event.
2012-03-15 00:20:47 +00:00
Justin Clark-Casey (justincc) 12cebb12d5 Alleviate an issue where calling Thread.Abort() on script WorkItems can fail to release locks, resulting in a crippled simulator.
This seems to be a particular problem with ReaderWriterLockSlim, though other locks can be affected as well.
It has been seen to happen when llDie() is called in a linkset running more than one script.
Alleviation here means supplying a ScriptInstance.Stop() timeout of 1000ms rather than 0ms, to give events a chance to complete.
Also, we check the IsRunning status at the top of the ScriptInstance.EventProcessor() so that another event doesn't start in the mean time.
Ultimately, a better solution may have to be found since a long-running event would still exceed the timeout and be aborted.
2012-03-15 00:06:52 +00:00
Justin Clark-Casey (justincc) 95ec96bf86 refactor: rename ScriptInstance.m_CurrentResult to m_CurrentWorkItem to make it more understandable as to what it is and what it does (hold a thread pool work item for a waiting of in-progress event)
Also add other various illustrative comments
2012-03-14 00:29:36 +00:00
Justin Clark-Casey (justincc) 25592bbd85 Add max thread and min thread information to "xengine status" region console command 2012-03-12 21:16:05 +00:00
Justin Clark-Casey (justincc) 749c3fef8a Change "help" to display categories/module list then "help <category/module>" to display commands in a category.
This is to deal with the hundred lines of command splurge when one previously typed "help"
Modelled somewhat on the mysql console
One can still type help <command> to get per command help at any point.
Categories capitalized to avoid conflict with the all-lowercase commands (except for commander system, as of yet).
Does not affect command parsing or any other aspects of the console apart from the help system.
Backwards compatible with existing modules.
2012-03-08 01:51:37 +00:00
Justin Clark-Casey (justincc) 98251cdab3 Add sensor, dataserver requests, timer and listener counts to "xengine status" command.
This is for diagnostic purposes.
2012-03-06 23:21:17 +00:00
Justin Clark-Casey (justincc) 038d1bf742 Add a regression test to compile and start a script. Remove Path.GetDirectoryName when getting assembly loading path in Compiler.CompileFromDotNetText().
The Path.GetDirectoryName call in Compiler.CompileFromDotNetText is unnecessary since AppDomain.CurrentDomain.BaseDirectory is always a directory.
Later path concatenation is already done by Path.Combine() which handles any trailing slash.
Removing Path.GetDirectoryName() will not affect the runtime but allows NUnit to work since it doesn't add a trailing slash to AppDomain.CurrentDomain.BaseDirectory.
2012-02-07 17:44:37 +00:00
Justin Clark-Casey (justincc) 99e71222f0 Lay out script status in property per row format, since getting too long for console lines. 2012-02-01 00:27:42 +00:00
Justin Clark-Casey (justincc) e3680f216e Add count of events queued for a particular script in "scripts show" console command 2012-02-01 00:17:02 +00:00
Justin Clark-Casey (justincc) 8b3da1bff4 Make script console commands only show for selected region. 2012-02-01 00:10:07 +00:00
Justin Clark-Casey (justincc) 437de6743c Implement "xengine status" console command to show various xengine stats 2012-02-01 00:07:06 +00:00
Justin Clark-Casey (justincc) 82f0e19349 Extend scripts show command to accept a single item UUID parameter to display one script's status
Usage is now scripts show [<script-item-uuid>]
2012-01-14 00:44:19 +00:00
Justin Clark-Casey (justincc) cacc028835 If the entire simulator is shutting down then don't bother to unload the scripts from the appdomain in XEngine.
All the other actions (script state save, etc.) still occur.
This makes shutdown where there are many scripts vastly quicker.
2011-11-17 21:03:08 +00:00
Justin Clark-Casey (justincc) 40bee97015 For now, comment out error message on new script engine console commands.
This causes false positives if a simulator has more than 1 region and the current region is 'root' since this sends the command separately to each region and each region has its own XEngine
2011-10-27 03:01:27 +01:00
Justin Clark-Casey (justincc) 601dabb1b7 Extend scripts stop/start/suspend/resume console commands to allow action on a single script by giving the script item id (which can be found via scripts show).
Not an ideal way to do this on a region with many scripts.  Needs refinement later.
2011-10-19 22:30:31 +01:00
Justin Clark-Casey (justincc) 32c3faedd6 Add "scripts stop" and "scripts start" console commands.
These will stop all running scripts and start all stopped scripts respectively.
A stopped script does not save any events for later processing.
2011-10-19 21:40:28 +01:00
Justin Clark-Casey (justincc) f836710af5 minor: improve command help on scripts suspend/resume 2011-10-19 21:34:55 +01:00
Justin Clark-Casey (justincc) 5607fd3af8 Fix resume scripts.
On resume, we need to place requeue the script for event processing if there are any events on the queue.
Also need to do this under m_Script lock in order to avoid a race
2011-10-19 21:30:37 +01:00
Justin Clark-Casey (justincc) 3cf7fb4eca Add "scripts suspend" and "scripts resume" commands.
These aim currently to suspend and resume all scripts.
However, resume isn't currently working due to what looks like a bug in resume functionality itself.
2011-10-19 20:53:24 +01:00
Justin Clark-Casey (justincc) b45219065c on log and "show scripts" messages, show script item UUID rather than asset UUID
The item ID is the one required for any script manipulation on the command line, so I think it's somewhat more useful to show this bearing in mind the limited space available
2011-10-19 20:26:05 +01:00
Justin Clark-Casey (justincc) 116fbe8258 add current script status to "scripts show" command (running, suspended, etc.) 2011-10-19 20:24:07 +01:00
Justin Clark-Casey (justincc) ecad9f9fd5 Add "show scripts" command to show all scripts currently known to the script engine in the current region.
Also added synonym of "scripts show"
2011-10-19 20:09:02 +01:00
Justin Clark-Casey (justincc) ee84c0589c Don't execute rest of code in XEngine.RemoveRegion() and Close() if the module is disabled. 2011-10-14 01:06:43 +01:00
Justin Clark-Casey (justincc) ea7366ddc6 When shutting down XEngine, log how many scripts are being shutdown so the user knows why they are waiting. 2011-10-12 19:42:04 +01:00
Justin Clark-Casey (justincc) 00f8946bd4 minor: if the script engine fails to find a prim for a script, also print out that prim's local id in the error message. 2011-09-12 22:44:14 +01:00
Oren Hurvitz 1dd904b78e Delay loading scripts until the scene has finished loading 2011-09-09 23:01:05 +01:00
Justin Clark-Casey (justincc) cf3ffe5bb4 Fix llAttachToAvatar()
Apart from one obvious bug, this was failing because attempting to serialize the script from inside the script (as part of saving the attachment as an inventory asset) was triggering an extremely long delay.
So we now don't do this.  The state will be serialized anyway when the avatar normally logs out.
The worst that can happen is that if the client/server crashes, the attachment scripts start without previous state.
2011-08-24 20:49:23 +01:00
Melanie 61d4291da5 Create a method to force the script engine to save state from outside 2011-05-24 03:17:12 +01:00
Diva Canto d8ee0cbe1c First stab at cleaning up Caps. Compiles. Untested. 2011-04-30 09:24:15 -07:00
BlueWall 4f25b73b57 Add configurable path to script engine assemblies
Adding ability to place script engine assemblies outside
	the codebase directories.

	Uses new [XEngine] option: ScriptEnginesPath = "path_to_assemblies"

Signed-off-by: Melanie <melanie@t-data.com>
2010-09-26 02:30:46 +01:00
Jeff Ames f1f0bc23f4 Formatting cleanup. 2010-09-12 13:43:49 -04:00
Justin Clark-Casey (justincc) 74e5fe5aa9 Remove various warnings and improve logging messages. No functional changes. 2010-08-23 22:24:23 +01:00
Diva Canto b7f1288361 Adding it again.
Revert "Reverting this for now, but this needs to go in again."

This reverts commit c0d9ab941d.
2010-07-20 04:23:39 -07:00
Diva Canto c0d9ab941d Reverting this for now, but this needs to go in again.
Revert "Another stab at http://opensimulator.org/mantis/view.php?id=4858. Eliminated more nested locks."

This reverts commit ffbae52a13.
2010-07-19 16:22:29 -07:00
Diva Canto ffbae52a13 Another stab at http://opensimulator.org/mantis/view.php?id=4858. Eliminated more nested locks. 2010-07-19 15:20:34 -07:00
Diva Canto 5c0c7fda6c One more stab at http://opensimulator.org/mantis/view.php?id=4858.
Eliminated the nested locks of m_Scripts and m_PrimObjects.
2010-07-19 13:59:11 -07:00
Melanie fa45d5b5fa Revert "A stab in the dark. Revert the compile lockout temporarily. If you know what"
This reverts commit f798679b80.
2010-07-19 01:10:57 +01:00
Melanie f798679b80 A stab in the dark. Revert the compile lockout temporarily. If you know what
this is, you should test it. If you don't, don't use it.
2010-07-19 00:06:23 +01:00
unknown 6352fc5f57 Bug in 0.6.9 sometimes restoring script state causes region console to crash due to unhandled file lock exception. Attempt to resolve by wrapping several instances of file create / read logic in using statements and added some error handling for locked file exceptions. If it is IDisposable, it must be disposed! The close statements are unnecessary but harmless so I have left those in. The end of the using block will close and dispose automagically. 2010-07-09 18:23:48 +01:00
Justin Clark-Casey (justincc) 54d7f6ef43 Add region name on the end of script startup debug messages 2010-07-01 21:34:53 +01:00
Melanie 1db2921782 Fix scripts in rezzed objects not starting (Mantis #4775) 2010-06-30 21:25:39 +01:00
Melanie 6701fc2ffa Fix the XML serializationt to provide an empty script state element if
the script hasn't yet saved state, or can't save state because of a loop
2010-06-29 21:50:52 +01:00