diff options
Diffstat (limited to 'OpenSim/Framework/PriorityQueue.cs')
-rw-r--r-- | OpenSim/Framework/PriorityQueue.cs | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/OpenSim/Framework/PriorityQueue.cs b/OpenSim/Framework/PriorityQueue.cs index fec01da..5b9185e 100644 --- a/OpenSim/Framework/PriorityQueue.cs +++ b/OpenSim/Framework/PriorityQueue.cs | |||
@@ -57,11 +57,11 @@ namespace OpenSim.Framework | |||
57 | private Dictionary<uint, LookupItem> m_lookupTable; | 57 | private Dictionary<uint, LookupItem> m_lookupTable; |
58 | 58 | ||
59 | // internal state used to ensure the deqeues are spread across the priority | 59 | // internal state used to ensure the deqeues are spread across the priority |
60 | // queues "fairly". queuecounts is the amount to pull from each queue in | 60 | // queues "fairly". queuecounts is the amount to pull from each queue in |
61 | // each pass. weighted towards the higher priority queues | 61 | // each pass. weighted towards the higher priority queues |
62 | private uint m_nextQueue = 0; | 62 | private uint m_nextQueue = 0; |
63 | private uint m_countFromQueue = 0; | 63 | private uint m_countFromQueue = 0; |
64 | // first queues are imediate, so no counts | 64 | // first queues are imediate, so no counts |
65 | // private uint[] m_queueCounts = { 0, 0, 8, 4, 4, 2, 2, 2, 2, 1, 1, 1 }; | 65 | // private uint[] m_queueCounts = { 0, 0, 8, 4, 4, 2, 2, 2, 2, 1, 1, 1 }; |
66 | private uint[] m_queueCounts = {0, 0, 8, 8, 5, 4, 3, 2, 1, 1, 1, 1}; | 66 | private uint[] m_queueCounts = {0, 0, 8, 8, 5, 4, 3, 2, 1, 1, 1, 1}; |
67 | // this is ava, ava, attach, <10m, 20,40,80,160m,320,640,1280, + | 67 | // this is ava, ava, attach, <10m, 20,40,80,160m,320,640,1280, + |
@@ -105,7 +105,7 @@ namespace OpenSim.Framework | |||
105 | int count = 0; | 105 | int count = 0; |
106 | for (int i = 0; i < m_heaps.Length; ++i) | 106 | for (int i = 0; i < m_heaps.Length; ++i) |
107 | count += m_heaps[i].Count; | 107 | count += m_heaps[i].Count; |
108 | 108 | ||
109 | return count; | 109 | return count; |
110 | } | 110 | } |
111 | } | 111 | } |
@@ -170,26 +170,26 @@ namespace OpenSim.Framework | |||
170 | return true; | 170 | return true; |
171 | } | 171 | } |
172 | } | 172 | } |
173 | 173 | ||
174 | // To get the fair queing, we cycle through each of the | 174 | // To get the fair queing, we cycle through each of the |
175 | // queues when finding an element to dequeue. | 175 | // queues when finding an element to dequeue. |
176 | // We pull (NumberOfQueues - QueueIndex) items from each queue in order | 176 | // We pull (NumberOfQueues - QueueIndex) items from each queue in order |
177 | // to give lower numbered queues a higher priority and higher percentage | 177 | // to give lower numbered queues a higher priority and higher percentage |
178 | // of the bandwidth. | 178 | // of the bandwidth. |
179 | 179 | ||
180 | // Check for more items to be pulled from the current queue | 180 | // Check for more items to be pulled from the current queue |
181 | if (m_heaps[m_nextQueue].Count > 0 && m_countFromQueue > 0) | 181 | if (m_heaps[m_nextQueue].Count > 0 && m_countFromQueue > 0) |
182 | { | 182 | { |
183 | m_countFromQueue--; | 183 | m_countFromQueue--; |
184 | 184 | ||
185 | MinHeapItem item = m_heaps[m_nextQueue].RemoveMin(); | 185 | MinHeapItem item = m_heaps[m_nextQueue].RemoveMin(); |
186 | m_lookupTable.Remove(item.Value.Entity.LocalId); | 186 | m_lookupTable.Remove(item.Value.Entity.LocalId); |
187 | timeinqueue = Util.EnvironmentTickCountSubtract(item.EntryTime); | 187 | timeinqueue = Util.EnvironmentTickCountSubtract(item.EntryTime); |
188 | value = item.Value; | 188 | value = item.Value; |
189 | 189 | ||
190 | return true; | 190 | return true; |
191 | } | 191 | } |
192 | 192 | ||
193 | // Find the next non-immediate queue with updates in it | 193 | // Find the next non-immediate queue with updates in it |
194 | for (uint i = NumberOfImmediateQueues; i < NumberOfQueues; ++i) | 194 | for (uint i = NumberOfImmediateQueues; i < NumberOfQueues; ++i) |
195 | { | 195 | { |
@@ -198,7 +198,7 @@ namespace OpenSim.Framework | |||
198 | m_nextQueue = NumberOfImmediateQueues; | 198 | m_nextQueue = NumberOfImmediateQueues; |
199 | 199 | ||
200 | m_countFromQueue = m_queueCounts[m_nextQueue]; | 200 | m_countFromQueue = m_queueCounts[m_nextQueue]; |
201 | 201 | ||
202 | if (m_heaps[m_nextQueue].Count > 0) | 202 | if (m_heaps[m_nextQueue].Count > 0) |
203 | { | 203 | { |
204 | m_countFromQueue--; | 204 | m_countFromQueue--; |
@@ -218,7 +218,7 @@ namespace OpenSim.Framework | |||
218 | 218 | ||
219 | /// <summary> | 219 | /// <summary> |
220 | /// Reapply the prioritization function to each of the updates currently | 220 | /// Reapply the prioritization function to each of the updates currently |
221 | /// stored in the priority queues. | 221 | /// stored in the priority queues. |
222 | /// </summary | 222 | /// </summary |
223 | public void Reprioritize(UpdatePriorityHandler handler) | 223 | public void Reprioritize(UpdatePriorityHandler handler) |
224 | { | 224 | { |