diff options
author | UbitUmarov | 2014-08-14 20:41:36 +0100 |
---|---|---|
committer | UbitUmarov | 2014-08-14 20:41:36 +0100 |
commit | 8c657e48377213e7ee66c05a4047085cee6084ea (patch) | |
tree | 46103e8a47114a3ee9b0a206f97ee728efeef7eb | |
parent | try external bakedModule when local cache is invalid and not just at login (diff) | |
download | opensim-SC_OLD-8c657e48377213e7ee66c05a4047085cee6084ea.zip opensim-SC_OLD-8c657e48377213e7ee66c05a4047085cee6084ea.tar.gz opensim-SC_OLD-8c657e48377213e7ee66c05a4047085cee6084ea.tar.bz2 opensim-SC_OLD-8c657e48377213e7ee66c05a4047085cee6084ea.tar.xz |
add a estimator of client ping time, and painfully make it visible in show
connections console command
8 files changed, 52 insertions, 6 deletions
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 22cc79d..3b0430b 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs | |||
@@ -755,6 +755,8 @@ namespace OpenSim.Framework | |||
755 | /// </summary> | 755 | /// </summary> |
756 | bool IsActive { get; set; } | 756 | bool IsActive { get; set; } |
757 | 757 | ||
758 | int PingTimeMS { get; } | ||
759 | |||
758 | /// <summary> | 760 | /// <summary> |
759 | /// Set if the client is closing due to a logout request | 761 | /// Set if the client is closing due to a logout request |
760 | /// </summary> | 762 | /// </summary> |
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index 85049c9..13d8170 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs | |||
@@ -978,6 +978,7 @@ namespace OpenSim | |||
978 | cdt.AddColumn("Circuit code", 12); | 978 | cdt.AddColumn("Circuit code", 12); |
979 | cdt.AddColumn("Endpoint", 23); | 979 | cdt.AddColumn("Endpoint", 23); |
980 | cdt.AddColumn("Active?", 7); | 980 | cdt.AddColumn("Active?", 7); |
981 | cdt.AddColumn("ping(ms)", 8); | ||
981 | 982 | ||
982 | SceneManager.ForEachScene( | 983 | SceneManager.ForEachScene( |
983 | s => s.ForEachClient( | 984 | s => s.ForEachClient( |
@@ -986,7 +987,8 @@ namespace OpenSim | |||
986 | c.Name, | 987 | c.Name, |
987 | c.CircuitCode.ToString(), | 988 | c.CircuitCode.ToString(), |
988 | c.RemoteEndPoint.ToString(), | 989 | c.RemoteEndPoint.ToString(), |
989 | c.IsActive.ToString()))); | 990 | c.IsActive.ToString(), |
991 | c.PingTimeMS))); | ||
990 | 992 | ||
991 | MainConsole.Instance.Output(cdt.ToString()); | 993 | MainConsole.Instance.Output(cdt.ToString()); |
992 | } | 994 | } |
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 59d1c69..e69bf23 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | |||
@@ -419,6 +419,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
419 | public ulong ActiveGroupPowers { get { return m_activeGroupPowers; } } | 419 | public ulong ActiveGroupPowers { get { return m_activeGroupPowers; } } |
420 | public bool IsGroupMember(UUID groupID) { return m_groupPowers.ContainsKey(groupID); } | 420 | public bool IsGroupMember(UUID groupID) { return m_groupPowers.ContainsKey(groupID); } |
421 | 421 | ||
422 | public int PingTimeMS | ||
423 | { | ||
424 | get | ||
425 | { | ||
426 | if (UDPClient != null) | ||
427 | return UDPClient.PingTimeMS; | ||
428 | return 0; | ||
429 | } | ||
430 | } | ||
431 | |||
422 | /// <summary> | 432 | /// <summary> |
423 | /// Entity update queues | 433 | /// Entity update queues |
424 | /// </summary> | 434 | /// </summary> |
@@ -461,6 +471,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
461 | set { m_disableFacelights = value; } | 471 | set { m_disableFacelights = value; } |
462 | } | 472 | } |
463 | 473 | ||
474 | |||
464 | public bool SendLogoutPacketWhenClosing { set { m_SendLogoutPacketWhenClosing = value; } } | 475 | public bool SendLogoutPacketWhenClosing { set { m_SendLogoutPacketWhenClosing = value; } } |
465 | 476 | ||
466 | 477 | ||
@@ -1638,6 +1649,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1638 | pc.PingID.OldestUnacked = 0; | 1649 | pc.PingID.OldestUnacked = 0; |
1639 | 1650 | ||
1640 | OutPacket(pc, ThrottleOutPacketType.Unknown); | 1651 | OutPacket(pc, ThrottleOutPacketType.Unknown); |
1652 | UDPClient.m_lastStartpingTimeMS = Util.EnvironmentTickCount(); | ||
1641 | } | 1653 | } |
1642 | 1654 | ||
1643 | public void SendKillObject(List<uint> localIDs) | 1655 | public void SendKillObject(List<uint> localIDs) |
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs index bd4e617..9cf65d7 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs | |||
@@ -163,6 +163,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
163 | private int m_maxRTO = 60000; | 163 | private int m_maxRTO = 60000; |
164 | public bool m_deliverPackets = true; | 164 | public bool m_deliverPackets = true; |
165 | 165 | ||
166 | public int m_lastStartpingTimeMS; | ||
167 | public int m_pingMS; | ||
168 | |||
169 | public int PingTimeMS | ||
170 | { | ||
171 | get | ||
172 | { | ||
173 | if (m_pingMS < 20) | ||
174 | return 20; | ||
175 | if(m_pingMS > 2000) | ||
176 | return 2000; | ||
177 | return m_pingMS; | ||
178 | } | ||
179 | } | ||
180 | |||
166 | /// <summary> | 181 | /// <summary> |
167 | /// This is the percentage of the udp texture queue to add to the task queue since | 182 | /// This is the percentage of the udp texture queue to add to the task queue since |
168 | /// textures are now generally handled through http. | 183 | /// textures are now generally handled through http. |
@@ -225,6 +240,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
225 | 240 | ||
226 | // Initialize this to a sane value to prevent early disconnects | 241 | // Initialize this to a sane value to prevent early disconnects |
227 | TickLastPacketReceived = Environment.TickCount & Int32.MaxValue; | 242 | TickLastPacketReceived = Environment.TickCount & Int32.MaxValue; |
243 | m_pingMS = (int)(3.0 * server.TickCountResolution); // so filter doesnt start at 0; | ||
228 | } | 244 | } |
229 | 245 | ||
230 | /// <summary> | 246 | /// <summary> |
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index fe79f87..910d7cf 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | |||
@@ -293,6 +293,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
293 | /// <summary>Flag to signal when clients should send pings</summary> | 293 | /// <summary>Flag to signal when clients should send pings</summary> |
294 | protected bool m_sendPing; | 294 | protected bool m_sendPing; |
295 | 295 | ||
296 | |||
296 | private ExpiringCache<IPEndPoint, Queue<UDPPacketBuffer>> m_pendingCache = new ExpiringCache<IPEndPoint, Queue<UDPPacketBuffer>>(); | 297 | private ExpiringCache<IPEndPoint, Queue<UDPPacketBuffer>> m_pendingCache = new ExpiringCache<IPEndPoint, Queue<UDPPacketBuffer>>(); |
297 | 298 | ||
298 | /// <summary> | 299 | /// <summary> |
@@ -369,16 +370,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
369 | 370 | ||
370 | // Measure the resolution of Environment.TickCount | 371 | // Measure the resolution of Environment.TickCount |
371 | TickCountResolution = 0f; | 372 | TickCountResolution = 0f; |
372 | for (int i = 0; i < 5; i++) | 373 | for (int i = 0; i < 10; i++) |
373 | { | 374 | { |
374 | int start = Environment.TickCount; | 375 | int start = Environment.TickCount; |
375 | int now = start; | 376 | int now = start; |
376 | while (now == start) | 377 | while (now == start) |
377 | now = Environment.TickCount; | 378 | now = Environment.TickCount; |
378 | TickCountResolution += (float)(now - start) * 0.2f; | 379 | TickCountResolution += (float)(now - start) * 0.1f; |
379 | } | 380 | } |
380 | m_log.Info("[LLUDPSERVER]: Average Environment.TickCount resolution: " + TickCountResolution + "ms"); | ||
381 | TickCountResolution = (float)Math.Ceiling(TickCountResolution); | 381 | TickCountResolution = (float)Math.Ceiling(TickCountResolution); |
382 | m_log.Info("[LLUDPSERVER]: Average Environment.TickCount resolution: " + TickCountResolution + "ms"); | ||
382 | 383 | ||
383 | #endregion Environment.TickCount Measurement | 384 | #endregion Environment.TickCount Measurement |
384 | 385 | ||
@@ -386,6 +387,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
386 | int sceneThrottleBps = 0; | 387 | int sceneThrottleBps = 0; |
387 | bool usePools = false; | 388 | bool usePools = false; |
388 | 389 | ||
390 | |||
391 | |||
389 | IConfig config = configSource.Configs["ClientStack.LindenUDP"]; | 392 | IConfig config = configSource.Configs["ClientStack.LindenUDP"]; |
390 | if (config != null) | 393 | if (config != null) |
391 | { | 394 | { |
@@ -1128,6 +1131,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1128 | pc.PingID.OldestUnacked = 0; | 1131 | pc.PingID.OldestUnacked = 0; |
1129 | 1132 | ||
1130 | SendPacket(udpClient, pc, ThrottleOutPacketType.Unknown, false, null); | 1133 | SendPacket(udpClient, pc, ThrottleOutPacketType.Unknown, false, null); |
1134 | udpClient.m_lastStartpingTimeMS = Util.EnvironmentTickCount(); | ||
1131 | } | 1135 | } |
1132 | 1136 | ||
1133 | public void CompletePing(LLUDPClient udpClient, byte pingID) | 1137 | public void CompletePing(LLUDPClient udpClient, byte pingID) |
@@ -1567,7 +1571,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1567 | // We don't need to do anything else with ping checks | 1571 | // We don't need to do anything else with ping checks |
1568 | StartPingCheckPacket startPing = (StartPingCheckPacket)packet; | 1572 | StartPingCheckPacket startPing = (StartPingCheckPacket)packet; |
1569 | CompletePing(udpClient, startPing.PingID.PingID); | 1573 | CompletePing(udpClient, startPing.PingID.PingID); |
1570 | 1574 | ||
1571 | if ((Environment.TickCount - m_elapsedMSSinceLastStatReport) >= 3000) | 1575 | if ((Environment.TickCount - m_elapsedMSSinceLastStatReport) >= 3000) |
1572 | { | 1576 | { |
1573 | udpClient.SendPacketStats(); | 1577 | udpClient.SendPacketStats(); |
@@ -1577,7 +1581,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1577 | } | 1581 | } |
1578 | else if (packet.Type == PacketType.CompletePingCheck) | 1582 | else if (packet.Type == PacketType.CompletePingCheck) |
1579 | { | 1583 | { |
1580 | // We don't currently track client ping times | 1584 | int t = Util.EnvironmentTickCountSubtract(udpClient.m_lastStartpingTimeMS); |
1585 | int c = udpClient.m_pingMS; | ||
1586 | c = 900 * c + 100 * t; | ||
1587 | c /= 1000; | ||
1588 | udpClient.m_pingMS = c; | ||
1581 | return; | 1589 | return; |
1582 | } | 1590 | } |
1583 | 1591 | ||
diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs index 373ed41..f35ea92 100644 --- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs +++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs | |||
@@ -58,6 +58,8 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server | |||
58 | 58 | ||
59 | public ISceneAgent SceneAgent { get; set; } | 59 | public ISceneAgent SceneAgent { get; set; } |
60 | 60 | ||
61 | public int PingTimeMS { get { return 0; } } | ||
62 | |||
61 | private string m_username; | 63 | private string m_username; |
62 | private string m_nick; | 64 | private string m_nick; |
63 | 65 | ||
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs index c88ccc5..7002d75 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs | |||
@@ -81,6 +81,8 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
81 | get { return m_scene; } | 81 | get { return m_scene; } |
82 | } | 82 | } |
83 | 83 | ||
84 | public int PingTimeMS { get { return 0; } } | ||
85 | |||
84 | public UUID OwnerID | 86 | public UUID OwnerID |
85 | { | 87 | { |
86 | get { return m_ownerID; } | 88 | get { return m_ownerID; } |
diff --git a/OpenSim/Tests/Common/Mock/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs index 52e0134..f3eaed3 100644 --- a/OpenSim/Tests/Common/Mock/TestClient.cs +++ b/OpenSim/Tests/Common/Mock/TestClient.cs | |||
@@ -379,6 +379,8 @@ namespace OpenSim.Tests.Common.Mock | |||
379 | get { return FirstName + " " + LastName; } | 379 | get { return FirstName + " " + LastName; } |
380 | } | 380 | } |
381 | 381 | ||
382 | public int PingTimeMS { get { return 0; } } | ||
383 | |||
382 | public bool IsActive | 384 | public bool IsActive |
383 | { | 385 | { |
384 | get { return true; } | 386 | get { return true; } |