aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/OptionalModules/Agent/UDP
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2011-01-21 00:56:37 +0000
committerJustin Clark-Casey (justincc)2011-01-21 00:56:37 +0000
commit38debbc59fe29d2b0bb6ea1f075e43c960f53676 (patch)
treea5a9b744c1f0b07ea9f37da7d94627f8094b4533 /OpenSim/Region/OptionalModules/Agent/UDP
parentimplement "show throttles" command for showing current agent throttles and th... (diff)
downloadopensim-SC_OLD-38debbc59fe29d2b0bb6ea1f075e43c960f53676.zip
opensim-SC_OLD-38debbc59fe29d2b0bb6ea1f075e43c960f53676.tar.gz
opensim-SC_OLD-38debbc59fe29d2b0bb6ea1f075e43c960f53676.tar.bz2
opensim-SC_OLD-38debbc59fe29d2b0bb6ea1f075e43c960f53676.tar.xz
crudely refactor table generation code for "show queues" and "show throttles"
Diffstat (limited to 'OpenSim/Region/OptionalModules/Agent/UDP')
-rw-r--r--OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs71
1 files changed, 30 insertions, 41 deletions
diff --git a/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs b/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs
index 480df31..0a256a1 100644
--- a/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs
+++ b/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs
@@ -121,6 +121,14 @@ namespace OpenSim.Region.CoreModules.UDP.Linden
121 MainConsole.Instance.Output(GetThrottlesReport(cmd)); 121 MainConsole.Instance.Output(GetThrottlesReport(cmd));
122 } 122 }
123 123
124 protected string GetColumnEntry(string entry, int maxLength, int columnPadding)
125 {
126 return string.Format(
127 "{0,-" + maxLength + "}{1,-" + columnPadding + "}",
128 entry.Length > maxLength ? entry.Substring(0, maxLength) : entry,
129 "");
130 }
131
124 /// <summary> 132 /// <summary>
125 /// Generate UDP Queue data report for each client 133 /// Generate UDP Queue data report for each client
126 /// </summary> 134 /// </summary>
@@ -140,10 +148,10 @@ namespace OpenSim.Region.CoreModules.UDP.Linden
140 int maxRegionNameLength = 14; 148 int maxRegionNameLength = 14;
141 int maxTypeLength = 4; 149 int maxTypeLength = 4;
142 int totalInfoFieldsLength = maxNameLength + columnPadding + maxRegionNameLength + columnPadding + maxTypeLength + columnPadding; 150 int totalInfoFieldsLength = maxNameLength + columnPadding + maxRegionNameLength + columnPadding + maxTypeLength + columnPadding;
143 151
144 report.AppendFormat("{0,-" + maxNameLength + "}{1,-" + columnPadding + "}", "User", ""); 152 report.Append(GetColumnEntry("User", maxNameLength, columnPadding));
145 report.AppendFormat("{0,-" + maxRegionNameLength + "}{1,-" + columnPadding + "}", "Region", ""); 153 report.Append(GetColumnEntry("Region", maxRegionNameLength, columnPadding));
146 report.AppendFormat("{0,-" + maxTypeLength + "}{1,-" + columnPadding + "}", "Type", ""); 154 report.Append(GetColumnEntry("Type", maxTypeLength, columnPadding));
147 155
148 report.AppendFormat( 156 report.AppendFormat(
149 "{0,7} {1,7} {2,9} {3,8} {4,7} {5,7} {6,7} {7,7} {8,9} {9,7} {10,7}\n", 157 "{0,7} {1,7} {2,9} {3,8} {4,7} {5,7} {6,7} {7,7} {8,9} {9,7} {10,7}\n",
@@ -190,15 +198,9 @@ namespace OpenSim.Region.CoreModules.UDP.Linden
190 string name = client.Name; 198 string name = client.Name;
191 string regionName = scene.RegionInfo.RegionName; 199 string regionName = scene.RegionInfo.RegionName;
192 200
193 report.AppendFormat( 201 report.Append(GetColumnEntry(name, maxNameLength, columnPadding));
194 "{0,-" + maxNameLength + "}{1,-" + columnPadding + "}", 202 report.Append(GetColumnEntry(regionName, maxRegionNameLength, columnPadding));
195 name.Length > maxNameLength ? name.Substring(0, maxNameLength) : name, ""); 203 report.Append(GetColumnEntry(isChild ? "Cd" : "Rt", maxTypeLength, columnPadding));
196 report.AppendFormat(
197 "{0,-" + maxRegionNameLength + "}{1,-" + columnPadding + "}",
198 regionName.Length > maxRegionNameLength ? regionName.Substring(0, maxRegionNameLength) : regionName, "");
199 report.AppendFormat(
200 "{0,-" + maxTypeLength + "}{1,-" + columnPadding + "}",
201 isChild ? "Cd" : "Rt", "");
202 204
203 IStatsCollector stats = (IStatsCollector)client; 205 IStatsCollector stats = (IStatsCollector)client;
204 206
@@ -228,12 +230,11 @@ namespace OpenSim.Region.CoreModules.UDP.Linden
228 int columnPadding = 2; 230 int columnPadding = 2;
229 int maxNameLength = 18; 231 int maxNameLength = 18;
230 int maxRegionNameLength = 14; 232 int maxRegionNameLength = 14;
231 int maxTypeLength = 4; 233 int maxTypeLength = 4;
232 int totalInfoFieldsLength = maxNameLength + columnPadding + maxRegionNameLength + columnPadding + maxTypeLength + columnPadding; 234
233 235 report.Append(GetColumnEntry("User", maxNameLength, columnPadding));
234 report.AppendFormat("{0,-" + maxNameLength + "}{1,-" + columnPadding + "}", "User", ""); 236 report.Append(GetColumnEntry("Region", maxRegionNameLength, columnPadding));
235 report.AppendFormat("{0,-" + maxRegionNameLength + "}{1,-" + columnPadding + "}", "Region", ""); 237 report.Append(GetColumnEntry("Type\n", maxTypeLength, columnPadding));
236 report.AppendFormat("{0,-" + maxTypeLength + "}{1,-" + columnPadding + "}", "Type\n", "");
237 238
238 bool firstClient = true; 239 bool firstClient = true;
239 240
@@ -263,16 +264,10 @@ namespace OpenSim.Region.CoreModules.UDP.Linden
263 264
264 LLUDPClient llUdpClient = llClient.UDPClient; 265 LLUDPClient llUdpClient = llClient.UDPClient;
265 ClientInfo ci = llUdpClient.GetClientInfo(); 266 ClientInfo ci = llUdpClient.GetClientInfo();
266 267
267 report.AppendFormat( 268 report.Append(GetColumnEntry(name, maxNameLength, columnPadding));
268 "{0,-" + maxNameLength + "}{1,-" + columnPadding + "}", 269 report.Append(GetColumnEntry(regionName, maxRegionNameLength, columnPadding));
269 name.Length > maxNameLength ? name.Substring(0, maxNameLength) : name, ""); 270 report.Append(GetColumnEntry(isChild ? "Cd" : "Rt", maxTypeLength, columnPadding));
270 report.AppendFormat(
271 "{0,-" + maxRegionNameLength + "}{1,-" + columnPadding + "}",
272 regionName.Length > maxRegionNameLength ? regionName.Substring(0, maxRegionNameLength) : regionName, "");
273 report.AppendFormat(
274 "{0,-" + maxTypeLength + "}{1,-" + columnPadding + "}",
275 isChild ? "Cd" : "Rt", "");
276 271
277 report.Append((ci.totalThrottle * 8) / 1000 + " "); 272 report.Append((ci.totalThrottle * 8) / 1000 + " ");
278 report.Append((ci.resendThrottle * 8) / 1000 + " "); 273 report.Append((ci.resendThrottle * 8) / 1000 + " ");
@@ -299,23 +294,17 @@ namespace OpenSim.Region.CoreModules.UDP.Linden
299 int columnPadding = 2; 294 int columnPadding = 2;
300 int maxNameLength = 18; 295 int maxNameLength = 18;
301 int maxRegionNameLength = 14; 296 int maxRegionNameLength = 14;
302 int maxTypeLength = 4; 297 int maxTypeLength = 4;
303 int totalInfoFieldsLength = maxNameLength + columnPadding + maxRegionNameLength + columnPadding + maxTypeLength + columnPadding;
304 298
305 string name = "SERVER LIMITS"; 299 string name = "SERVER LIMITS";
306 string regionName = scene.RegionInfo.RegionName; 300 string regionName = scene.RegionInfo.RegionName;
307 301
308 report.AppendFormat( 302 report.Append(GetColumnEntry(name, maxNameLength, columnPadding));
309 "{0,-" + maxNameLength + "}{1,-" + columnPadding + "}", 303 report.Append(GetColumnEntry(regionName, maxRegionNameLength, columnPadding));
310 name.Length > maxNameLength ? name.Substring(0, maxNameLength) : name, ""); 304 report.Append(GetColumnEntry("n/a", maxTypeLength, columnPadding));
311 report.AppendFormat(
312 "{0,-" + maxRegionNameLength + "}{1,-" + columnPadding + "}",
313 regionName.Length > maxRegionNameLength ? regionName.Substring(0, maxRegionNameLength) : regionName, "");
314 report.AppendFormat(
315 "{0,-" + maxTypeLength + "}{1,-" + columnPadding + "}", "n/a", "");
316 305
317 ThrottleRates throttleRates = udpServer.ThrottleRates; 306 ThrottleRates throttleRates = udpServer.ThrottleRates;
318 report.Append("n/a"); 307 report.Append("n/a ");
319 report.Append((throttleRates.ResendLimit * 8) / 1000 + " "); 308 report.Append((throttleRates.ResendLimit * 8) / 1000 + " ");
320 report.Append((throttleRates.LandLimit * 8) / 1000 + " "); 309 report.Append((throttleRates.LandLimit * 8) / 1000 + " ");
321 report.Append((throttleRates.WindLimit * 8) / 1000 + " "); 310 report.Append((throttleRates.WindLimit * 8) / 1000 + " ");