diff options
author | Diva Canto | 2012-03-15 20:22:59 -0700 |
---|---|---|
committer | Diva Canto | 2012-03-15 20:22:59 -0700 |
commit | 05bb2e42757078737944d2f3179b0b964ae460c8 (patch) | |
tree | 188e53afb08a96f07996e7d4c0e2dd2db3518096 /OpenSim/Region/CoreModules | |
parent | More on map search: send extra messages to the user regarding the region bein... (diff) | |
parent | Add process working memory to "show stats" memory statistics. (diff) | |
download | opensim-SC_OLD-05bb2e42757078737944d2f3179b0b964ae460c8.zip opensim-SC_OLD-05bb2e42757078737944d2f3179b0b964ae460c8.tar.gz opensim-SC_OLD-05bb2e42757078737944d2f3179b0b964ae460c8.tar.bz2 opensim-SC_OLD-05bb2e42757078737944d2f3179b0b964ae460c8.tar.xz |
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs | 123 |
1 files changed, 51 insertions, 72 deletions
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs index c303d6d..61d604f 100644 --- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs | |||
@@ -26,8 +26,10 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections; | ||
29 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
30 | using System.IO; | 31 | using System.IO; |
32 | using System.Linq; | ||
31 | using System.Reflection; | 33 | using System.Reflection; |
32 | using System.Security; | 34 | using System.Security; |
33 | using log4net; | 35 | using log4net; |
@@ -45,8 +47,6 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
45 | { | 47 | { |
46 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 48 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
47 | 49 | ||
48 | private delegate void LookupUUIDS(List<UUID> uuidLst); | ||
49 | |||
50 | public Scene Scene { get; private set; } | 50 | public Scene Scene { get; private set; } |
51 | public IUserManagement UserManager { get; private set; } | 51 | public IUserManagement UserManager { get; private set; } |
52 | 52 | ||
@@ -876,98 +876,77 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
876 | if (!Scene.Permissions.CanIssueEstateCommand(remoteClient.AgentId, false)) | 876 | if (!Scene.Permissions.CanIssueEstateCommand(remoteClient.AgentId, false)) |
877 | return; | 877 | return; |
878 | 878 | ||
879 | Dictionary<uint, float> SceneData = new Dictionary<uint,float>(); | 879 | Dictionary<uint, float> sceneData = null; |
880 | List<UUID> uuidNameLookupList = new List<UUID>(); | 880 | List<UUID> uuidNameLookupList = new List<UUID>(); |
881 | 881 | ||
882 | if (reportType == 1) | 882 | if (reportType == 1) |
883 | { | 883 | { |
884 | SceneData = Scene.PhysicsScene.GetTopColliders(); | 884 | sceneData = Scene.PhysicsScene.GetTopColliders(); |
885 | } | 885 | } |
886 | else if (reportType == 0) | 886 | else if (reportType == 0) |
887 | { | 887 | { |
888 | SceneData = Scene.SceneGraph.GetTopScripts(); | 888 | IScriptModule scriptModule = Scene.RequestModuleInterface<IScriptModule>(); |
889 | |||
890 | if (scriptModule != null) | ||
891 | sceneData = scriptModule.GetObjectScriptsExecutionTimes(); | ||
889 | } | 892 | } |
890 | 893 | ||
891 | List<LandStatReportItem> SceneReport = new List<LandStatReportItem>(); | 894 | List<LandStatReportItem> SceneReport = new List<LandStatReportItem>(); |
892 | lock (SceneData) | 895 | if (sceneData != null) |
893 | { | 896 | { |
894 | foreach (uint obj in SceneData.Keys) | 897 | var sortedSceneData |
898 | = sceneData.Select( | ||
899 | item => new { Measurement = item.Value, Part = Scene.GetSceneObjectPart(item.Key) }); | ||
900 | |||
901 | sortedSceneData.OrderBy(item => item.Measurement); | ||
902 | |||
903 | int items = 0; | ||
904 | |||
905 | foreach (var entry in sortedSceneData) | ||
895 | { | 906 | { |
896 | SceneObjectPart prt = Scene.GetSceneObjectPart(obj); | 907 | // The object may have been deleted since we received the data. |
897 | if (prt != null) | 908 | if (entry.Part == null) |
909 | continue; | ||
910 | |||
911 | // Don't show scripts that haven't executed or where execution time is below one microsecond in | ||
912 | // order to produce a more readable report. | ||
913 | if (entry.Measurement < 0.001) | ||
914 | continue; | ||
915 | |||
916 | items++; | ||
917 | SceneObjectGroup so = entry.Part.ParentGroup; | ||
918 | |||
919 | LandStatReportItem lsri = new LandStatReportItem(); | ||
920 | lsri.LocationX = so.AbsolutePosition.X; | ||
921 | lsri.LocationY = so.AbsolutePosition.Y; | ||
922 | lsri.LocationZ = so.AbsolutePosition.Z; | ||
923 | lsri.Score = entry.Measurement; | ||
924 | lsri.TaskID = so.UUID; | ||
925 | lsri.TaskLocalID = so.LocalId; | ||
926 | lsri.TaskName = entry.Part.Name; | ||
927 | lsri.OwnerName = UserManager.GetUserName(so.OwnerID); | ||
928 | |||
929 | if (filter.Length != 0) | ||
898 | { | 930 | { |
899 | SceneObjectGroup sog = prt.ParentGroup; | 931 | if ((lsri.OwnerName.Contains(filter) || lsri.TaskName.Contains(filter))) |
900 | LandStatReportItem lsri = new LandStatReportItem(); | ||
901 | lsri.LocationX = sog.AbsolutePosition.X; | ||
902 | lsri.LocationY = sog.AbsolutePosition.Y; | ||
903 | lsri.LocationZ = sog.AbsolutePosition.Z; | ||
904 | lsri.Score = SceneData[obj]; | ||
905 | lsri.TaskID = sog.UUID; | ||
906 | lsri.TaskLocalID = sog.LocalId; | ||
907 | lsri.TaskName = sog.GetPartName(obj); | ||
908 | lsri.OwnerName = "waiting"; | ||
909 | lock (uuidNameLookupList) | ||
910 | uuidNameLookupList.Add(sog.OwnerID); | ||
911 | |||
912 | if (filter.Length != 0) | ||
913 | { | 932 | { |
914 | if ((lsri.OwnerName.Contains(filter) || lsri.TaskName.Contains(filter))) | ||
915 | { | ||
916 | } | ||
917 | else | ||
918 | { | ||
919 | continue; | ||
920 | } | ||
921 | } | 933 | } |
922 | 934 | else | |
923 | SceneReport.Add(lsri); | 935 | { |
936 | continue; | ||
937 | } | ||
924 | } | 938 | } |
939 | |||
940 | SceneReport.Add(lsri); | ||
941 | |||
942 | if (items >= 100) | ||
943 | break; | ||
925 | } | 944 | } |
926 | } | 945 | } |
927 | 946 | ||
928 | remoteClient.SendLandStatReply(reportType, requestFlags, (uint)SceneReport.Count,SceneReport.ToArray()); | 947 | remoteClient.SendLandStatReply(reportType, requestFlags, (uint)SceneReport.Count,SceneReport.ToArray()); |
929 | |||
930 | if (uuidNameLookupList.Count > 0) | ||
931 | LookupUUID(uuidNameLookupList); | ||
932 | } | 948 | } |
933 | 949 | ||
934 | private static void LookupUUIDSCompleted(IAsyncResult iar) | ||
935 | { | ||
936 | LookupUUIDS icon = (LookupUUIDS)iar.AsyncState; | ||
937 | icon.EndInvoke(iar); | ||
938 | } | ||
939 | |||
940 | private void LookupUUID(List<UUID> uuidLst) | ||
941 | { | ||
942 | LookupUUIDS d = LookupUUIDsAsync; | ||
943 | |||
944 | d.BeginInvoke(uuidLst, | ||
945 | LookupUUIDSCompleted, | ||
946 | d); | ||
947 | } | ||
948 | |||
949 | private void LookupUUIDsAsync(List<UUID> uuidLst) | ||
950 | { | ||
951 | UUID[] uuidarr; | ||
952 | |||
953 | lock (uuidLst) | ||
954 | { | ||
955 | uuidarr = uuidLst.ToArray(); | ||
956 | } | ||
957 | |||
958 | for (int i = 0; i < uuidarr.Length; i++) | ||
959 | { | ||
960 | // string lookupname = m_scene.CommsManager.UUIDNameRequestString(uuidarr[i]); | ||
961 | |||
962 | IUserManagement userManager = Scene.RequestModuleInterface<IUserManagement>(); | ||
963 | if (userManager != null) | ||
964 | userManager.GetUserName(uuidarr[i]); | ||
965 | |||
966 | // we drop it. It gets cached though... so we're ready for the next request. | ||
967 | // diva commnent 11/21/2010: uh?!? wft? | ||
968 | // justincc comment 21/01/2011: A side effect of userManager.GetUserName() I presume. | ||
969 | } | ||
970 | } | ||
971 | #endregion | 950 | #endregion |
972 | 951 | ||
973 | #region Outgoing Packets | 952 | #region Outgoing Packets |