User:Dz/SimStats
From OpenSimulator
MOAP Region Statistics Display
This script proved useful during sim performance tests on the MOSES grid.
It uses a call to osGetRegionStats to build a small HTML page that it feeds to a MOAP Display. The HTML is designed to be displayed at a resolution of 1024x2048. Size your display board appropriately to avoid distorted text
As with all OpenSimian projects posted here, You are free to copy/modify/and IMPROVE the functionality to fit your needs.
If you have feedback on script errors, please post it to the page discussion User_talk:Dz/SimStats
The script
The script currently includes a hard coded TextureUUID to load as the default image. You will need to replace that UUID with one local to your grid and appropriate to your purpose.
Read the comments for information about use and distribution..
// OpenSim Region Statistics display // D Osborn MOSES grid 9/2014 // Copyright (c) 2014, 2015 Douglas Osborn // All rights reserved. // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are met: // 1. Redistributions of source code must retain the above copyright notice, this // list of conditions and the following disclaimer. // 2. Redistributions in binary form must reproduce the above copyright notice, // this list of conditions and the following disclaimer in the documentation // and/or other materials provided with the distribution. // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE // DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR // ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND // ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. integer displayface = 2; string Region = ""; string Parcel = ""; string TimeDate = ""; string TextureUUID = "e0d6e6b8-0a40-3eab-08c2-97711a14d439"; string FPS = "FPS - Sim: "; string PHYS = "Physics: "; string DIA= "Time Dilation: "; string AVIS= "Root Agents: "; string SCRPT = "Active Scripts: "; default { state_entry() { list details = llGetParcelDetails(llGetPos(), [PARCEL_DETAILS_NAME]); Region = llGetRegionName(); Parcel = llList2String(details ,0); llSetPrimitiveParams([PRIM_FULLBRIGHT,displayface,TRUE, PRIM_TEXTURE, displayface, TextureUUID, <1.0,1.0,0.0>, <0.0,0.0,0.0>, 0.0]); llSetPrimMediaParams(displayface,[PRIM_MEDIA_HEIGHT_PIXELS, 1024, PRIM_MEDIA_WIDTH_PIXELS, 2048, PRIM_MEDIA_PERMS_CONTROL , PRIM_MEDIA_PERM_NONE]); llSetTimerEvent( 5.0 ); } timer() { list Stats = osGetRegionStats(); string dFPS = FPS + (string) llList2Float( Stats, STATS_SIM_FPS ) ; string dPHYS = PHYS + (string) llList2Float( Stats, STATS_PHYSICS_FPS ); string dDIA= DIA + (string) llList2Float( Stats, STATS_TIME_DILATION ); string dAVIS= AVIS + (string) llList2Integer( Stats, STATS_ROOT_AGENTS ); string dSCRPT = SCRPT + (string) llList2Integer( Stats, STATS_ACTIVE_SCRIPTS ); string WebText = "<body bgcolor='black'><div style='text-align: center;'><font size='7'><font color ='yellow'><i><h1>" + Region + " @ " + Parcel + "</h1><h3>( " + llGetTimestamp() + " )</h3></i><p><h2>"+ dFPS + " - " +dPHYS + "<p>" + dDIA + "<p>" + dAVIS + " - " + dSCRPT + "</h2></div></body>"; llSetPrimMediaParams(displayface,[PRIM_MEDIA_HEIGHT_PIXELS, 1024, PRIM_MEDIA_WIDTH_PIXELS, 2048, PRIM_MEDIA_CURRENT_URL, "data:text/html," + WebText]); } }