OsGetSimulatorMemoryKB
From OpenSimulator
(Difference between revisions)
Line 15: | Line 15: | ||
llSetText( (string)TotMemUsed+" Memory by the OpenSimulator Instance", <0.0,1.0,0.0>, 1.0 ); | llSetText( (string)TotMemUsed+" Memory by the OpenSimulator Instance", <0.0,1.0,0.0>, 1.0 ); | ||
} | } | ||
+ | |||
touch(integer number) | touch(integer number) | ||
{ | { | ||
Line 37: | Line 38: | ||
integer Len = llStringLength(TotMemUsed); | integer Len = llStringLength(TotMemUsed); | ||
− | if(Len == 8) // ##.### MB | + | if (Len == 8) // ##.### MB |
{ | { | ||
string Mem1 = llGetSubString(TotMemUsed, 0, 1); | string Mem1 = llGetSubString(TotMemUsed, 0, 1); | ||
Line 43: | Line 44: | ||
TotalMem = Mem1 + "." + Mem2 + "\nMb"+TxtTail; | TotalMem = Mem1 + "." + Mem2 + "\nMb"+TxtTail; | ||
} | } | ||
− | else if(Len == 9) //###.### MB | + | |
+ | else if (Len == 9) //###.### MB | ||
{ | { | ||
string Mem1 = llGetSubString(TotMemUsed, 0, 2); | string Mem1 = llGetSubString(TotMemUsed, 0, 2); | ||
Line 49: | Line 51: | ||
TotalMem = Mem1 + "." + Mem2 + "\nMb"+TxtTail; | TotalMem = Mem1 + "." + Mem2 + "\nMb"+TxtTail; | ||
} | } | ||
− | else if(Len == 10) //#.### GB | + | |
+ | else if (Len == 10) //#.### GB | ||
{ | { | ||
string Mem1 = llGetSubString(TotMemUsed, 0, 0); | string Mem1 = llGetSubString(TotMemUsed, 0, 0); | ||
Line 55: | Line 58: | ||
TotalMem = Mem1 + "." + Mem2 + "\nGb"+TxtTail; | TotalMem = Mem1 + "." + Mem2 + "\nGb"+TxtTail; | ||
} | } | ||
+ | |||
else if(Len == 11) //##.### GB | else if(Len == 11) //##.### GB | ||
{ | { |
Revision as of 13:15, 15 October 2017
integer osGetSimulatorMemoryKB();
| |
Implemented Octobre 15,2017 by UbitUmarov in GIT# 3d6553afeee3d4605851b6f336c17d5a6b07c6ad - Commit 3d6553 | |
Threat Level | Moderate |
Permissions | No permissions specified |
Extra Delay | No function delay specified |
Example(s) | |
Simple Script (displays only the integer such as 234652064)
// Simple Unformatted Output integer TotMemUsed; default { state_entry() { TotMemUsed = osGetSimulatorMemoryKB(); llSetText( (string)TotMemUsed+" Memory by the OpenSimulator Instance", <0.0,1.0,0.0>, 1.0 ); } touch(integer number) { TotMemUsed = osGetSimulatorMemoryKB(); llSetText( (string)TotMemUsed+" Memory by the OpenSimulator Instance", <0.0,1.0,0.0>, 1.0 ); } } Extended with some formatting: (displays as 234.652 Mb) // 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)osGetSimulatorMemoryKB(); integer Len = llStringLength(TotMemUsed); if (Len == 8) // ##.### MB { string Mem1 = llGetSubString(TotMemUsed, 0, 1); string Mem2 = llGetSubString(TotMemUsed, 2, 5); 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,1.0,0.0>, 1.0 ); } default { state_entry() // display @ start { GenStats(); } touch(integer number) // refresh on touch { GenStats(); } } Informations |