Jim Bunderfeld
The Coder
Join date: 1 Mar 2004
Posts: 161
|
01-02-2005 15:58
I am pretty sure I messed this one up  . Anyways it keeps getting stuck in a new lowest fps has been found. integer fps; //current fps string version = "FPS Recorder v.0.0.1 by Jim Bunderfeld"; // Credits
integer Lfps = 100; // lowest fps integer Hfps = 500; // highest fps
highest_fps() { if(fps > Hfps) { fps == (integer)llGetRegionFPS(); Hfps == fps; llWhisper(0,"A new highest FPS rate has been recorded, it is "+(string)Hfps); } if(fps < Lfps) { fps == (integer)llGetRegionFPS(); Lfps == fps; llWhisper(0,"A new lowest FPS rate has been recorded, it is "+(string)Lfps); } else { current_fps(); } } current_fps() { llSetText("Highest FPS Recorded: "+(string)Hfps+" \n" + "Lowest FPS Recorded: "+(string)Lfps + " \n " + "Current FPS: "+(string)fps + " \n " + version,<1,1,1>,1); }
default { state_entry() { llSay(0, "Hello, "+llKey2Name(llGetOwner())+" I am a freebie giveaway developed by Jim Bunderfeld to help residents keep track of the 'speed' of the "+ llGetRegionName() + " simulator."); llSetTimerEvent(3); } timer() { fps == (integer)llGetRegionFPS(); highest_fps(); }
}
|
Kurt Zidane
Just Human
Join date: 1 Apr 2004
Posts: 636
|
01-02-2005 16:08
cool code ed ^.^ you know I have notice that my fps seems to be a little slower, and my system a little less responcive. I don't know why ether. I would say it was the last update, but I only noticed it the last couple of days.
any way... Programing is always logical. Your using if statements, when you want to be doing if else statements. if ( FALSE ) {
} else if ( true ) {
} you only want to do one and not the other right? that what if else is for.
also your retreving the frame rate sevreal time in a script. Witch means the value can change while your prossesing it. Get the value ones, and store it in a value.
|
Kurt Zidane
Just Human
Join date: 1 Apr 2004
Posts: 636
|
01-02-2005 17:03
//script name: FPS recorder v.0.0.2 //created by: Jim Bunderfeld //project description: to keep statistics of the server side fps. The script will keep track of the hole range by stroing the record of the lowest and highest fps score. Frame rate will be sampled through the use of a timer.
//global values //settings //start up message string version = "v.0.0.2"; string message = "FPS Recorder is a free ware script created Jim Bunderfeld"; //timer integer sampleRate = 3; // normal fps range float fpsLowRange = 100; // lowest fps float fpsHighRange = 500; // highest fps //dynamic //fps related float recordLowFPS; // lowest fps float recordHighFPS; // highest fps
//funtions
// compare the value newFPS to records, and to fps range // if newFPS is out of the current range of record. Record is updated // if record is updated and newFPS is also out of normal range then notify owner fpsStats ( float newFPS ) { if( newFPS > recordHighFPS ) { recordHighFPS = newFPS; if ( newFPS > fpsHighRange ) { llWhisper(0,"New Record, High FPS: " + (string)recordHighFPS ); } } else if ( newFPS < recordLowFPS ) { recordLowFPS = newFPS; if ( newFPS < fpsLowRange ) { llWhisper(0,"New Record, low FPS: " + (string)recordLowFPS ); } } }
//creates a string formated with fps realeated data string fpsString( float fps, float lFPS, float hFPS) { string message;
message = "FPS statistics:\n" + " high:"+(string)hFPS +"\n" + " low:" +(string)lFPS +"\n" + " current: "+(string)fps ;
return message; } //state and events default { state_entry() { //startup message llSay ( 0, message + " /nvertion:" + version ); llSetTimerEvent ( sampleRate );
//creates a default value so there is some thing to compare high low record to. //with out this, the low range fps would start at 0, and there would be no point in tracking low fps. float fps = llGetRegionFPS(); recordLowFPS = fps; recordHighFPS = fps; } timer() { float fps = llGetRegionFPS(); fpsStats ( fps ); llSetText ( fpsString ( fps, recordLowFPS, recordHighFPS ), <1,1,1>, 1 ); } }
|
Jim Bunderfeld
The Coder
Join date: 1 Mar 2004
Posts: 161
|
01-02-2005 17:52
Wow! Can anyone fix Kurt's revison for me?
|
Kurt Zidane
Just Human
Join date: 1 Apr 2004
Posts: 636
|
01-02-2005 19:16
woop sorry, one fo the funtion calls I miss spelled. sorry about that.
some of the changes I made. Documented your code. So it was clear what it was doing, and how it should work. fixed your double if to an if else rebuilt the script to track min max, and only whisper when it's out of a pre defined normal range.
if you have any question about what I changed or how some thing works im and i'll be happy to talk you through it.
|
Derek Jones
SL's Second Oldest Monkey
Join date: 18 Mar 2003
Posts: 668
|
01-02-2005 19:36
Jim do you have a copy of my recorder? If not, I'll share it with you. It was pretty accurate at determining average, high, and low FPS.
_____________________
The fact that a believer is happier than a skeptic is no more to the point than the fact than a drunken man is happier than a sober one
|
Kurt Zidane
Just Human
Join date: 1 Apr 2004
Posts: 636
|
01-02-2005 20:44
interesting, if your detecting the average low frame and the average high frame. I would assume your using two lists. One list two keep track of the last so many samples of the fps. But how are you figuring out the top and bottom average. that a little bit more complex then a general average.
|