aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
diff options
context:
space:
mode:
authorMelanie2012-11-15 03:46:10 +0000
committerMelanie2012-11-15 03:46:10 +0000
commit5895c4cc6f698bcb415b08a96322f06fb44413ca (patch)
tree5b223f297b27ac3966c65526f422fc82095b9b86 /OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
parentMerge branch 'master' into careminster (diff)
parentImprove inventory folder version updating for mssql database plugin. (diff)
downloadopensim-SC-5895c4cc6f698bcb415b08a96322f06fb44413ca.zip
opensim-SC-5895c4cc6f698bcb415b08a96322f06fb44413ca.tar.gz
opensim-SC-5895c4cc6f698bcb415b08a96322f06fb44413ca.tar.bz2
opensim-SC-5895c4cc6f698bcb415b08a96322f06fb44413ca.tar.xz
Merge branch 'master' into careminster
Conflicts: OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs')
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs157
1 files changed, 143 insertions, 14 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
index b8951d9..1ed6a74 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)
@@ -173,6 +185,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
173 private ExpiringCache<IPEndPoint, Queue<UDPPacketBuffer>> m_pendingCache = new ExpiringCache<IPEndPoint, Queue<UDPPacketBuffer>>(); 185 private ExpiringCache<IPEndPoint, Queue<UDPPacketBuffer>> m_pendingCache = new ExpiringCache<IPEndPoint, Queue<UDPPacketBuffer>>();
174 private Pool<IncomingPacket> m_incomingPacketPool; 186 private Pool<IncomingPacket> m_incomingPacketPool;
175 187
188 /// <summary>
189 /// Stat for number of packets in the main pool awaiting use.
190 /// </summary>
191 private Stat m_poolCountStat;
192
193 /// <summary>
194 /// Stat for number of packets in the inbound packet pool awaiting use.
195 /// </summary>
176 private Stat m_incomingPacketPoolStat; 196 private Stat m_incomingPacketPoolStat;
177 197
178 private int m_defaultRTO = 0; 198 private int m_defaultRTO = 0;
@@ -345,20 +365,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
345 365
346 m_incomingPacketPool = new Pool<IncomingPacket>(() => new IncomingPacket(), 500); 366 m_incomingPacketPool = new Pool<IncomingPacket>(() => new IncomingPacket(), 500);
347 367
348 m_incomingPacketPoolStat
349 = new Stat(
350 "IncomingPacketPoolCount",
351 "Objects within incoming packet pool",
352 "The number of objects currently stored within the incoming packet pool",
353 "",
354 "clientstack",
355 "packetpool",
356 StatType.Pull,
357 stat => stat.Value = m_incomingPacketPool.Count,
358 StatVerbosity.Debug);
359
360 StatsManager.RegisterStat(m_incomingPacketPoolStat);
361
362 return true; 368 return true;
363 } 369 }
364 370
@@ -382,6 +388,53 @@ namespace OpenSim.Region.ClientStack.LindenUDP
382 } 388 }
383 389
384 /// <summary> 390 /// <summary>
391 /// This is a seperate method so that it can be called once we have an m_scene to distinguish different scene
392 /// stats.
393 /// </summary>
394 private void EnablePoolStats()
395 {
396 m_poolCountStat
397 = new Stat(
398 "UDPPacketBufferPoolCount",
399 "Objects within the UDPPacketBuffer pool",
400 "The number of objects currently stored within the UDPPacketBuffer pool",
401 "",
402 "clientstack",
403 m_scene.Name,
404 StatType.Pull,
405 stat => stat.Value = Pool.Count,
406 StatVerbosity.Debug);
407
408 StatsManager.RegisterStat(m_poolCountStat);
409
410 m_incomingPacketPoolStat
411 = new Stat(
412 "IncomingPacketPoolCount",
413 "Objects within incoming packet pool",
414 "The number of objects currently stored within the incoming packet pool",
415 "",
416 "clientstack",
417 m_scene.Name,
418 StatType.Pull,
419 stat => stat.Value = m_incomingPacketPool.Count,
420 StatVerbosity.Debug);
421
422 StatsManager.RegisterStat(m_incomingPacketPoolStat);
423 }
424
425 /// <summary>
426 /// Disables pool stats.
427 /// </summary>
428 private void DisablePoolStats()
429 {
430 StatsManager.DeregisterStat(m_poolCountStat);
431 m_poolCountStat = null;
432
433 StatsManager.DeregisterStat(m_incomingPacketPoolStat);
434 m_incomingPacketPoolStat = null;
435 }
436
437 /// <summary>
385 /// If the outgoing UDP thread times out, then return client that was being processed to help with debugging. 438 /// If the outgoing UDP thread times out, then return client that was being processed to help with debugging.
386 /// </summary> 439 /// </summary>
387 /// <returns></returns> 440 /// <returns></returns>
@@ -420,6 +473,65 @@ namespace OpenSim.Region.ClientStack.LindenUDP
420 m_scene = (Scene)scene; 473 m_scene = (Scene)scene;
421 m_location = new Location(m_scene.RegionInfo.RegionHandle); 474 m_location = new Location(m_scene.RegionInfo.RegionHandle);
422 475
476 // XXX: These stats are also pool stats but we register them separately since they are currently not
477 // turned on and off by EnablePools()/DisablePools()
478 StatsManager.RegisterStat(
479 new PercentageStat(
480 "PacketsReused",
481 "Packets reused",
482 "Number of packets reused out of all requests to the packet pool",
483 "clientstack",
484 m_scene.Name,
485 StatType.Pull,
486 stat =>
487 { PercentageStat pstat = (PercentageStat)stat;
488 pstat.Consequent = PacketPool.Instance.PacketsRequested;
489 pstat.Antecedent = PacketPool.Instance.PacketsReused; },
490 StatVerbosity.Debug));
491
492 StatsManager.RegisterStat(
493 new PercentageStat(
494 "PacketDataBlocksReused",
495 "Packet data blocks reused",
496 "Number of data blocks reused out of all requests to the packet pool",
497 "clientstack",
498 m_scene.Name,
499 StatType.Pull,
500 stat =>
501 { PercentageStat pstat = (PercentageStat)stat;
502 pstat.Consequent = PacketPool.Instance.BlocksRequested;
503 pstat.Antecedent = PacketPool.Instance.BlocksReused; },
504 StatVerbosity.Debug));
505
506 StatsManager.RegisterStat(
507 new Stat(
508 "PacketsPoolCount",
509 "Objects within the packet pool",
510 "The number of objects currently stored within the packet pool",
511 "",
512 "clientstack",
513 m_scene.Name,
514 StatType.Pull,
515 stat => stat.Value = PacketPool.Instance.PacketsPooled,
516 StatVerbosity.Debug));
517
518 StatsManager.RegisterStat(
519 new Stat(
520 "PacketDataBlocksPoolCount",
521 "Objects within the packet data block pool",
522 "The number of objects currently stored within the packet data block pool",
523 "",
524 "clientstack",
525 m_scene.Name,
526 StatType.Pull,
527 stat => stat.Value = PacketPool.Instance.BlocksPooled,
528 StatVerbosity.Debug));
529
530 // We delay enabling pool stats to AddScene() instead of Initialize() so that we can distinguish pool stats by
531 // scene name
532 if (UsePools)
533 EnablePoolStats();
534
423 MainConsole.Instance.Commands.AddCommand( 535 MainConsole.Instance.Commands.AddCommand(
424 "Debug", 536 "Debug",
425 false, 537 false,
@@ -508,12 +620,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP
508 if (enabled == "on") 620 if (enabled == "on")
509 { 621 {
510 if (EnablePools()) 622 if (EnablePools())
623 {
624 EnablePoolStats();
511 MainConsole.Instance.OutputFormat("Packet pools enabled on {0}", m_scene.Name); 625 MainConsole.Instance.OutputFormat("Packet pools enabled on {0}", m_scene.Name);
626 }
512 } 627 }
513 else if (enabled == "off") 628 else if (enabled == "off")
514 { 629 {
515 if (DisablePools()) 630 if (DisablePools())
631 {
632 DisablePoolStats();
516 MainConsole.Instance.OutputFormat("Packet pools disabled on {0}", m_scene.Name); 633 MainConsole.Instance.OutputFormat("Packet pools disabled on {0}", m_scene.Name);
634 }
517 } 635 }
518 else 636 else
519 { 637 {
@@ -1621,6 +1739,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1621 private int npacksSent = 0; 1739 private int npacksSent = 0;
1622 private int npackNotSent = 0; 1740 private int npackNotSent = 0;
1623 1741
1742 /// <summary>
1743 /// Number of inbound packets processed since startup.
1744 /// </summary>
1745 public long IncomingPacketsProcessed { get; private set; }
1746
1624 private void MonitoredClientOutgoingPacketHandler(IClientAPI client) 1747 private void MonitoredClientOutgoingPacketHandler(IClientAPI client)
1625 { 1748 {
1626 nticks++; 1749 nticks++;
@@ -1680,7 +1803,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1680 npacksSent++; 1803 npacksSent++;
1681 } 1804 }
1682 else 1805 else
1806 {
1683 npackNotSent++; 1807 npackNotSent++;
1808 }
1684 1809
1685 watch2.Stop(); 1810 watch2.Stop();
1686 avgDequeueTicks = (nticks - 1) / (float)nticks * avgDequeueTicks + (watch2.ElapsedTicks / (float)nticks); 1811 avgDequeueTicks = (nticks - 1) / (float)nticks * avgDequeueTicks + (watch2.ElapsedTicks / (float)nticks);
@@ -1688,7 +1813,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1688 1813
1689 } 1814 }
1690 else 1815 else
1816 {
1691 m_log.WarnFormat("[LLUDPSERVER]: Client is not connected"); 1817 m_log.WarnFormat("[LLUDPSERVER]: Client is not connected");
1818 }
1692 } 1819 }
1693 } 1820 }
1694 catch (Exception ex) 1821 catch (Exception ex)
@@ -1752,6 +1879,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1752// "[LLUDPSERVER]: Dropped incoming {0} for dead client {1} in {2}", 1879// "[LLUDPSERVER]: Dropped incoming {0} for dead client {1} in {2}",
1753// packet.Type, client.Name, m_scene.RegionInfo.RegionName); 1880// packet.Type, client.Name, m_scene.RegionInfo.RegionName);
1754// } 1881// }
1882
1883 IncomingPacketsProcessed++;
1755 } 1884 }
1756 1885
1757 protected void LogoutHandler(IClientAPI client) 1886 protected void LogoutHandler(IClientAPI client)