aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2012-10-11 23:58:37 +0100
committerJustin Clark-Casey (justincc)2012-10-11 23:58:37 +0100
commit2e9ef015f7b73a3942011a36a9f94ce59d848dc0 (patch)
tree7045611afacf2b4be3e5543c142a1fd9c047de2f /OpenSim
parentMerge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff)
downloadopensim-SC_OLD-2e9ef015f7b73a3942011a36a9f94ce59d848dc0.zip
opensim-SC_OLD-2e9ef015f7b73a3942011a36a9f94ce59d848dc0.tar.gz
opensim-SC_OLD-2e9ef015f7b73a3942011a36a9f94ce59d848dc0.tar.bz2
opensim-SC_OLD-2e9ef015f7b73a3942011a36a9f94ce59d848dc0.tar.xz
Fix packetpool for ImprovedTerseObjectUpdate packets.
These were neither being returned or in many places reused. Getting packets from a pool rather than deallocating and reallocating reduces memory churn which in turn reduces garbage collection time and frequency.
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Framework/Monitoring/StatsManager.cs16
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs14
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs2
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/PacketPool.cs4
4 files changed, 28 insertions, 8 deletions
diff --git a/OpenSim/Framework/Monitoring/StatsManager.cs b/OpenSim/Framework/Monitoring/StatsManager.cs
index a67c5f8..d365190 100644
--- a/OpenSim/Framework/Monitoring/StatsManager.cs
+++ b/OpenSim/Framework/Monitoring/StatsManager.cs
@@ -126,8 +126,7 @@ namespace OpenSim.Framework.Monitoring
126 { 126 {
127 foreach (Stat stat in container.Values) 127 foreach (Stat stat in container.Values)
128 { 128 {
129 con.OutputFormat( 129 con.Output(stat.ToConsoleString());
130 "{0}.{1}.{2} : {3}{4}", stat.Category, stat.Container, stat.ShortName, stat.Value, stat.UnitName);
131 } 130 }
132 } 131 }
133 } 132 }
@@ -330,6 +329,12 @@ namespace OpenSim.Framework.Monitoring
330 { 329 {
331 return string.Format("{0}+{1}+{2}", container, category, shortName); 330 return string.Format("{0}+{1}+{2}", container, category, shortName);
332 } 331 }
332
333 public virtual string ToConsoleString()
334 {
335 return string.Format(
336 "{0}.{1}.{2} : {3}{4}", Category, Container, ShortName, Value, UnitName);
337 }
333 } 338 }
334 339
335 public class PercentageStat : Stat 340 public class PercentageStat : Stat
@@ -358,8 +363,13 @@ namespace OpenSim.Framework.Monitoring
358 363
359 public PercentageStat( 364 public PercentageStat(
360 string shortName, string name, string category, string container, StatVerbosity verbosity, string description) 365 string shortName, string name, string category, string container, StatVerbosity verbosity, string description)
361 : base(shortName, name, "%", category, container, verbosity, description) 366 : base(shortName, name, "%", category, container, verbosity, description) {}
367
368 public override string ToConsoleString()
362 { 369 {
370 return string.Format(
371 "{0}.{1}.{2} : {3:0.###}{4} ({5}/{6})",
372 Category, Container, ShortName, Value, UnitName, Antecedent, Consequent);
363 } 373 }
364 } 374 }
365} \ No newline at end of file 375} \ No newline at end of file
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index 62f51d9..dc88686 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -3922,7 +3922,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3922 { 3922 {
3923 List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock> blocks = terseAgentUpdateBlocks.Value; 3923 List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock> blocks = terseAgentUpdateBlocks.Value;
3924 3924
3925 ImprovedTerseObjectUpdatePacket packet = new ImprovedTerseObjectUpdatePacket(); 3925 ImprovedTerseObjectUpdatePacket packet
3926 = (ImprovedTerseObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ImprovedTerseObjectUpdate);
3927
3926 packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; 3928 packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle;
3927 packet.RegionData.TimeDilation = timeDilation; 3929 packet.RegionData.TimeDilation = timeDilation;
3928 packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[blocks.Count]; 3930 packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[blocks.Count];
@@ -3967,7 +3969,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3967 { 3969 {
3968 List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock> blocks = terseUpdateBlocks.Value; 3970 List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock> blocks = terseUpdateBlocks.Value;
3969 3971
3970 ImprovedTerseObjectUpdatePacket packet = new ImprovedTerseObjectUpdatePacket(); 3972 ImprovedTerseObjectUpdatePacket packet
3973 = (ImprovedTerseObjectUpdatePacket)PacketPool.Instance.GetPacket(
3974 PacketType.ImprovedTerseObjectUpdate);
3975
3971 packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; 3976 packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle;
3972 packet.RegionData.TimeDilation = timeDilation; 3977 packet.RegionData.TimeDilation = timeDilation;
3973 packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[blocks.Count]; 3978 packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[blocks.Count];
@@ -12286,7 +12291,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
12286 ushort timeDilation = Utils.FloatToUInt16(TIME_DILATION, 0.0f, 1.0f); 12291 ushort timeDilation = Utils.FloatToUInt16(TIME_DILATION, 0.0f, 1.0f);
12287 12292
12288 12293
12289 ImprovedTerseObjectUpdatePacket packet = new ImprovedTerseObjectUpdatePacket(); 12294 ImprovedTerseObjectUpdatePacket packet
12295 = (ImprovedTerseObjectUpdatePacket)PacketPool.Instance.GetPacket(
12296 PacketType.ImprovedTerseObjectUpdate);
12297
12290 packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; 12298 packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle;
12291 packet.RegionData.TimeDilation = timeDilation; 12299 packet.RegionData.TimeDilation = timeDilation;
12292 packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; 12300 packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1];
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
index ab670a7..6d2cda5 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
@@ -420,6 +420,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
420 byte[] data = packet.ToBytes(); 420 byte[] data = packet.ToBytes();
421 SendPacketData(udpClient, data, packet.Type, category, method); 421 SendPacketData(udpClient, data, packet.Type, category, method);
422 } 422 }
423
424 PacketPool.Instance.ReturnPacket(packet);
423 } 425 }
424 426
425 /// <summary> 427 /// <summary>
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/PacketPool.cs b/OpenSim/Region/ClientStack/Linden/UDP/PacketPool.cs
index 3d9f94f..fd6b0ed 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/PacketPool.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/PacketPool.cs
@@ -47,7 +47,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
47 private PercentageStat m_packetsReusedStat = new PercentageStat( 47 private PercentageStat m_packetsReusedStat = new PercentageStat(
48 "PacketsReused", 48 "PacketsReused",
49 "Packets reused", 49 "Packets reused",
50 "simulator", 50 "clientstack",
51 "simulator", 51 "simulator",
52 StatVerbosity.Debug, 52 StatVerbosity.Debug,
53 "Number of packets reused out of all requests to the packet pool"); 53 "Number of packets reused out of all requests to the packet pool");
@@ -55,7 +55,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
55 private PercentageStat m_blocksReusedStat = new PercentageStat( 55 private PercentageStat m_blocksReusedStat = new PercentageStat(
56 "BlocksReused", 56 "BlocksReused",
57 "Blocks reused", 57 "Blocks reused",
58 "simulator", 58 "clientstack",
59 "simulator", 59 "simulator",
60 StatVerbosity.Debug, 60 StatVerbosity.Debug,
61 "Number of data blocks reused out of all requests to the packet pool"); 61 "Number of data blocks reused out of all requests to the packet pool");