From 963cf25813ad2bd6dceaa39757391fbf94d6f09e Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Sun, 13 Dec 2009 03:04:16 +1100 Subject: * Implements OSSL function: osGetSimulatorMemory - returns the current amount of memory allocated to the simulator process (Moderate Threat Level). * Cleans redundant information out of the Simulator Version. Versions now look like: "OpenSimulator 0.6.9(dev) Unix/Mono" * [Minor] additional log info for MySQLInventoryData --- .../ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 13 +++++++++++++ .../Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | 2 ++ OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | 10 ++++++++++ 3 files changed, 25 insertions(+) (limited to 'OpenSim/Region/ScriptEngine/Shared') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 5501679..e9e54ae 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -1970,5 +1970,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return ret; } + public int osGetSimulatorMemory() + { + CheckThreatLevel(ThreatLevel.Moderate, "osGetRegionStats"); + m_host.AddScriptLPS(1); + long pws = System.Diagnostics.Process.GetCurrentProcess().WorkingSet64; + + if (pws > Int32.MaxValue) + return Int32.MaxValue; + if (pws < 0) + return 0; + + return (int)pws; + } } } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index 0b0dc00..580c354 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs @@ -163,5 +163,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces key osGetMapTexture(); key osGetRegionMapTexture(string regionName); LSL_List osGetRegionStats(); + + int osGetSimulatorMemory(); } } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index 519463e..2876ad6 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs @@ -637,5 +637,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase { return m_OSSL_Functions.osGetRegionStats(); } + + /// + /// Returns the amount of memory in use by the Simulator Daemon. + /// Amount in bytes - if >= 4GB, returns 4GB. (LSL is not 64-bit aware) + /// + /// + public LSL_Integer osGetSimulatorMemory() + { + return m_OSSL_Functions.osGetSimulatorMemory(); + } } } -- cgit v1.1 From 87e89efbf9727b294658f149c6494fd49608bc12 Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Sun, 13 Dec 2009 03:49:22 +1100 Subject: * Mistaken ThreatLevel classification on osGetSimulatorMemory - should have been MODERATE. --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/ScriptEngine/Shared') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index e9e54ae..1b7db7c 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -1972,7 +1972,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public int osGetSimulatorMemory() { - CheckThreatLevel(ThreatLevel.Moderate, "osGetRegionStats"); + CheckThreatLevel(ThreatLevel.Moderate, "osGetSimulatorMemory"); m_host.AddScriptLPS(1); long pws = System.Diagnostics.Process.GetCurrentProcess().WorkingSet64; -- cgit v1.1