From 94d2422230be405f44be3697e663ef4fac8369f8 Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Wed, 9 Nov 2016 10:21:02 +0000
Subject: change the clock source on udp outgoing, remove some dead code
---
.../Region/ClientStack/Linden/UDP/LLUDPServer.cs | 134 ++-------------------
.../Region/ClientStack/Linden/UDP/ThrottleRates.cs | 4 +-
.../Agent/UDP/Linden/LindenUDPInfoModule.cs | 25 ----
3 files changed, 10 insertions(+), 153 deletions(-)
(limited to 'OpenSim')
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
index 0e67095..8355f2b 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
@@ -323,7 +323,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
protected int m_elapsedMSSinceLastStatReport = 0;
/// Environment.TickCount of the last time the outgoing packet handler executed
- protected int m_tickLastOutgoingPacketHandler;
+ protected double m_tickLastOutgoingPacketHandler;
/// Keeps track of the number of elapsed milliseconds since the last time the outgoing packet handler looped
protected int m_elapsedMSOutgoingPacketHandler;
@@ -356,20 +356,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
}
-
-
protected ExpiringCache> m_pendingCache = new ExpiringCache>();
- ///
- /// Event used to signal when queued packets are available for sending.
- ///
- ///
- /// This allows the outbound loop to only operate when there is data to send rather than continuously polling.
- /// Some data is sent immediately and not queued. That data would not trigger this event.
- /// WRONG use. May be usefull in future revision
- ///
-// protected AutoResetEvent m_dataPresentEvent = new AutoResetEvent(false);
-
protected Pool m_incomingPacketPool;
///
@@ -467,8 +455,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
int sceneThrottleBps = 0;
bool usePools = false;
-
-
IConfig config = configSource.Configs["ClientStack.LindenUDP"];
if (config != null)
{
@@ -927,10 +913,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
PacketPool.Instance.ReturnPacket(packet);
-
- /// WRONG use. May be usefull in future revision
-// if (packetQueued)
-// m_dataPresentEvent.Set();
}
///
@@ -2079,14 +2061,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
m_sendPing = false;
// Update elapsed time
- int thisTick = Environment.TickCount & Int32.MaxValue;
- if (m_tickLastOutgoingPacketHandler > thisTick)
- m_elapsedMSOutgoingPacketHandler += ((Int32.MaxValue - m_tickLastOutgoingPacketHandler) + thisTick);
- else
- m_elapsedMSOutgoingPacketHandler += (thisTick - m_tickLastOutgoingPacketHandler);
-
+ double thisTick = Util.GetTimeStampMS();
+ int deltaMS = (int)(thisTick - m_tickLastOutgoingPacketHandler);
m_tickLastOutgoingPacketHandler = thisTick;
+ // update some 1ms resolution chained timers
+
+ m_elapsedMSOutgoingPacketHandler += deltaMS;
+
// Check for pending outgoing resends every 100ms
if (m_elapsedMSOutgoingPacketHandler >= 100)
{
@@ -2109,15 +2091,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
m_sendPing = true;
m_elapsed500MSOutgoingPacketHandler = 0;
}
-
#endregion Update Timers
- // Use this for emergency monitoring -- bug hunting
- //if (m_scene.EmergencyMonitoring)
- // clientPacketHandler = MonitoredClientOutgoingPacketHandler;
- //else
- // clientPacketHandler = ClientOutgoingPacketHandler;
-
// Handle outgoing packets, resends, acknowledgements, and pings for each
// client. m_packetSent will be set to true if a packet is sent
Scene.ForEachClient(clientPacketHandler);
@@ -2129,7 +2104,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if(Scene.GetNumberOfClients() == 0)
{
- Thread.Sleep(250); // be friendly to PIs, but how long ??
+ Thread.Sleep(100);
}
else if (!m_packetSent)
// Thread.Sleep((int)TickCountResolution); outch this is bad on linux
@@ -2204,99 +2179,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
///
public long IncomingPacketsProcessed { get; protected set; }
- protected void MonitoredClientOutgoingPacketHandler(IClientAPI client)
- {
- nticks++;
- watch1.Start();
- m_currentOutgoingClient = client;
-
- try
- {
- if (client is LLClientView)
- {
- LLClientView llClient = (LLClientView)client;
- LLUDPClient udpClient = llClient.UDPClient;
-
- if (udpClient.IsConnected)
- {
- if (m_resendUnacked)
- {
- nticksUnack++;
- watch2.Start();
-
- HandleUnacked(llClient);
-
- watch2.Stop();
- avgResendUnackedTicks = (nticksUnack - 1)/(float)nticksUnack * avgResendUnackedTicks + (watch2.ElapsedTicks / (float)nticksUnack);
- watch2.Reset();
- }
-
- if (m_sendAcks)
- {
- nticksAck++;
- watch2.Start();
-
- SendAcks(udpClient);
-
- watch2.Stop();
- avgSendAcksTicks = (nticksAck - 1) / (float)nticksAck * avgSendAcksTicks + (watch2.ElapsedTicks / (float)nticksAck);
- watch2.Reset();
- }
-
- if (m_sendPing)
- {
- nticksPing++;
- watch2.Start();
-
- SendPing(udpClient);
-
- watch2.Stop();
- avgSendPingTicks = (nticksPing - 1) / (float)nticksPing * avgSendPingTicks + (watch2.ElapsedTicks / (float)nticksPing);
- watch2.Reset();
- }
-
- watch2.Start();
- // Dequeue any outgoing packets that are within the throttle limits
- if (udpClient.DequeueOutgoing())
- {
- m_packetSent = true;
- npacksSent++;
- }
- else
- {
- npackNotSent++;
- }
-
- watch2.Stop();
- avgDequeueTicks = (nticks - 1) / (float)nticks * avgDequeueTicks + (watch2.ElapsedTicks / (float)nticks);
- watch2.Reset();
-
- }
- else
- {
- m_log.WarnFormat("[LLUDPSERVER]: Client is not connected");
- }
- }
- }
- catch (Exception ex)
- {
- m_log.Error("[LLUDPSERVER]: OutgoingPacketHandler iteration for " + client.Name +
- " threw an exception: " + ex.Message, ex);
- }
- watch1.Stop();
- avgProcessingTicks = (nticks - 1) / (float)nticks * avgProcessingTicks + (watch1.ElapsedTicks / (float)nticks);
- watch1.Reset();
-
- // reuse this -- it's every ~100ms
- if (Scene.EmergencyMonitoring && nticks % 100 == 0)
- {
- m_log.InfoFormat("[LLUDPSERVER]: avg processing ticks: {0} avg unacked: {1} avg acks: {2} avg ping: {3} avg dequeue: {4} (TickCountRes: {5} sent: {6} notsent: {7})",
- avgProcessingTicks, avgResendUnackedTicks, avgSendAcksTicks, avgSendPingTicks, avgDequeueTicks, TickCountResolution, npacksSent, npackNotSent);
- npackNotSent = npacksSent = 0;
- }
-
- }
-
#endregion
protected void ProcessInPacket(IncomingPacket incomingPacket)
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/ThrottleRates.cs b/OpenSim/Region/ClientStack/Linden/UDP/ThrottleRates.cs
index a476b91..6278e36 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/ThrottleRates.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/ThrottleRates.cs
@@ -92,8 +92,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
Asset = throttleConfig.GetInt("asset_default", 10500);
Total = Resend + Land + Wind + Cloud + Task + Texture + Asset;
- // 3000000 bps default max
- ClientMaxRate = throttleConfig.GetInt("client_throttle_max_bps", 375000);
+ // 5120000 bps default max
+ ClientMaxRate = throttleConfig.GetInt("client_throttle_max_bps", 640000);
if (ClientMaxRate > 1000000)
ClientMaxRate = 1000000; // no more than 8Mbps
diff --git a/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs b/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs
index 08d0fbf..071530b 100644
--- a/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs
+++ b/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs
@@ -126,13 +126,6 @@ namespace OpenSim.Region.OptionalModules.UDP.Linden
(mod, cmd) => MainConsole.Instance.Output(GetThrottlesReport(cmd)));
scene.AddCommand(
- "Comms", this, "emergency-monitoring",
- "emergency-monitoring",
- "Go on/off emergency monitoring mode",
- "Go on/off emergency monitoring mode",
- HandleEmergencyMonitoring);
-
- scene.AddCommand(
"Comms", this, "show client stats",
"show client stats [first_name last_name]",
"Show client request stats",
@@ -197,24 +190,6 @@ namespace OpenSim.Region.OptionalModules.UDP.Linden
return report.ToString();
}
- protected void HandleEmergencyMonitoring(string module, string[] cmd)
- {
- bool mode = true;
- if (cmd.Length == 1 || (cmd.Length > 1 && cmd[1] == "on"))
- {
- mode = true;
- MainConsole.Instance.Output("Emergency Monitoring ON");
- }
- else
- {
- mode = false;
- MainConsole.Instance.Output("Emergency Monitoring OFF");
- }
-
- foreach (Scene s in m_scenes.Values)
- s.EmergencyMonitoring = mode;
- }
-
protected string GetColumnEntry(string entry, int maxLength, int columnPadding)
{
return string.Format(
--
cgit v1.1