[Opensim-users] Slow LSL timers

Jorge Lima jorge.manuel at gmail.com
Mon Dec 6 01:45:39 UTC 2010


Thank you Paul, I will look into Ptolemy.
I briefly looked at the code for timers and it seems a bit strange to me.

>From what I know of SL I expected each script to be little more than a
self-contained thread or process that mapped itself as thinly as
possible to the underlying physics engine and operating system.

So I don't understand why we need a centralized "timer manager".
Couldn't the underlying OS be managing the timers on its own - exactly
as if I had called setitimer in C, and received a SIGALRM, etc. ?


On Mon, Dec 6, 2010 at 12:54 AM, Paul Fishwick <fishwick at cise.ufl.edu> wrote:
> I was going to wait until this week to show this link since it is not
> completely ready (yet), but we have an implementation using
> a region module for simple harmonic motion. We drive this motion
> through a separate package (Ptolemy) that I have used in my
> systems simulation class:
>
> http://www.cise.ufl.edu/~zezzell/ptolemy/ptolemy_opensim.html
>
> Ultimately, for several reasons including artificial delays, LSL
> seems inadequate for near real-time simulation. However, access
> to the raw timing facility in OpenSim is adequate.
>
> -p
>
> On 12/5/2010 7:30 PM, Jorge Lima wrote:
>>
>> My project is simple enough - something like throwing a ball off a
>> cliff with a horizontal impulse and recording its speed. It's for high
>> school physics teachers/students.
>>
>> It seems to me that I can either have a fast timer that simulates the
>> movement and generates points, or I can have a fast timer that trusts
>> the physics engine to provide an accurate simulation and records its
>> output :)
>>
>> I will look into the Timer.cs file and try out C# scripting tomorrow,
>> then get back to you. Thanks for the help!
>>
>> On Sat, Dec 4, 2010 at 6:23 AM, dz<dz at bitzend.net>  wrote:
>>>
>>> I'd have to agree with Justin...
>>>
>>> Expecting event handling to be optimized is too optimistic, but  there
>>> are
>>> alternatives.  The .Net/Mono libraries already include timer functions
>>> that
>>> support fast and accurate timing.
>>>
>>> Relying on an LSL event trigger to happen every 4 frames MAY work in SL
>>> but
>>> it is a design begging to cause lag and  stop itself.  Designs like that
>>> are
>>> also susceptible to event buffer overflows  where your events are "lost",
>>> leaving you to wonder why your "reliable" script  sometimes just isn't..
>>> The ONLY LSL events I have seen  requiring sub-second repeats  would be
>>> in
>>> an AO, but timer based AO's are obsoleted in OpenSim by the use of the
>>> Animation_Changed event.
>>>
>>> In the extreme, if you are trying to be  very exact,,  you would want to
>>> insure the timings were made by processes independent of the region time
>>> dialations, not the ones that may be responsible for them.
>>>
>>>
>>>
>>> On Fri, Dec 3, 2010 at 5:35 PM,<opensim-users-request at lists.berlios.de>
>>> wrote:
>>>>
>>>> ---------- Forwarded message ----------
>>>> From: Jorge Lima<jorge.manuel at gmail.com>
>>>>
>>>> Subject: [Opensim-users] Slow LSL timers
>>>> Ran 100 timer events with a single if(++i>  100) inside. I suppose
>>>> decrementing and comparing to 0 might be faster, but I also
>>>> copy-pasted 100 inlined if clauses and the time to run them was
>>>> negligible.
>>>>
>>>> llSetTimerEvent(0.1) ->  59 s ->  490% overhead
>>>> llSetTimerEvent(0.2) ->  59 s ->  195% overhead
>>>> llSetTimerEvent(0.5) ->  59 s ->  18% overhead
>>>> llSetTimerEvent(0.75) ->  81 s ->  8% overhead
>>>> llSetTimerEvent(1.0) ->  108 s ->  8% overhead
>>>> llSetTimerEvent(2.0) ->  209 s ->  4.5% overhead
>>>> llSetTimerEvent(4.0) ->  407 s ->  1.75% overhead
>>>>
>>>> I am guessing that the overhead is, therefore, internal to the timer
>>>> implementation. I haven't tested raw C# timers as comparison but 100ms
>>>> is an eternity in modern computing, I can ping servers across the
>>>> Atlantic ocean in less than that!
>>>>
>>>> I went through the code but I haven't yet found the part that handles
>>>> timers. It's not in EventManager.
>>>> Does anyone know what's going on? The code works fine in SL.
>>>> Should I be posting this in the dev list? I'd like to see if I can fix
>>>> it.
>>>> Any thoughts on how to get fast timers in OpenSim?
>>>> Faster computer? (I did check and was only getting about 20% CPU
>>>> usage...)
>>>> Porting them to a Real-Time operating system? :)
>>>>
>>>>
>>>>
>>>> ---------- Forwarded message ----------
>>>> From: Justin Clark-Casey<jjustincc at googlemail.com>
>>>> To: opensim-users at lists.berlios.de
>>>> Date: Sat, 04 Dec 2010 01:35:32 +0000
>>>> Subject: Re: [Opensim-users] Slow LSL timers
>>>
>>>> I'm not familiar with the this area of the code but I had a quick look
>>>> since I was curious (the meat is in
>>>> OpenSim/Region/ScriptEngine/Shared/Api/Plugins/Timer.cs).  The code
>>>> isn't
>>>> using C# timers so I'm not totally surprised at the behaviour that
>>>> you're
>>>> seeing.
>>>>
>>>> I suspect addressing this would require a considerably different
>>>> implementation.
>>>>
>>> _______________________________________________
>>> Opensim-users mailing list
>>> Opensim-users at lists.berlios.de
>>> https://lists.berlios.de/mailman/listinfo/opensim-users
>>>
>>>
>> _______________________________________________
>> Opensim-users mailing list
>> Opensim-users at lists.berlios.de
>> https://lists.berlios.de/mailman/listinfo/opensim-users
>>
>
>
> --
> Paul Fishwick, PhD
> Professor and Director, Digital Arts and Sciences
> CISE Department, CSE 301
> University of Florida
> Gainesville, FL 32611
> Email: fishwick at cise.ufl.edu
> Web: http://www.cise.ufl.edu/~fishwick
> Blog: http://www.representationz.com
>
> _______________________________________________
> Opensim-users mailing list
> Opensim-users at lists.berlios.de
> https://lists.berlios.de/mailman/listinfo/opensim-users
>



More information about the Opensim-users mailing list