Change font size
It is currently Wed May 22, 2019 10:22 pm

Forum rules


Post a new topicPost a reply Page 1 of 1   [ 1 post ]
Author Message
 Post subject: New lag-o-meter script
PostPosted: Sat Jul 07, 2012 4:33 am 

Joined: Fri Apr 13, 2012 1:19 am
Posts: 26
I have been having problems with lag on my sim and wrote this little lag-o-meter script. I was unhappy with some other lag meter scripts I had seen. Most of those simply displayed the dilation and FPS without question. I was discovering that my timer() events were getting called later and later and I wanted to know how late they were. It also measures how late llSleep calls return.

I expect a certain amount of delay from sampling error of the sim script frame clock. But I was seeing a 1 second timer taking 4 seconds or longer. (Turns out the server was spending all that time resizing sculpted prims. Stop resizing sculpted prims and the timers are closer to being on time. Go figure.)

Stick this script in a prim. You can wear it as a HUD, or rez a copy.
// by Kayaker Magic, aka Mike Kayaker or Kayaker Mike

float average=0.0;
float avesleep=0.0;
float number=0.0;
float timerstep=1.0;
float sleepstep=0.1;

string percent(float got,float expected)

        float time=llGetAndResetTime();
        average += time+sleepstep;;
        number += 1;
        float short=llGetAndResetTime();
        avesleep += short;
        llSetText( "The timers are late by:"+
            "\nLast timer: "    +percent(time+sleepstep,timerstep)+
            "\nAverage timer: "+ percent(average/number,timerstep)+
            "\n"+"Short Sleep: "+percent(short,sleepstep)+
            "\nAverage sleep: " +percent(avesleep/number,sleepstep)+
            "\nDilation: "      +llGetSubString((string)(1.0-llGetRegionTimeDilation()),0,3)+"%"+
            "\nFPS: "           +llGetSubString((string)llGetRegionFPS(),0,3)+
            "\nTouch bar to reset"
        if (number>10000.0)  //reset the statistics every so often
    touch_start(integer num)
        number=0.0;  //reset the statistics on a touch

Display posts from previous:  Sort by  
Post a new topicPost a reply Page 1 of 1   [ 1 post ]

Who is online

Users browsing this forum: legacy_google [bot], legacy_majestic-12 [bot] and 2 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
610nm Style by Daniel St. Jules of