diff options
author | UbitUmarov | 2017-10-15 14:46:21 +0100 |
---|---|---|
committer | UbitUmarov | 2017-10-15 14:46:21 +0100 |
commit | 3d6553afeee3d4605851b6f336c17d5a6b07c6ad (patch) | |
tree | 37004036b982eff88882f131ff74017e85601955 /OpenSim/Region/ScriptEngine/Shared | |
parent | Merge branch 'master' of git://opensimulator.org/git/opensim (Ubit beat (diff) | |
download | opensim-SC_OLD-3d6553afeee3d4605851b6f336c17d5a6b07c6ad.zip opensim-SC_OLD-3d6553afeee3d4605851b6f336c17d5a6b07c6ad.tar.gz opensim-SC_OLD-3d6553afeee3d4605851b6f336c17d5a6b07c6ad.tar.bz2 opensim-SC_OLD-3d6553afeee3d4605851b6f336c17d5a6b07c6ad.tar.xz |
add osGetSimulatorMemoryKB(). This allows work around the fact osGetSimulatorMemory() reports at most 2GB. This one limit is now 2TB, should ne enought for a while
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared')
3 files changed, 23 insertions, 1 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 79367fb..ba07f9c 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -3591,6 +3591,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3591 | return (int)pws; | 3591 | return (int)pws; |
3592 | } | 3592 | } |
3593 | 3593 | ||
3594 | public int osGetSimulatorMemoryKB() | ||
3595 | { | ||
3596 | CheckThreatLevel(ThreatLevel.Moderate, "osGetSimulatorMemory"); | ||
3597 | |||
3598 | long pws = System.Diagnostics.Process.GetCurrentProcess().WorkingSet64; | ||
3599 | |||
3600 | if((pws & 0x3FFL) != 0) | ||
3601 | pws += 0x400L; | ||
3602 | pws >>= 10; | ||
3603 | |||
3604 | if (pws > Int32.MaxValue) | ||
3605 | return Int32.MaxValue; | ||
3606 | |||
3607 | return (int)pws; | ||
3608 | } | ||
3609 | |||
3594 | public void osSetSpeed(string UUID, LSL_Float SpeedModifier) | 3610 | public void osSetSpeed(string UUID, LSL_Float SpeedModifier) |
3595 | { | 3611 | { |
3596 | CheckThreatLevel(ThreatLevel.Moderate, "osSetSpeed"); | 3612 | CheckThreatLevel(ThreatLevel.Moderate, "osSetSpeed"); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index 429860b..ffb7ded 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | |||
@@ -379,6 +379,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
379 | vector osGetRegionSize(); | 379 | vector osGetRegionSize(); |
380 | 380 | ||
381 | int osGetSimulatorMemory(); | 381 | int osGetSimulatorMemory(); |
382 | int osGetSimulatorMemoryKB(); | ||
382 | void osKickAvatar(string FirstName,string SurName,string alert); | 383 | void osKickAvatar(string FirstName,string SurName,string alert); |
383 | void osSetSpeed(string UUID, LSL_Float SpeedModifier); | 384 | void osSetSpeed(string UUID, LSL_Float SpeedModifier); |
384 | LSL_Float osGetHealth(string avatar); | 385 | LSL_Float osGetHealth(string avatar); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index 23ea215..30ff764 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | |||
@@ -958,7 +958,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
958 | 958 | ||
959 | /// <summary> | 959 | /// <summary> |
960 | /// Returns the amount of memory in use by the Simulator Daemon. | 960 | /// Returns the amount of memory in use by the Simulator Daemon. |
961 | /// Amount in bytes - if >= 4GB, returns 4GB. (LSL is not 64-bit aware) | 961 | /// Amount in bytes - if >= 2GB, returns 2GB. (LSL is not 64-bit aware) |
962 | /// </summary> | 962 | /// </summary> |
963 | /// <returns></returns> | 963 | /// <returns></returns> |
964 | public LSL_Integer osGetSimulatorMemory() | 964 | public LSL_Integer osGetSimulatorMemory() |
@@ -966,6 +966,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
966 | return m_OSSL_Functions.osGetSimulatorMemory(); | 966 | return m_OSSL_Functions.osGetSimulatorMemory(); |
967 | } | 967 | } |
968 | 968 | ||
969 | public LSL_Integer osGetSimulatorMemoryKB() | ||
970 | { | ||
971 | return m_OSSL_Functions.osGetSimulatorMemoryKB(); | ||
972 | } | ||
973 | |||
969 | public void osKickAvatar(string FirstName,string SurName,string alert) | 974 | public void osKickAvatar(string FirstName,string SurName,string alert) |
970 | { | 975 | { |
971 | m_OSSL_Functions.osKickAvatar(FirstName, SurName, alert); | 976 | m_OSSL_Functions.osKickAvatar(FirstName, SurName, alert); |