GridTalk.de
Script - OpenSim - Instance - Ram - Speicher - abfragen - Druckversion

+- GridTalk.de (https://www.gridtalk.de)
+-- Forum: Werkstatt (https://www.gridtalk.de/forumdisplay.php?fid=4)
+--- Forum: Scripting (https://www.gridtalk.de/forumdisplay.php?fid=23)
+--- Thema: Script - OpenSim - Instance - Ram - Speicher - abfragen (/showthread.php?tid=755)



Script - OpenSim - Instance - Ram - Speicher - abfragen - Uwe Furse - 04.07.2012

Script ( gibt den aktuellen Speicher im Ram deiner OS-Instance aus, aktuallisieren per, Klick, oder beim performance-blues-bier )
PHP-Code:
// Simple formatted Output
// shows either MB or GB as applicable
//
// ==== GET Memory INteger and Format for Display ====
GenStats()
{
 
// Get Memory and format it
 
string TotalMem;
 
string TotMemUsed;
 
string TxtTail =" used by OpenSimulator Instance";
 
 
TotMemUsed = (string)osGetSimulatorMemory();
 
integer Len llStringLength(TotMemUsed);
 
 if(
Len == 8// ##.### MB
 
{
 
string Mem1 llGetSubString(TotMemUsed,0,1);
 
string Mem2 llGetSubString(TotMemUsed,2,4);
 
TotalMem Mem1 "." Mem2 "\nMb"+TxtTail;
 }
 else if(
Len == 9//###.### MB
 
{
 
string Mem1 llGetSubString(TotMemUsed,0,2);
 
string Mem2 llGetSubString(TotMemUsed,3,5);
 
TotalMem Mem1 "." Mem2 "\nMb"+TxtTail;
 }
 else if(
Len == 10//#.### GB
 
{
 
string Mem1 llGetSubString(TotMemUsed,0,0);
 
string Mem2 llGetSubString(TotMemUsed,1,3);
 
TotalMem Mem1 "." Mem2 "\nGb"+TxtTail;
 }
 else if(
Len == 11//##.### GB
 
{
 
string Mem1 llGetSubString(TotMemUsed,0,1);
 
string Mem2 llGetSubString(TotMemUsed,2,4);
 
TotalMem Mem1 "." Mem2 "\nGb"+TxtTail;
 }
 
 
llSetText(TotalMem, <0.0,2.0,0.0>, 1.0 );
}
 
default
{
 
state_entry() // display @ start
 
{
 
GenStats();
 }
 
 
touch(integer num// refresh on touch
 
{
 
GenStats();
 }

Der Rotz in der Ini ...
PHP-Code:
AllowOSFunctions true
Allow_osGetSimulatorMemory 
true 





RE: Script - OpenSim - Instance - Ram - Speicher - abfragen - Rebekka Revnik - 05.07.2012

Bloss mal GenStats() bissel kürzer...
Code:
GenStats()
{
    // Get Memory and format it
    string s = " MB";
    float f = (float)osGetSimulatorMemory() / 1048576;
    if(llFloor(f) > 1023)
    {
        f = f / 1024;
        s = " GB";
    }
    string s1 = (string)f;
    integer x = llSubStringIndex(s1, ".");
    if(x > 0) s1 = llDeleteSubString(s1, x + 4, x + 7);
    llSetText(s1 + s + "\nused by OpenSimulator instance", <0.0,2.0,0.0>, 1.0 );
}