llSetTimerEvent accuracy

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

llSetTimerEvent accuracy

Jeff Kelley
I always thought that llSetTimerEvent was grossly inaccurate when
working with fast timer (~ 0.1s) and this opinion is shared among
scripters.

That's only true on MONO.

I recently had a try on Windows. The difference is shocking.


Typical Linux figures :

[13:49] Primitive: 99.913000
[13:49] Primitive: 100.266000
[13:49] Primitive: 100.483000
[13:49] Primitive: 99.974000
[13:49] Primitive: 100.312000
[13:49] Primitive: 100.013000
[13:49] Primitive: 134.192000
[13:49] Primitive: 100.383000
[13:49] Primitive: 100.304000

Admit it, that's just crap.


Windows :

[13:44] Primitive: 100.000200
[13:44] Primitive: 100.000100
[13:44] Primitive: 100.000100
[13:44] Primitive: 100.000200
[13:44] Primitive: 100.000100
[13:44] Primitive: 100.000200
[13:44] Primitive: 100.000100
[13:44] Primitive: 100.000100
[13:44] Primitive: 100.000200

That's a near-perfect clock.


Times in milliseconds.
MinTimerInterval = 0.05

Is there anything we can do to make MONO less crappy?


-- Jeff
_______________________________________________
Opensim-dev mailing list
[hidden email]
http://opensimulator.org/cgi-bin/mailman/listinfo/opensim-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: llSetTimerEvent accuracy

Mike Higgins
Well, there is an OpenSim.ini parameter for setting the minimum time
that a timer can ask for, and the default is 0.5 seconds.
So if you didn't change that, and you are trying to time 0.1s intervals,
you should always be off by a huge amount, your results look better than
that!
As a scripter who wants to write code that is portable around the
metaverse, I have to assume that 99.999 percent of the systems out there
have the default setting and therefore I should never count on a timer
going faster than once every 0.5 seconds.
Then there are other fundamental limits like the 11 times a second
heartbeat of OpenSim. This makes me suspect that if I want accurate
times, I have to time everything in increments of 0.0909090909 seconds.
AND THEN there is llSleep, which should be able to accurately time
things shorter than 1/11th of a second, but it does so by locking up one
of the script threads. That is a whole 'nother can of worms....


On 3/19/2016 4:43 PM, Jeff Kelley wrote:

> I always thought that llSetTimerEvent was grossly inaccurate when
> working with fast timer (~ 0.1s) and this opinion is shared among
> scripters.
>
> That's only true on MONO.
>
> I recently had a try on Windows. The difference is shocking.
>
>
> Typical Linux figures :
>
> [13:49] Primitive: 99.913000
> [13:49] Primitive: 100.266000
> [13:49] Primitive: 100.483000
> [13:49] Primitive: 99.974000
> [13:49] Primitive: 100.312000
> [13:49] Primitive: 100.013000
> [13:49] Primitive: 134.192000
> [13:49] Primitive: 100.383000
> [13:49] Primitive: 100.304000
>
> Admit it, that's just crap.
>
>
> Windows :
>
> [13:44] Primitive: 100.000200
> [13:44] Primitive: 100.000100
> [13:44] Primitive: 100.000100
> [13:44] Primitive: 100.000200
> [13:44] Primitive: 100.000100
> [13:44] Primitive: 100.000200
> [13:44] Primitive: 100.000100
> [13:44] Primitive: 100.000100
> [13:44] Primitive: 100.000200
>
> That's a near-perfect clock.
>
>
> Times in milliseconds.
> MinTimerInterval = 0.05
>
> Is there anything we can do to make MONO less crappy?
>
>
> -- Jeff
> _______________________________________________
> Opensim-dev mailing list
> [hidden email]
> http://opensimulator.org/cgi-bin/mailman/listinfo/opensim-dev
>
>

_______________________________________________
Opensim-dev mailing list
[hidden email]
http://opensimulator.org/cgi-bin/mailman/listinfo/opensim-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: llSetTimerEvent accuracy

