aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2012-03-16 00:34:30 +0000
committerJustin Clark-Casey (justincc)2012-03-16 00:34:30 +0000
commita4b01ef38a735ffe70b402061871a9c99f2757ed (patch)
treeb60dcc1cbfaeb0cb0184f4b9619a7e95afe0a4de /OpenSim/Region/CoreModules
parentMerge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff)
downloadopensim-SC_OLD-a4b01ef38a735ffe70b402061871a9c99f2757ed.zip
opensim-SC_OLD-a4b01ef38a735ffe70b402061871a9c99f2757ed.tar.gz
opensim-SC_OLD-a4b01ef38a735ffe70b402061871a9c99f2757ed.tar.bz2
opensim-SC_OLD-a4b01ef38a735ffe70b402061871a9c99f2757ed.tar.xz
Replace script-lines-per-second with the script execution time scaled by its measurement period and an idealised frame time.
The previous lines-per-second measurement used for top scripts report was inaccurate, since lines executed does not reflect time taken to execute. Also, every fetch of the report would reset all the numbers limiting its usefulness and we weren't even guaranteed to see the top 100. The actual measurement value should be script execution time per frame but XEngine does not work this way. Therefore, we use actual script execution time scaled by the measurement period and an idealised frame time. This is still not ideal but gives reasonable results and allows scripts to be compared. This commit moves script execution time calculations from SceneGraph into IScriptModule implementations.
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r--OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs77
1 files changed, 47 insertions, 30 deletions
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
index c303d6d..d363b15 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
28using System; 28using System;
29using System.Collections;
29using System.Collections.Generic; 30using System.Collections.Generic;
30using System.IO; 31using System.IO;
32using System.Linq;
31using System.Reflection; 33using System.Reflection;
32using System.Security; 34using System.Security;
33using log4net; 35using log4net;
@@ -876,52 +878,67 @@ namespace OpenSim.Region.CoreModules.World.Estate
876 if (!Scene.Permissions.CanIssueEstateCommand(remoteClient.AgentId, false)) 878 if (!Scene.Permissions.CanIssueEstateCommand(remoteClient.AgentId, false))
877 return; 879 return;
878 880
879 Dictionary<uint, float> SceneData = new Dictionary<uint,float>(); 881 Dictionary<uint, float> sceneData = null;
880 List<UUID> uuidNameLookupList = new List<UUID>(); 882 List<UUID> uuidNameLookupList = new List<UUID>();
881 883
882 if (reportType == 1) 884 if (reportType == 1)
883 { 885 {
884 SceneData = Scene.PhysicsScene.GetTopColliders(); 886 sceneData = Scene.PhysicsScene.GetTopColliders();
885 } 887 }
886 else if (reportType == 0) 888 else if (reportType == 0)
887 { 889 {
888 SceneData = Scene.SceneGraph.GetTopScripts(); 890 IScriptModule scriptModule = Scene.RequestModuleInterface<IScriptModule>();
891
892 if (scriptModule != null)
893 sceneData = scriptModule.GetObjectScriptsExecutionTimes();
889 } 894 }
890 895
891 List<LandStatReportItem> SceneReport = new List<LandStatReportItem>(); 896 List<LandStatReportItem> SceneReport = new List<LandStatReportItem>();
892 lock (SceneData) 897 if (sceneData != null)
893 { 898 {
894 foreach (uint obj in SceneData.Keys) 899 var sortedSceneData
900 = sceneData.Select(
901 item => new { Measurement = item.Value, Part = Scene.GetSceneObjectPart(item.Key) });
902
903 sortedSceneData.OrderBy(item => item.Measurement);
904
905 int items = 0;
906
907 foreach (var entry in sortedSceneData)
895 { 908 {
896 SceneObjectPart prt = Scene.GetSceneObjectPart(obj); 909 if (entry.Part == null)
897 if (prt != null) 910 continue;
911
912 items++;
913 SceneObjectGroup so = entry.Part.ParentGroup;
914
915 LandStatReportItem lsri = new LandStatReportItem();
916 lsri.LocationX = so.AbsolutePosition.X;
917 lsri.LocationY = so.AbsolutePosition.Y;
918 lsri.LocationZ = so.AbsolutePosition.Z;
919 lsri.Score = entry.Measurement;
920 lsri.TaskID = so.UUID;
921 lsri.TaskLocalID = so.LocalId;
922 lsri.TaskName = entry.Part.Name;
923 lsri.OwnerName = "waiting";
924 lock (uuidNameLookupList)
925 uuidNameLookupList.Add(so.OwnerID);
926
927 if (filter.Length != 0)
898 { 928 {
899 SceneObjectGroup sog = prt.ParentGroup; 929 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 { 930 {
914 if ((lsri.OwnerName.Contains(filter) || lsri.TaskName.Contains(filter)))
915 {
916 }
917 else
918 {
919 continue;
920 }
921 } 931 }
922 932 else
923 SceneReport.Add(lsri); 933 {
934 continue;
935 }
924 } 936 }
937
938 SceneReport.Add(lsri);
939
940 if (items >= 100)
941 break;
925 } 942 }
926 } 943 }
927 944