aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorUbitUmarov2016-08-22 20:28:15 +0100
committerUbitUmarov2016-08-22 20:28:15 +0100
commit133fce98e79eced53bb68adc73749adf176cfccd (patch)
treed038c524f3c50e338baca67d2ace14dd740128ea
parenttry to make mono happy (diff)
downloadopensim-SC_OLD-133fce98e79eced53bb68adc73749adf176cfccd.zip
opensim-SC_OLD-133fce98e79eced53bb68adc73749adf176cfccd.tar.gz
opensim-SC_OLD-133fce98e79eced53bb68adc73749adf176cfccd.tar.bz2
opensim-SC_OLD-133fce98e79eced53bb68adc73749adf176cfccd.tar.xz
change ODEs topcolliders code ( still bad), plus a few memory leaks
-rw-r--r--OpenSim/Region/OptionalModules/UserStatistics/Clients_report.cs13
-rw-r--r--OpenSim/Region/OptionalModules/UserStatistics/Default_Report.cs3
-rw-r--r--OpenSim/Region/OptionalModules/UserStatistics/Sessions_Report.cs3
-rw-r--r--OpenSim/Region/PhysicsModules/Ode/OdeScene.cs7
-rw-r--r--OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs48
5 files changed, 34 insertions, 40 deletions
diff --git a/OpenSim/Region/OptionalModules/UserStatistics/Clients_report.cs b/OpenSim/Region/OptionalModules/UserStatistics/Clients_report.cs
index 4a6f7be..3f36e32 100644
--- a/OpenSim/Region/OptionalModules/UserStatistics/Clients_report.cs
+++ b/OpenSim/Region/OptionalModules/UserStatistics/Clients_report.cs
@@ -97,9 +97,8 @@ namespace OpenSim.Region.UserStatistics
97 sdr.Read(); 97 sdr.Read();
98 totalregions = Convert.ToInt32(sdr["regcnt"]); 98 totalregions = Convert.ToInt32(sdr["regcnt"]);
99 } 99 }
100
101 sdr.Close(); 100 sdr.Close();
102 sdr.Dispose(); 101 cmd.Dispose();
103 102
104 sql = 103 sql =
105 "select client_version, count(*) as cnt, avg(avg_sim_fps) as simfps from stats_session_data group by client_version order by count(*) desc LIMIT 10;"; 104 "select client_version, count(*) as cnt, avg(avg_sim_fps) as simfps from stats_session_data group by client_version order by count(*) desc LIMIT 10;";
@@ -120,7 +119,7 @@ namespace OpenSim.Region.UserStatistics
120 } 119 }
121 } 120 }
122 sdr.Close(); 121 sdr.Close();
123 sdr.Dispose(); 122 cmd.Dispose();
124 123
125 if (totalregions > 1) 124 if (totalregions > 1)
126 { 125 {
@@ -143,11 +142,8 @@ namespace OpenSim.Region.UserStatistics
143 } 142 }
144 } 143 }
145 sdr.Close(); 144 sdr.Close();
146 sdr.Dispose(); 145 cmd.Dispose();
147
148
149 } 146 }
150
151 } 147 }
152 148
153 foreach (ClientVersionData cvd in cliRegData) 149 foreach (ClientVersionData cvd in cliRegData)
@@ -163,9 +159,6 @@ namespace OpenSim.Region.UserStatistics
163 { 159 {
164 regionTotals.Add(cvd.region_id, cvd.count); 160 regionTotals.Add(cvd.region_id, cvd.count);
165 } 161 }
166
167
168
169 } 162 }
170 163
171 modeldata["ClientData"] = clidata; 164 modeldata["ClientData"] = clidata;
diff --git a/OpenSim/Region/OptionalModules/UserStatistics/Default_Report.cs b/OpenSim/Region/OptionalModules/UserStatistics/Default_Report.cs
index fabe3d4..8745acd 100644
--- a/OpenSim/Region/OptionalModules/UserStatistics/Default_Report.cs
+++ b/OpenSim/Region/OptionalModules/UserStatistics/Default_Report.cs
@@ -227,7 +227,10 @@ TD.align_top { vertical-align: top; }
227 returnstruct.avg_client_mem_use = Convert.ToSingle(sdr["sav_mem_use"]); 227 returnstruct.avg_client_mem_use = Convert.ToSingle(sdr["sav_mem_use"]);
228 228
229 } 229 }
230 sdr.Close();
231 cmd.Dispose();
230 } 232 }
233
231 return returnstruct; 234 return returnstruct;
232 } 235 }
233 236
diff --git a/OpenSim/Region/OptionalModules/UserStatistics/Sessions_Report.cs b/OpenSim/Region/OptionalModules/UserStatistics/Sessions_Report.cs
index 0e94912..74e9c66 100644
--- a/OpenSim/Region/OptionalModules/UserStatistics/Sessions_Report.cs
+++ b/OpenSim/Region/OptionalModules/UserStatistics/Sessions_Report.cs
@@ -145,8 +145,7 @@ namespace OpenSim.Region.UserStatistics
145 } 145 }
146 } 146 }
147 sdr.Close(); 147 sdr.Close();
148 sdr.Dispose(); 148 cmd.Dispose();
149
150 } 149 }
151 modeldata["SessionData"] = lstSessions; 150 modeldata["SessionData"] = lstSessions;
152 return modeldata; 151 return modeldata;
diff --git a/OpenSim/Region/PhysicsModules/Ode/OdeScene.cs b/OpenSim/Region/PhysicsModules/Ode/OdeScene.cs
index 8f9bccb..7021a05 100644
--- a/OpenSim/Region/PhysicsModules/Ode/OdeScene.cs
+++ b/OpenSim/Region/PhysicsModules/Ode/OdeScene.cs
@@ -3452,6 +3452,11 @@ namespace OpenSim.Region.PhysicsModule.ODE
3452 } 3452 }
3453 } 3453 }
3454 3454
3455 private int compareByCollisionsDesc(OdePrim A, OdePrim B)
3456 {
3457 return -A.CollisionScore.CompareTo(B.CollisionScore);
3458 }
3459
3455 public override Dictionary<uint, float> GetTopColliders() 3460 public override Dictionary<uint, float> GetTopColliders()
3456 { 3461 {
3457 Dictionary<uint, float> topColliders; 3462 Dictionary<uint, float> topColliders;
@@ -3459,7 +3464,7 @@ namespace OpenSim.Region.PhysicsModule.ODE
3459 lock (_prims) 3464 lock (_prims)
3460 { 3465 {
3461 List<OdePrim> orderedPrims = new List<OdePrim>(_prims); 3466 List<OdePrim> orderedPrims = new List<OdePrim>(_prims);
3462 orderedPrims.OrderByDescending(p => p.CollisionScore); 3467 orderedPrims.Sort(compareByCollisionsDesc);
3463 topColliders = orderedPrims.Take(25).ToDictionary(p => p.LocalID, p => p.CollisionScore); 3468 topColliders = orderedPrims.Take(25).ToDictionary(p => p.LocalID, p => p.CollisionScore);
3464 3469
3465 foreach (OdePrim p in _prims) 3470 foreach (OdePrim p in _prims)
diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs b/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs
index 623e6be..fc08819 100644
--- a/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs
+++ b/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs
@@ -30,6 +30,7 @@
30 30
31using System; 31using System;
32using System.Collections.Generic; 32using System.Collections.Generic;
33using System.Linq;
33using System.Reflection; 34using System.Reflection;
34using System.Runtime.InteropServices; 35using System.Runtime.InteropServices;
35using System.Threading; 36using System.Threading;
@@ -803,14 +804,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde
803 return; 804 return;
804 } 805 }
805 806
806 // update actors collision score
807 if (p1.CollisionScore >= float.MaxValue - count)
808 p1.CollisionScore = 0;
809 p1.CollisionScore += count;
810
811 if (p2.CollisionScore >= float.MaxValue - count)
812 p2.CollisionScore = 0;
813 p2.CollisionScore += count;
814 807
815 // get first contact 808 // get first contact
816 d.ContactGeom curContact = new d.ContactGeom(); 809 d.ContactGeom curContact = new d.ContactGeom();
@@ -1056,6 +1049,12 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1056 { 1049 {
1057 uint obj2LocalID = 0; 1050 uint obj2LocalID = 0;
1058 1051
1052 // update actors collision score
1053 if (p1.CollisionScore < float.MaxValue)
1054 p1.CollisionScore += 1.0f;
1055 if (p2.CollisionScore < float.MaxValue)
1056 p2.CollisionScore += 1.0f;
1057
1059 bool p1events = p1.SubscribedEvents(); 1058 bool p1events = p1.SubscribedEvents();
1060 bool p2events = p2.SubscribedEvents(); 1059 bool p2events = p2.SubscribedEvents();
1061 1060
@@ -2569,27 +2568,22 @@ namespace OpenSim.Region.PhysicsModule.ubOde
2569 } 2568 }
2570 } 2569 }
2571 2570
2571 private int compareByCollisionsDesc(OdePrim A, OdePrim B)
2572 {
2573 return -A.CollisionScore.CompareTo(B.CollisionScore);
2574 }
2575
2572 public override Dictionary<uint, float> GetTopColliders() 2576 public override Dictionary<uint, float> GetTopColliders()
2573 { 2577 {
2574 Dictionary<uint, float> returncolliders = new Dictionary<uint, float>(); 2578 Dictionary<uint, float> topColliders;
2575 int cnt = 0; 2579 List<OdePrim> orderedPrims;
2576 lock (_prims) 2580 lock (_activeprims)
2577 { 2581 orderedPrims = new List<OdePrim>(_activeprims);
2578 foreach (OdePrim prm in _prims.Values) 2582
2579 { 2583 orderedPrims.Sort(compareByCollisionsDesc);
2580 if (prm.CollisionScore > 0) 2584 topColliders = orderedPrims.Take(25).ToDictionary(p => p.LocalID, p => p.CollisionScore);
2581 { 2585
2582 returncolliders.Add(prm.LocalID, prm.CollisionScore); 2586 return topColliders;
2583 cnt++;
2584 prm.CollisionScore = 0f;
2585 if (cnt > 25)
2586 {
2587 break;
2588 }
2589 }
2590 }
2591 }
2592 return returncolliders;
2593 } 2587 }
2594 2588
2595 public override bool SupportsRayCast() 2589 public override bool SupportsRayCast()