diff options
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs')
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | 103 |
1 files changed, 89 insertions, 14 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index 14cc863..f8391d7 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | |||
@@ -70,6 +70,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
70 | public void AddScene(IScene scene) | 70 | public void AddScene(IScene scene) |
71 | { | 71 | { |
72 | m_udpServer.AddScene(scene); | 72 | m_udpServer.AddScene(scene); |
73 | |||
74 | StatsManager.RegisterStat( | ||
75 | new Stat( | ||
76 | "IncomingPacketsProcessedCount", | ||
77 | "Number of inbound UDP packets processed", | ||
78 | "Number of inbound UDP packets processed", | ||
79 | "", | ||
80 | "clientstack", | ||
81 | scene.Name, | ||
82 | StatType.Pull, | ||
83 | stat => stat.Value = m_udpServer.IncomingPacketsProcessed, | ||
84 | StatVerbosity.Debug)); | ||
73 | } | 85 | } |
74 | 86 | ||
75 | public bool HandlesRegion(Location x) | 87 | public bool HandlesRegion(Location x) |
@@ -170,6 +182,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
170 | 182 | ||
171 | private Pool<IncomingPacket> m_incomingPacketPool; | 183 | private Pool<IncomingPacket> m_incomingPacketPool; |
172 | 184 | ||
185 | /// <summary> | ||
186 | /// Stat for number of packets in the main pool awaiting use. | ||
187 | /// </summary> | ||
188 | private Stat m_poolCountStat; | ||
189 | |||
190 | /// <summary> | ||
191 | /// Stat for number of packets in the inbound packet pool awaiting use. | ||
192 | /// </summary> | ||
173 | private Stat m_incomingPacketPoolStat; | 193 | private Stat m_incomingPacketPoolStat; |
174 | 194 | ||
175 | private int m_defaultRTO = 0; | 195 | private int m_defaultRTO = 0; |
@@ -342,20 +362,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
342 | 362 | ||
343 | m_incomingPacketPool = new Pool<IncomingPacket>(() => new IncomingPacket(), 500); | 363 | m_incomingPacketPool = new Pool<IncomingPacket>(() => new IncomingPacket(), 500); |
344 | 364 | ||
345 | m_incomingPacketPoolStat | ||
346 | = new Stat( | ||
347 | "IncomingPacketPoolCount", | ||
348 | "Objects within incoming packet pool", | ||
349 | "The number of objects currently stored within the incoming packet pool", | ||
350 | "", | ||
351 | "clientstack", | ||
352 | "packetpool", | ||
353 | StatType.Pull, | ||
354 | stat => stat.Value = m_incomingPacketPool.Count, | ||
355 | StatVerbosity.Debug); | ||
356 | |||
357 | StatsManager.RegisterStat(m_incomingPacketPoolStat); | ||
358 | |||
359 | return true; | 365 | return true; |
360 | } | 366 | } |
361 | 367 | ||
@@ -379,6 +385,53 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
379 | } | 385 | } |
380 | 386 | ||
381 | /// <summary> | 387 | /// <summary> |
388 | /// This is a seperate method so that it can be called once we have an m_scene to distinguish different scene | ||
389 | /// stats. | ||
390 | /// </summary> | ||
391 | private void EnablePoolStats() | ||
392 | { | ||
393 | m_poolCountStat | ||
394 | = new Stat( | ||
395 | "UDPPacketBufferPoolCount", | ||
396 | "Objects within the UDPPacketBuffer pool", | ||
397 | "The number of objects currently stored within the UDPPacketBuffer pool", | ||
398 | "", | ||
399 | "clientstack", | ||
400 | m_scene.Name, | ||
401 | StatType.Pull, | ||
402 | stat => stat.Value = Pool.Count, | ||
403 | StatVerbosity.Debug); | ||
404 | |||
405 | StatsManager.RegisterStat(m_poolCountStat); | ||
406 | |||
407 | m_incomingPacketPoolStat | ||
408 | = new Stat( | ||
409 | "IncomingPacketPoolCount", | ||
410 | "Objects within incoming packet pool", | ||
411 | "The number of objects currently stored within the incoming packet pool", | ||
412 | "", | ||
413 | "clientstack", | ||
414 | m_scene.Name, | ||
415 | StatType.Pull, | ||
416 | stat => stat.Value = m_incomingPacketPool.Count, | ||
417 | StatVerbosity.Debug); | ||
418 | |||
419 | StatsManager.RegisterStat(m_incomingPacketPoolStat); | ||
420 | } | ||
421 | |||
422 | /// <summary> | ||
423 | /// Disables pool stats. | ||
424 | /// </summary> | ||
425 | private void DisablePoolStats() | ||
426 | { | ||
427 | StatsManager.DeregisterStat(m_poolCountStat); | ||
428 | m_poolCountStat = null; | ||
429 | |||
430 | StatsManager.DeregisterStat(m_incomingPacketPoolStat); | ||
431 | m_incomingPacketPoolStat = null; | ||
432 | } | ||
433 | |||
434 | /// <summary> | ||
382 | /// If the outgoing UDP thread times out, then return client that was being processed to help with debugging. | 435 | /// If the outgoing UDP thread times out, then return client that was being processed to help with debugging. |
383 | /// </summary> | 436 | /// </summary> |
384 | /// <returns></returns> | 437 | /// <returns></returns> |
@@ -416,6 +469,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
416 | 469 | ||
417 | m_scene = (Scene)scene; | 470 | m_scene = (Scene)scene; |
418 | m_location = new Location(m_scene.RegionInfo.RegionHandle); | 471 | m_location = new Location(m_scene.RegionInfo.RegionHandle); |
472 | |||
473 | // We delay enabling pool stats to AddScene() instead of Initialize() so that we can distinguish pool stats by | ||
474 | // scene name | ||
475 | if (UsePools) | ||
476 | EnablePoolStats(); | ||
419 | 477 | ||
420 | MainConsole.Instance.Commands.AddCommand( | 478 | MainConsole.Instance.Commands.AddCommand( |
421 | "Debug", | 479 | "Debug", |
@@ -505,12 +563,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
505 | if (enabled == "on") | 563 | if (enabled == "on") |
506 | { | 564 | { |
507 | if (EnablePools()) | 565 | if (EnablePools()) |
566 | { | ||
567 | EnablePoolStats(); | ||
508 | MainConsole.Instance.OutputFormat("Packet pools enabled on {0}", m_scene.Name); | 568 | MainConsole.Instance.OutputFormat("Packet pools enabled on {0}", m_scene.Name); |
569 | } | ||
509 | } | 570 | } |
510 | else if (enabled == "off") | 571 | else if (enabled == "off") |
511 | { | 572 | { |
512 | if (DisablePools()) | 573 | if (DisablePools()) |
574 | { | ||
575 | DisablePoolStats(); | ||
513 | MainConsole.Instance.OutputFormat("Packet pools disabled on {0}", m_scene.Name); | 576 | MainConsole.Instance.OutputFormat("Packet pools disabled on {0}", m_scene.Name); |
577 | } | ||
514 | } | 578 | } |
515 | else | 579 | else |
516 | { | 580 | { |
@@ -1556,6 +1620,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1556 | private int npacksSent = 0; | 1620 | private int npacksSent = 0; |
1557 | private int npackNotSent = 0; | 1621 | private int npackNotSent = 0; |
1558 | 1622 | ||
1623 | /// <summary> | ||
1624 | /// Number of inbound packets processed since startup. | ||
1625 | /// </summary> | ||
1626 | public long IncomingPacketsProcessed { get; private set; } | ||
1627 | |||
1559 | private void MonitoredClientOutgoingPacketHandler(IClientAPI client) | 1628 | private void MonitoredClientOutgoingPacketHandler(IClientAPI client) |
1560 | { | 1629 | { |
1561 | nticks++; | 1630 | nticks++; |
@@ -1615,7 +1684,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1615 | npacksSent++; | 1684 | npacksSent++; |
1616 | } | 1685 | } |
1617 | else | 1686 | else |
1687 | { | ||
1618 | npackNotSent++; | 1688 | npackNotSent++; |
1689 | } | ||
1619 | 1690 | ||
1620 | watch2.Stop(); | 1691 | watch2.Stop(); |
1621 | avgDequeueTicks = (nticks - 1) / (float)nticks * avgDequeueTicks + (watch2.ElapsedTicks / (float)nticks); | 1692 | avgDequeueTicks = (nticks - 1) / (float)nticks * avgDequeueTicks + (watch2.ElapsedTicks / (float)nticks); |
@@ -1623,7 +1694,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1623 | 1694 | ||
1624 | } | 1695 | } |
1625 | else | 1696 | else |
1697 | { | ||
1626 | m_log.WarnFormat("[LLUDPSERVER]: Client is not connected"); | 1698 | m_log.WarnFormat("[LLUDPSERVER]: Client is not connected"); |
1699 | } | ||
1627 | } | 1700 | } |
1628 | } | 1701 | } |
1629 | catch (Exception ex) | 1702 | catch (Exception ex) |
@@ -1687,6 +1760,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1687 | "[LLUDPSERVER]: Dropped incoming {0} for dead client {1} in {2}", | 1760 | "[LLUDPSERVER]: Dropped incoming {0} for dead client {1} in {2}", |
1688 | packet.Type, client.Name, m_scene.RegionInfo.RegionName); | 1761 | packet.Type, client.Name, m_scene.RegionInfo.RegionName); |
1689 | } | 1762 | } |
1763 | |||
1764 | IncomingPacketsProcessed++; | ||
1690 | } | 1765 | } |
1691 | 1766 | ||
1692 | protected void LogoutHandler(IClientAPI client) | 1767 | protected void LogoutHandler(IClientAPI client) |