Revert "Put in temporary hack for performnace 'queue-empty' logic on a persistent thread rather than through fire and forget"

This reverts commit b402220dbb.

Eliminating fire and forget here does not appear to make a significant difference.
cpu-performance
Justin Clark-Casey (justincc) 2013-07-18 00:50:48 +01:00
parent a94a43d249
commit 0af3b5ed9a
1 changed files with 1 additions and 33 deletions

View File

@ -31,7 +31,6 @@ using System.Net;
using System.Threading; using System.Threading;
using log4net; using log4net;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Framework.Monitoring;
using OpenMetaverse; using OpenMetaverse;
using OpenMetaverse.Packets; using OpenMetaverse.Packets;
@ -142,8 +141,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
get { return m_throttleClient; } get { return m_throttleClient; }
} }
private AutoResetEvent m_queueEmptyEvent = new AutoResetEvent(false);
/// <summary>Throttle bucket for this agent's connection</summary> /// <summary>Throttle bucket for this agent's connection</summary>
private readonly TokenBucket m_throttleCategory; private readonly TokenBucket m_throttleCategory;
/// <summary>Throttle buckets for each packet category</summary> /// <summary>Throttle buckets for each packet category</summary>
@ -216,19 +213,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// Initialize this to a sane value to prevent early disconnects // Initialize this to a sane value to prevent early disconnects
TickLastPacketReceived = Environment.TickCount & Int32.MaxValue; TickLastPacketReceived = Environment.TickCount & Int32.MaxValue;
Watchdog.StartThread(
ActOnEmptyQueue, string.Format("ActOnEmptyQueue {0}", AgentID), ThreadPriority.Normal, false, false);
}
private void ActOnEmptyQueue()
{
while (true)
{
m_queueEmptyEvent.WaitOne();
FireQueueEmpty(m_categories);
Watchdog.UpdateThread();
}
} }
/// <summary> /// <summary>
@ -562,9 +546,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
} }
if (emptyCategories != 0) if (emptyCategories != 0)
{
BeginFireQueueEmpty(emptyCategories); BeginFireQueueEmpty(emptyCategories);
}
//m_log.Info("[LLUDPCLIENT]: Queues: " + queueDebugOutput); // Serious debug business //m_log.Info("[LLUDPCLIENT]: Queues: " + queueDebugOutput); // Serious debug business
return packetSent; return packetSent;
@ -624,8 +606,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
RTO = Math.Min(RTO * 2, m_maxRTO); RTO = Math.Min(RTO * 2, m_maxRTO);
} }
private ThrottleOutPacketTypeFlags m_categories = 0;
/// <summary> /// <summary>
/// Does an early check to see if this queue empty callback is already /// Does an early check to see if this queue empty callback is already
/// running, then asynchronously firing the event /// running, then asynchronously firing the event
@ -637,19 +617,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{ {
// Use a value of 0 to signal that FireQueueEmpty is running // Use a value of 0 to signal that FireQueueEmpty is running
m_nextOnQueueEmpty = 0; m_nextOnQueueEmpty = 0;
m_categories = categories;
m_queueEmptyEvent.Set();
// Asynchronously run the callback // Asynchronously run the callback
//Util.FireAndForget(FireQueueEmpty, categories); Util.FireAndForget(FireQueueEmpty, categories);
} }
// if (m_nextOnQueueEmpty != 0 && (Environment.TickCount & Int32.MaxValue) >= m_nextOnQueueEmpty)
// {
// // Use a value of 0 to signal that FireQueueEmpty is running
// m_nextOnQueueEmpty = 0;
// // Asynchronously run the callback
// Util.FireAndForget(FireQueueEmpty, categories);
// }
} }
/// <summary> /// <summary>
@ -661,8 +631,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/// signature</param> /// signature</param>
private void FireQueueEmpty(object o) private void FireQueueEmpty(object o)
{ {
// m_log.DebugFormat("[LLUDPCLIENT]: Firing outbound UDP queue empty for {0}", AgentID);
const int MIN_CALLBACK_MS = 30; const int MIN_CALLBACK_MS = 30;
ThrottleOutPacketTypeFlags categories = (ThrottleOutPacketTypeFlags)o; ThrottleOutPacketTypeFlags categories = (ThrottleOutPacketTypeFlags)o;