OsGetRegionStats

From OpenSimulator

(Difference between revisions)
Jump to: navigation, search
Line 99: Line 99:
 
Code provided by Implementor:  Godfrey and Implemented in Git Hash 9d05962029fe864408d287d5fa7ef81f312e098a, - Rev 11601
 
Code provided by Implementor:  Godfrey and Implemented in Git Hash 9d05962029fe864408d287d5fa7ef81f312e098a, - Rev 11601
 
|
 
|
}}
+
}
  
 
{| style="white-space:nowrap;border:1px solid #ccc; width:100%;" cellspacing="2" border="1"
 
{| style="white-space:nowrap;border:1px solid #ccc; width:100%;" cellspacing="2" border="1"

Revision as of 17:20, 22 July 2021

{{osslfunc |threat_level=Moderate |permissions=${OSSL|osslParcelO}ESTATE_MANAGER,ESTATE_OWNER |delay=0 |function_syntax=list osGetRegionStats()

|ossl_example=
// llGetRegionStats() example script
//
// Displays certain region statistics in hovertext above the prim containing the script.
//
default
{
    state_entry()
    {
        llSetTimerEvent(5.0);
    }
 
    timer()
    {
        list Stats = osGetRegionStats();
        string s = "Sim FPS: " + (string)llList2Float( Stats, STATS_SIM_FPS) + "\n";
        s += "Physics FPS: " + (string)llList2Float( Stats, STATS_PHYSICS_FPS) + "\n";
        s += "Time Dilation: " + (string)llList2Float( Stats, STATS_TIME_DILATION) + "\n";
        s += "Root Agents: " + (string)llList2Integer( Stats, STATS_ROOT_AGENTS) + "\n";
        s += "Child Agents: " + (string)llList2Integer( Stats, STATS_CHILD_AGENTS) + "\n";
        s += "Total Prims: " + (string)llList2Integer( Stats, STATS_TOTAL_PRIMS) + "\n";
        s += "Active Scripts: " + (string)llList2Integer( Stats, STATS_ACTIVE_SCRIPTS) + "\n";
        s += "Script Events per Sec: " + (string)llList2Float( Stats, STATS_SCRIPT_EPS);
        llSetText(s, <0.0, 1.0, 0.0>, 1.0);
    }
}
// llGetRegionStats() example script
//
// Displays certain region statistics in Dynamic Texture.
//
 
// ### Config ###
string TextColor = "White";                                 // text color
integer TextSize = 8;                                       // text size
string SetupScreen = "width:256,height:256,bgcolour:Black"; // width of the image, height of the image, background color
integer RepetitionTime  = 30.0;                             // repetition time
 
default
{
    state_entry()
    {
        llSetTimerEvent(RepetitionTime);
    }
 
    timer()
    {
        list Stats = osGetRegionStats();
 
        string myText = "Sim FPS: " + (string)llList2Float( Stats, STATS_SIM_FPS) + "\n";
        myText += "Physics FPS: " + (string)llList2Float( Stats, STATS_PHYSICS_FPS) + "\n";
        myText += "Time Dilation: " + (string)llList2Float( Stats, STATS_TIME_DILATION) + "\n";
        myText += "Root Agents: " + (string)llList2Integer( Stats, STATS_ROOT_AGENTS) + "\n";
        myText += "Child Agents: " + (string)llList2Integer( Stats, STATS_CHILD_AGENTS) + "\n";
        myText += "Total Prims: " + (string)llList2Integer( Stats, STATS_TOTAL_PRIMS) + "\n";
        myText += "Active Scripts: " + (string)llList2Integer( Stats, STATS_ACTIVE_SCRIPTS) + "\n";
        myText += "Script LPS: " + (string)llList2Float( Stats, STATS_SCRIPT_LPS) + "\n";
        myText += "Image MS: " + (string)llList2Float( Stats, STATS_IMAGE_MS) + "\n";
        myText += "Other MS: " + (string)llList2Float( Stats, STATS_OTHER_MS) + "\n";
        myText += "In Packets Per Second: " + (string)llList2Float( Stats, STATS_IN_PACKETS_PER_SECOND) + "\n";
        myText += "Agent Updates: " + (string)llList2Float( Stats, STATS_AGENT_UPDATES) + "\n";
        myText += "Out Packets Per Second: " + (string)llList2Float( Stats, STATS_OUT_PACKETS_PER_SECOND) + "\n";
        myText += "Unpacked Bytes: " + (string)llList2Float( Stats, STATS_UNACKED_BYTES) + "\n";
        myText += "Child Agents: " + (string)llList2Float( Stats, STATS_CHILD_AGENTS) + "\n";
        myText += "Agent MS: " + (string)llList2Float( Stats, STATS_AGENT_MS) + "\n";
        myText += "Pending Downloads: " + (string)llList2Float( Stats, STATS_PENDING_DOWNLOADS) + "\n";
        myText += "Active Prims: " + (string)llList2Float( Stats, STATS_ACTIVE_PRIMS) + "\n";
        myText += "Pending Uploads: " + (string)llList2Float( Stats, STATS_PENDING_UPLOADS) + "\n";
        myText += "Frame MS: " + (string)llList2Float( Stats, STATS_FRAME_MS) + "\n";
        myText += "Net MS: " + (string)llList2Float( Stats, STATS_NET_MS) + "\n";
        myText += "Physics MS: " + (string)llList2Float( Stats, STATS_PHYSICS_MS) + "\n";
 
        string CommandList = ""; // Storage for our drawing commands
 
        CommandList = osMovePen( CommandList, 5, 5 );               // Upper left corner
        CommandList = osSetFontSize( CommandList, TextSize );       // font size
        CommandList = osSetPenColor( CommandList, TextColor );      // text color
        CommandList = osDrawText( CommandList, myText );            // some text
 
        // Now draw the image
        osSetDynamicTextureData( "", "vector", CommandList, SetupScreen, 0 );
    }
}

|description=Returns a list of float values representing a number of region statistics (many of the values shown in the "Stats Bar" of LL-based clients). Provides similar functionality to llGetRegionFPS() and llGetRegionTimeDilation(), but returns 21 statistics simultaneously.

The elements in the list may be referred to by the following new LSL constants:

|additional_info=Please note that as of November 2009, some of the elements in the array (to wit, the STATS_*_MS values) do not appear to contain useful information.

Notes that "STATS_TOTAL_PRIMS" reports worn prims also.

Code provided by Implementor:  Godfrey and Implemented in Git Hash 9d05962029fe864408d287d5fa7ef81f312e098a, - Rev 11601 | }

}
STATS_TIME_DILATION 0 STATS_IMAGE_MS 11
STATS_SIM_FPS 1 STATS_OTHER_MS 12
STATS_PHYSICS_FPS 2 STATS_IN_PACKETS_PER_SECOND 13
STATS_AGENT_UPDATES 3 STATS_OUT_PACKETS_PER_SECOND 14
STATS_ROOT_AGENTS 4 STATS_UNACKED_BYTES 15
STATS_CHILD_AGENTS 5 STATS_AGENT_MS 16
STATS_TOTAL_PRIMS 6 STATS_PENDING_DOWNLOADS 17
STATS_ACTIVE_PRIMS 7 STATS_PENDING_UPLOADS 18
STATS_FRAME_MS 8 STATS_ACTIVE_SCRIPTS 19
STATS_NET_MS 9 STATS_SIM_SLEEP 20
STATS_PHYSICS_MS 10 STATS_SCRIPT_EPS 28
STATS_SCRIPT_TIME 37 STATS_SCRIPT_LPS 38
Personal tools
General
About This Wiki