Jeff Kelley
At 11:40 PM -0700 3/19/16, Mike Higgins wrote:

>Well, there is an OpenSim.ini parameter for setting the minimum time
>that a timer can ask for, and the default is 0.5 seconds.

==> MinTimerInterval = 0.05


>  Then there are other fundamental limits like the 11 times a second
>heartbeat of
>  OpenSim.  This makes me suspect that if I want accurate times, I have to time
>  everything in increments of 0.0909090909 seconds.

Don't you find the Windows numbers too perfect? It's hard to believe
in sub-microsecond accuracy. Maybe there is a bias in my script.



integer ON;

default {

      touch_start(integer n) {
         ON = ! ON;
         if (ON) llSetTimerEvent (0.1);
         else    llSetTimerEvent (0.0);
     }

     timer() {
         float t = llGetAndResetTime ();
         llSay (0, (string) (1000*t));
     }

}



-- Jeff
_______________________________________________
Opensim-dev mailing list
[hidden email]
http://opensimulator.org/cgi-bin/mailman/listinfo/opensim-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: llSetTimerEvent accuracy

Kevin Cozens
On 16-03-20 10:21 AM, Jeff Kelley wrote:
> At 11:40 PM -0700 3/19/16, Mike Higgins wrote:
>> Well, there is an OpenSim.ini parameter for setting the minimum time that
>> a timer can ask for, and the default is 0.5 seconds.
>
> ==> MinTimerInterval = 0.05

That must be a typo in your ini files or you set that value. The minimum
default in OpenSimDefaults.ini is 0.5 seconds.

If you have a script that needs a 0.1 second timer I hope that is only for
short periods of time. If not, the runtime on that script is going to be
high. If you are using 0.1 second timer with a texture change operation in
the timer handler that will result in a very high runtime. High script
runtimes are the typical cause of poor performance of a region (ie. lag).

When I see scripts with high runtimes in a grid the person is asked to shut
it down or fix it. If they don't know how to fix it I offer to help them. It
often doesn't take much to rewrite a script to significantly reduce the runtime.

--
Cheers!

Kevin.

http://www.ve3syb.ca/           |"Nerds make the shiny things that distract
Owner of Elecraft K2 #2172      | the mouth-breathers, and that's why we're
                                 | powerful!"
#include <disclaimer/favourite> |             --Chris Hardwick
_______________________________________________
Opensim-dev mailing list
[hidden email]
http://opensimulator.org/cgi-bin/mailman/listinfo/opensim-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: llSetTimerEvent accuracy

Jeff Kelley
At 1:18 PM -0400 3/20/16, Kevin Cozens wrote:

>That must be a typo in your ini files or you set that value. The
>minimum default in OpenSimDefaults.ini is 0.5 seconds.

I set 0.05.


>If you have a script that needs a 0.1 second timer I hope that is
>only for short periods of time.

I need short time frames for visually smooth interaction, both with
externally and internally clocked events. Example of external events
source :

https://www.youtube.com/watch?v=onTPxBbn3FE

Here, I'm throttling at 20ms. Lag in human interaction devices is
extremly frustrating. You overshoot, then undershoot the desired
value. The closed loop action - visual feedback requires this kind of
speed.

Scripted simulations should give a visual feedback as smooth as
possible for internal clocks also. In-world (prim) controllers
relying on a continous flow of touch() event are throttled at 50ms.
Higher throttle would result in jerky movement.

This is an experimental grid and I don't care high runtimes. We have
astronomy simulations where visitors control telescopes and
spectrometers, and some nuclear labs for school, and nobody lags up
to now.

Unfortunately, I can't afford Windows servers so I have to deal with
MONO jitterish clock. That was a surprise to me to discover the
difference.

Not all grids are social/residential. OpenSim should not be
restricted to this framework. It is desirable to push the limits.
They may be higher that you think.



-- Jeff
_______________________________________________
Opensim-dev mailing list
[hidden email]
http://opensimulator.org/cgi-bin/mailman/listinfo/opensim-dev
Loading...