diff options
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r-- | OpenSim/Framework/ILandChannel.cs | 1 | ||||
-rw-r--r-- | OpenSim/Framework/PhysicsInertia.cs | 16 | ||||
-rw-r--r-- | OpenSim/Framework/PriorityQueue.cs | 21 | ||||
-rw-r--r-- | OpenSim/Framework/Util.cs | 22 |
4 files changed, 44 insertions, 16 deletions
diff --git a/OpenSim/Framework/ILandChannel.cs b/OpenSim/Framework/ILandChannel.cs index 12a8228..8667837 100644 --- a/OpenSim/Framework/ILandChannel.cs +++ b/OpenSim/Framework/ILandChannel.cs | |||
@@ -88,6 +88,7 @@ namespace OpenSim.Region.Framework.Interfaces | |||
88 | 88 | ||
89 | bool IsForcefulBansAllowed(); | 89 | bool IsForcefulBansAllowed(); |
90 | void UpdateLandObject(int localID, LandData data); | 90 | void UpdateLandObject(int localID, LandData data); |
91 | void SendParcelsOverlay(IClientAPI client); | ||
91 | void ReturnObjectsInParcel(int localID, uint returnType, UUID[] agentIDs, UUID[] taskIDs, IClientAPI remoteClient); | 92 | void ReturnObjectsInParcel(int localID, uint returnType, UUID[] agentIDs, UUID[] taskIDs, IClientAPI remoteClient); |
92 | void setParcelObjectMaxOverride(overrideParcelMaxPrimCountDelegate overrideDel); | 93 | void setParcelObjectMaxOverride(overrideParcelMaxPrimCountDelegate overrideDel); |
93 | void setSimulatorObjectMaxOverride(overrideSimulatorMaxPrimCountDelegate overrideDel); | 94 | void setSimulatorObjectMaxOverride(overrideSimulatorMaxPrimCountDelegate overrideDel); |
diff --git a/OpenSim/Framework/PhysicsInertia.cs b/OpenSim/Framework/PhysicsInertia.cs index af70634..6e15791 100644 --- a/OpenSim/Framework/PhysicsInertia.cs +++ b/OpenSim/Framework/PhysicsInertia.cs | |||
@@ -64,25 +64,25 @@ namespace OpenSim.Framework | |||
64 | 64 | ||
65 | private void XWfloat(string name, float f) | 65 | private void XWfloat(string name, float f) |
66 | { | 66 | { |
67 | writer.WriteElementString(name, f.ToString(Utils.EnUsCulture)); | 67 | writer.WriteElementString(name, f.ToString(Culture.FormatProvider)); |
68 | } | 68 | } |
69 | 69 | ||
70 | private void XWVector(string name, Vector3 vec) | 70 | private void XWVector(string name, Vector3 vec) |
71 | { | 71 | { |
72 | writer.WriteStartElement(name); | 72 | writer.WriteStartElement(name); |
73 | writer.WriteElementString("X", vec.X.ToString(Utils.EnUsCulture)); | 73 | writer.WriteElementString("X", vec.X.ToString(Culture.FormatProvider)); |
74 | writer.WriteElementString("Y", vec.Y.ToString(Utils.EnUsCulture)); | 74 | writer.WriteElementString("Y", vec.Y.ToString(Culture.FormatProvider)); |
75 | writer.WriteElementString("Z", vec.Z.ToString(Utils.EnUsCulture)); | 75 | writer.WriteElementString("Z", vec.Z.ToString(Culture.FormatProvider)); |
76 | writer.WriteEndElement(); | 76 | writer.WriteEndElement(); |
77 | } | 77 | } |
78 | 78 | ||
79 | private void XWVector4(string name, Vector4 quat) | 79 | private void XWVector4(string name, Vector4 quat) |
80 | { | 80 | { |
81 | writer.WriteStartElement(name); | 81 | writer.WriteStartElement(name); |
82 | writer.WriteElementString("X", quat.X.ToString(Utils.EnUsCulture)); | 82 | writer.WriteElementString("X", quat.X.ToString(Culture.FormatProvider)); |
83 | writer.WriteElementString("Y", quat.Y.ToString(Utils.EnUsCulture)); | 83 | writer.WriteElementString("Y", quat.Y.ToString(Culture.FormatProvider)); |
84 | writer.WriteElementString("Z", quat.Z.ToString(Utils.EnUsCulture)); | 84 | writer.WriteElementString("Z", quat.Z.ToString(Culture.FormatProvider)); |
85 | writer.WriteElementString("W", quat.W.ToString(Utils.EnUsCulture)); | 85 | writer.WriteElementString("W", quat.W.ToString(Culture.FormatProvider)); |
86 | writer.WriteEndElement(); | 86 | writer.WriteEndElement(); |
87 | } | 87 | } |
88 | 88 | ||
diff --git a/OpenSim/Framework/PriorityQueue.cs b/OpenSim/Framework/PriorityQueue.cs index 5b9185e..22ffcdc 100644 --- a/OpenSim/Framework/PriorityQueue.cs +++ b/OpenSim/Framework/PriorityQueue.cs | |||
@@ -216,6 +216,27 @@ namespace OpenSim.Framework | |||
216 | return false; | 216 | return false; |
217 | } | 217 | } |
218 | 218 | ||
219 | public bool TryOrderedDequeue(out EntityUpdate value, out Int32 timeinqueue) | ||
220 | { | ||
221 | // If there is anything in imediate queues, return it first no | ||
222 | // matter what else. Breaks fairness. But very useful. | ||
223 | for (int iq = 0; iq < NumberOfQueues; iq++) | ||
224 | { | ||
225 | if (m_heaps[iq].Count > 0) | ||
226 | { | ||
227 | MinHeapItem item = m_heaps[iq].RemoveMin(); | ||
228 | m_lookupTable.Remove(item.Value.Entity.LocalId); | ||
229 | timeinqueue = Util.EnvironmentTickCountSubtract(item.EntryTime); | ||
230 | value = item.Value; | ||
231 | return true; | ||
232 | } | ||
233 | } | ||
234 | |||
235 | timeinqueue = 0; | ||
236 | value = default(EntityUpdate); | ||
237 | return false; | ||
238 | } | ||
239 | |||
219 | /// <summary> | 240 | /// <summary> |
220 | /// Reapply the prioritization function to each of the updates currently | 241 | /// Reapply the prioritization function to each of the updates currently |
221 | /// stored in the priority queues. | 242 | /// stored in the priority queues. |
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index a855767..a42dcc6 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs | |||
@@ -156,12 +156,14 @@ namespace OpenSim.Framework | |||
156 | public static readonly int MAX_THREADPOOL_LEVEL = 3; | 156 | public static readonly int MAX_THREADPOOL_LEVEL = 3; |
157 | 157 | ||
158 | public static double TimeStampClockPeriodMS; | 158 | public static double TimeStampClockPeriodMS; |
159 | public static double TimeStampClockPeriod; | ||
159 | 160 | ||
160 | static Util() | 161 | static Util() |
161 | { | 162 | { |
162 | LogThreadPool = 0; | 163 | LogThreadPool = 0; |
163 | LogOverloads = true; | 164 | LogOverloads = true; |
164 | TimeStampClockPeriodMS = 1000.0D / (double)Stopwatch.Frequency; | 165 | TimeStampClockPeriod = 1.0D/ (double)Stopwatch.Frequency; |
166 | TimeStampClockPeriodMS = 1e3 * TimeStampClockPeriod; | ||
165 | m_log.InfoFormat("[UTIL] TimeStamp clock with period of {0}ms", Math.Round(TimeStampClockPeriodMS,6,MidpointRounding.AwayFromZero)); | 167 | m_log.InfoFormat("[UTIL] TimeStamp clock with period of {0}ms", Math.Round(TimeStampClockPeriodMS,6,MidpointRounding.AwayFromZero)); |
166 | } | 168 | } |
167 | 169 | ||
@@ -2221,9 +2223,9 @@ namespace OpenSim.Framework | |||
2221 | // might have gotten an oversized array even after the string trim | 2223 | // might have gotten an oversized array even after the string trim |
2222 | byte[] data = UTF8.GetBytes(str); | 2224 | byte[] data = UTF8.GetBytes(str); |
2223 | 2225 | ||
2224 | if (data.Length > 256) | 2226 | if (data.Length > 255) //play safe |
2225 | { | 2227 | { |
2226 | int cut = 255; | 2228 | int cut = 254; |
2227 | if((data[cut] & 0x80 ) != 0 ) | 2229 | if((data[cut] & 0x80 ) != 0 ) |
2228 | { | 2230 | { |
2229 | while(cut > 0 && (data[cut] & 0xc0) != 0xc0) | 2231 | while(cut > 0 && (data[cut] & 0xc0) != 0xc0) |
@@ -2325,7 +2327,7 @@ namespace OpenSim.Framework | |||
2325 | 2327 | ||
2326 | if (data.Length > MaxLength) | 2328 | if (data.Length > MaxLength) |
2327 | { | 2329 | { |
2328 | int cut = MaxLength -1 ; | 2330 | int cut = MaxLength - 1 ; |
2329 | if((data[cut] & 0x80 ) != 0 ) | 2331 | if((data[cut] & 0x80 ) != 0 ) |
2330 | { | 2332 | { |
2331 | while(cut > 0 && (data[cut] & 0xc0) != 0xc0) | 2333 | while(cut > 0 && (data[cut] & 0xc0) != 0xc0) |
@@ -2967,9 +2969,9 @@ namespace OpenSim.Framework | |||
2967 | /// <returns></returns> | 2969 | /// <returns></returns> |
2968 | public static Int32 EnvironmentTickCount() | 2970 | public static Int32 EnvironmentTickCount() |
2969 | { | 2971 | { |
2970 | double now = GetTimeStampMS(); | 2972 | return Environment.TickCount & EnvironmentTickCountMask; |
2971 | return (int)now; | ||
2972 | } | 2973 | } |
2974 | |||
2973 | const Int32 EnvironmentTickCountMask = 0x3fffffff; | 2975 | const Int32 EnvironmentTickCountMask = 0x3fffffff; |
2974 | 2976 | ||
2975 | /// <summary> | 2977 | /// <summary> |
@@ -2994,8 +2996,7 @@ namespace OpenSim.Framework | |||
2994 | /// <returns>subtraction of passed prevValue from current Environment.TickCount</returns> | 2996 | /// <returns>subtraction of passed prevValue from current Environment.TickCount</returns> |
2995 | public static Int32 EnvironmentTickCountSubtract(Int32 prevValue) | 2997 | public static Int32 EnvironmentTickCountSubtract(Int32 prevValue) |
2996 | { | 2998 | { |
2997 | double now = GetTimeStampMS(); | 2999 | return EnvironmentTickCountSubtract(EnvironmentTickCount(), prevValue); |
2998 | return EnvironmentTickCountSubtract((int)now, prevValue); | ||
2999 | } | 3000 | } |
3000 | 3001 | ||
3001 | // Returns value of Tick Count A - TickCount B accounting for wrapping of TickCount | 3002 | // Returns value of Tick Count A - TickCount B accounting for wrapping of TickCount |
@@ -3017,6 +3018,11 @@ namespace OpenSim.Framework | |||
3017 | 3018 | ||
3018 | // returns a timestamp in ms as double | 3019 | // returns a timestamp in ms as double |
3019 | // using the time resolution avaiable to StopWatch | 3020 | // using the time resolution avaiable to StopWatch |
3021 | public static double GetTimeStamp() | ||
3022 | { | ||
3023 | return (double)Stopwatch.GetTimestamp() * TimeStampClockPeriod; | ||
3024 | } | ||
3025 | |||
3020 | public static double GetTimeStampMS() | 3026 | public static double GetTimeStampMS() |
3021 | { | 3027 | { |
3022 | return (double)Stopwatch.GetTimestamp() * TimeStampClockPeriodMS; | 3028 | return (double)Stopwatch.GetTimestamp() * TimeStampClockPeriodMS; |