aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework
diff options
context:
space:
mode:
authorJustin Clarke Casey2008-02-22 20:50:30 +0000
committerJustin Clarke Casey2008-02-22 20:50:30 +0000
commit30eea2618dcc0a43d1d4d764590100c19bd7c05d (patch)
tree95d743afebbc8310ba15949131ab11a1d52c21fa /OpenSim/Framework
parentSome misplaced code made scripts never start :) (diff)
downloadopensim-SC_OLD-30eea2618dcc0a43d1d4d764590100c19bd7c05d.zip
opensim-SC_OLD-30eea2618dcc0a43d1d4d764590100c19bd7c05d.tar.gz
opensim-SC_OLD-30eea2618dcc0a43d1d4d764590100c19bd7c05d.tar.bz2
opensim-SC_OLD-30eea2618dcc0a43d1d4d764590100c19bd7c05d.tar.xz
* Implement packet queue statistics
* This will show the packets waiting in each queue for each client logged into a region server * These are displayed using 'show stats' on the region command line * This is in pursuit of a memory leak. * This will require a prebuild
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r--OpenSim/Framework/Statistics/SimExtraStatsReporter.cs95
1 files changed, 88 insertions, 7 deletions
diff --git a/OpenSim/Framework/Statistics/SimExtraStatsReporter.cs b/OpenSim/Framework/Statistics/SimExtraStatsReporter.cs
index c8b8223..acf2ecb 100644
--- a/OpenSim/Framework/Statistics/SimExtraStatsReporter.cs
+++ b/OpenSim/Framework/Statistics/SimExtraStatsReporter.cs
@@ -26,12 +26,19 @@
26* 26*
27*/ 27*/
28 28
29using System;
30using System.Collections.Generic;
31using System.Text;
32
29using OpenSim.Framework; 33using OpenSim.Framework;
34using OpenSim.Framework.Statistics.Interfaces;
35
36using libsecondlife;
30 37
31namespace OpenSim.Framework.Statistics 38namespace OpenSim.Framework.Statistics
32{ 39{
33 public class SimExtraStatsReporter 40 public class SimExtraStatsReporter
34 { 41 {
35 private long assetsInCache; 42 private long assetsInCache;
36 private long texturesInCache; 43 private long texturesInCache;
37 private long assetCacheMemoryUsage; 44 private long assetCacheMemoryUsage;
@@ -42,6 +49,12 @@ namespace OpenSim.Framework.Statistics
42 public long AssetCacheMemoryUsage { get { return assetCacheMemoryUsage; } } 49 public long AssetCacheMemoryUsage { get { return assetCacheMemoryUsage; } }
43 public long TextureCacheMemoryUsage { get { return textureCacheMemoryUsage; } } 50 public long TextureCacheMemoryUsage { get { return textureCacheMemoryUsage; } }
44 51
52 /// <summary>
53 /// Retain a dictionary of all packet queues stats reporters
54 /// </summary>
55 private IDictionary<LLUUID, PacketQueueStatsReporter> packetQueueStatsReporters
56 = new Dictionary<LLUUID, PacketQueueStatsReporter>();
57
45 public void AddAsset(AssetBase asset) 58 public void AddAsset(AssetBase asset)
46 { 59 {
47 assetsInCache++; 60 assetsInCache++;
@@ -56,19 +69,87 @@ namespace OpenSim.Framework.Statistics
56 texturesInCache++; 69 texturesInCache++;
57 textureCacheMemoryUsage += image.Data.Length; 70 textureCacheMemoryUsage += image.Data.Length;
58 } 71 }
59 } 72 }
73
74 /// <summary>
75 /// Register as a packet queue stats provider
76 /// </summary>
77 /// <param name="uuid">An agent LLUUID</param>
78 /// <param name="provider"></param>
79 public void RegisterPacketQueueStatsProvider(LLUUID uuid, IPullStatsProvider provider)
80 {
81 lock (packetQueueStatsReporters)
82 {
83 packetQueueStatsReporters[uuid] = new PacketQueueStatsReporter(provider);
84 }
85 }
86
87 /// <summary>
88 /// Deregister a packet queue stats provider
89 /// </summary>
90 /// <param name="uuid">An agent LLUUID</param>
91 public void DeregisterPacketQueueStatsProvider(LLUUID uuid)
92 {
93 lock (packetQueueStatsReporters)
94 {
95 packetQueueStatsReporters.Remove(uuid);
96 }
97 }
60 98
61 /// <summary> 99 /// <summary>
62 /// Report back collected statistical information. 100 /// Report back collected statistical information.
63 /// </summary> 101 /// </summary>
64 /// <returns></returns> 102 /// <returns></returns>
65 public string Report() 103 public string Report()
66 { 104 {
67 return string.Format( 105 StringBuilder sb = new StringBuilder(Environment.NewLine);
106 sb.Append("PACKET QUEUE STATISTICS");
107 sb.Append(Environment.NewLine);
108 sb.Append(
109 string.Format(
68@"Asset cache contains {0,6} assets using {1,10:0.000}K 110@"Asset cache contains {0,6} assets using {1,10:0.000}K
69Texture cache contains {2,6} textures using {3,10:0.000}K", 111Texture cache contains {2,6} textures using {3,10:0.000}K" + Environment.NewLine,
70 AssetsInCache, AssetCacheMemoryUsage / 1024.0, 112 AssetsInCache, AssetCacheMemoryUsage / 1024.0,
71 TexturesInCache, TextureCacheMemoryUsage / 1024.0); 113 TexturesInCache, TextureCacheMemoryUsage / 1024.0));
114
115 sb.Append(Environment.NewLine);
116 sb.Append("PACKET QUEUE STATISTICS");
117 sb.Append(Environment.NewLine);
118 sb.Append("Agent UUID ");
119 sb.Append(" Send In Out Resend ");
120 sb.Append(" Land Wind Cloud Task Texture Asset");
121 sb.Append(Environment.NewLine);
122
123 foreach (LLUUID key in packetQueueStatsReporters.Keys)
124 {
125 sb.Append(string.Format("{0}: ", key));
126 sb.Append(packetQueueStatsReporters[key].Report());
127 sb.Append(Environment.NewLine);
128 }
129
130 return sb.ToString();
72 } 131 }
73 } 132 }
133
134 /// <summary>
135 /// Pull packet queue stats from packet queues and report
136 /// </summary>
137 public class PacketQueueStatsReporter
138 {
139 private IPullStatsProvider m_statsProvider;
140
141 public PacketQueueStatsReporter(IPullStatsProvider provider)
142 {
143 m_statsProvider = provider;
144 }
145
146 /// <summary>
147 /// Report back collected statistical information.
148 /// </summary>
149 /// <returns></returns>
150 public string Report()
151 {
152 return m_statsProvider.GetStats();
153 }
154 }
74} 155}