diff options
Diffstat (limited to 'OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs')
-rw-r--r-- | OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs | 151 |
1 files changed, 131 insertions, 20 deletions
diff --git a/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs b/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs index c754019..261029c 100644 --- a/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs +++ b/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs | |||
@@ -79,7 +79,19 @@ namespace OpenSim.Region.CoreModules.UDP.Linden | |||
79 | // m_log.DebugFormat("[LINDEN UDP INFO MODULE]: REGION {0} ADDED", scene.RegionInfo.RegionName); | 79 | // m_log.DebugFormat("[LINDEN UDP INFO MODULE]: REGION {0} ADDED", scene.RegionInfo.RegionName); |
80 | 80 | ||
81 | lock (m_scenes) | 81 | lock (m_scenes) |
82 | m_scenes[scene.RegionInfo.RegionID] = scene; | 82 | m_scenes[scene.RegionInfo.RegionID] = scene; |
83 | |||
84 | scene.AddCommand( | ||
85 | this, "image queues clear", | ||
86 | "image queues clear <first-name> <last-name>", | ||
87 | "Clear the image queues (textures downloaded via UDP) for a particular client.", | ||
88 | (mod, cmd) => MainConsole.Instance.Output(HandleImageQueuesClear(cmd))); | ||
89 | |||
90 | scene.AddCommand( | ||
91 | this, "image queues show", | ||
92 | "image queues show <first-name> <last-name>", | ||
93 | "Show the image queues (textures downloaded via UDP) for a particular client.", | ||
94 | (mod, cmd) => MainConsole.Instance.Output(GetImageQueuesReport(cmd))); | ||
83 | 95 | ||
84 | scene.AddCommand( | 96 | scene.AddCommand( |
85 | this, "show pqueues", | 97 | this, "show pqueues", |
@@ -87,7 +99,7 @@ namespace OpenSim.Region.CoreModules.UDP.Linden | |||
87 | "Show priority queue data for each client", | 99 | "Show priority queue data for each client", |
88 | "Without the 'full' option, only root agents are shown." | 100 | "Without the 'full' option, only root agents are shown." |
89 | + " With the 'full' option child agents are also shown.", | 101 | + " With the 'full' option child agents are also shown.", |
90 | ShowPQueuesReport); | 102 | (mod, cmd) => MainConsole.Instance.Output(GetPQueuesReport(cmd))); |
91 | 103 | ||
92 | scene.AddCommand( | 104 | scene.AddCommand( |
93 | this, "show queues", | 105 | this, "show queues", |
@@ -95,7 +107,13 @@ namespace OpenSim.Region.CoreModules.UDP.Linden | |||
95 | "Show queue data for each client", | 107 | "Show queue data for each client", |
96 | "Without the 'full' option, only root agents are shown." | 108 | "Without the 'full' option, only root agents are shown." |
97 | + " With the 'full' option child agents are also shown.", | 109 | + " With the 'full' option child agents are also shown.", |
98 | ShowQueuesReport); | 110 | (mod, cmd) => MainConsole.Instance.Output(GetQueuesReport(cmd))); |
111 | |||
112 | scene.AddCommand( | ||
113 | this, "show image queues", | ||
114 | "show image queues <first-name> <last-name>", | ||
115 | "Show the image queues (textures downloaded via UDP) for a particular client.", | ||
116 | (mod, cmd) => MainConsole.Instance.Output(GetImageQueuesReport(cmd))); | ||
99 | 117 | ||
100 | scene.AddCommand( | 118 | scene.AddCommand( |
101 | this, "show throttles", | 119 | this, "show throttles", |
@@ -103,14 +121,14 @@ namespace OpenSim.Region.CoreModules.UDP.Linden | |||
103 | "Show throttle settings for each client and for the server overall", | 121 | "Show throttle settings for each client and for the server overall", |
104 | "Without the 'full' option, only root agents are shown." | 122 | "Without the 'full' option, only root agents are shown." |
105 | + " With the 'full' option child agents are also shown.", | 123 | + " With the 'full' option child agents are also shown.", |
106 | ShowThrottlesReport); | 124 | (mod, cmd) => MainConsole.Instance.Output(GetThrottlesReport(cmd))); |
107 | 125 | ||
108 | scene.AddCommand( | 126 | scene.AddCommand( |
109 | this, "emergency-monitoring", | 127 | this, "emergency-monitoring", |
110 | "emergency-monitoring", | 128 | "emergency-monitoring", |
111 | "Go on/off emergency monitoring mode", | 129 | "Go on/off emergency monitoring mode", |
112 | "Go on/off emergency monitoring mode", | 130 | "Go on/off emergency monitoring mode", |
113 | EmergencyMonitoring); | 131 | HandleEmergencyMonitoring); |
114 | } | 132 | } |
115 | 133 | ||
116 | public void RemoveRegion(Scene scene) | 134 | public void RemoveRegion(Scene scene) |
@@ -124,24 +142,51 @@ namespace OpenSim.Region.CoreModules.UDP.Linden | |||
124 | public void RegionLoaded(Scene scene) | 142 | public void RegionLoaded(Scene scene) |
125 | { | 143 | { |
126 | // m_log.DebugFormat("[LINDEN UDP INFO MODULE]: REGION {0} LOADED", scene.RegionInfo.RegionName); | 144 | // m_log.DebugFormat("[LINDEN UDP INFO MODULE]: REGION {0} LOADED", scene.RegionInfo.RegionName); |
127 | } | ||
128 | |||
129 | protected void ShowPQueuesReport(string module, string[] cmd) | ||
130 | { | ||
131 | MainConsole.Instance.Output(GetPQueuesReport(cmd)); | ||
132 | } | 145 | } |
133 | 146 | ||
134 | protected void ShowQueuesReport(string module, string[] cmd) | 147 | protected string HandleImageQueuesClear(string[] cmd) |
135 | { | ||
136 | MainConsole.Instance.Output(GetQueuesReport(cmd)); | ||
137 | } | ||
138 | |||
139 | protected void ShowThrottlesReport(string module, string[] cmd) | ||
140 | { | 148 | { |
141 | MainConsole.Instance.Output(GetThrottlesReport(cmd)); | 149 | if (cmd.Length != 5) |
150 | return "Usage: image queues clear <first-name> <last-name>"; | ||
151 | |||
152 | string firstName = cmd[3]; | ||
153 | string lastName = cmd[4]; | ||
154 | |||
155 | List<ScenePresence> foundAgents = new List<ScenePresence>(); | ||
156 | |||
157 | lock (m_scenes) | ||
158 | { | ||
159 | foreach (Scene scene in m_scenes.Values) | ||
160 | { | ||
161 | ScenePresence sp = scene.GetScenePresence(firstName, lastName); | ||
162 | if (sp != null) | ||
163 | foundAgents.Add(sp); | ||
164 | } | ||
165 | } | ||
166 | |||
167 | if (foundAgents.Count == 0) | ||
168 | return string.Format("No agents found for {0} {1}", firstName, lastName); | ||
169 | |||
170 | StringBuilder report = new StringBuilder(); | ||
171 | |||
172 | foreach (ScenePresence agent in foundAgents) | ||
173 | { | ||
174 | LLClientView client = agent.ControllingClient as LLClientView; | ||
175 | |||
176 | if (client == null) | ||
177 | return "This command is only supported for LLClientView"; | ||
178 | |||
179 | int requestsDeleted = client.ImageManager.ClearImageQueue(); | ||
180 | |||
181 | report.AppendFormat( | ||
182 | "In region {0} ({1} agent) cleared {2} requests\n", | ||
183 | agent.Scene.RegionInfo.RegionName, agent.IsChildAgent ? "child" : "root", requestsDeleted); | ||
184 | } | ||
185 | |||
186 | return report.ToString(); | ||
142 | } | 187 | } |
143 | 188 | ||
144 | protected void EmergencyMonitoring(string module, string[] cmd) | 189 | protected void HandleEmergencyMonitoring(string module, string[] cmd) |
145 | { | 190 | { |
146 | bool mode = true; | 191 | bool mode = true; |
147 | if (cmd.Length == 1 || (cmd.Length > 1 && cmd[1] == "on")) | 192 | if (cmd.Length == 1 || (cmd.Length > 1 && cmd[1] == "on")) |
@@ -166,7 +211,6 @@ namespace OpenSim.Region.CoreModules.UDP.Linden | |||
166 | entry.Length > maxLength ? entry.Substring(0, maxLength) : entry, | 211 | entry.Length > maxLength ? entry.Substring(0, maxLength) : entry, |
167 | ""); | 212 | ""); |
168 | } | 213 | } |
169 | |||
170 | 214 | ||
171 | /// <summary> | 215 | /// <summary> |
172 | /// Generate UDP Queue data report for each client | 216 | /// Generate UDP Queue data report for each client |
@@ -240,6 +284,73 @@ namespace OpenSim.Region.CoreModules.UDP.Linden | |||
240 | 284 | ||
241 | return report.ToString(); | 285 | return report.ToString(); |
242 | } | 286 | } |
287 | |||
288 | /// <summary> | ||
289 | /// Generate an image queue report | ||
290 | /// </summary> | ||
291 | /// <param name="showParams"></param> | ||
292 | /// <returns></returns> | ||
293 | private string GetImageQueuesReport(string[] showParams) | ||
294 | { | ||
295 | if (showParams.Length < 5 || showParams.Length > 6) | ||
296 | return "Usage: image queues show <first-name> <last-name> [full]"; | ||
297 | |||
298 | string firstName = showParams[3]; | ||
299 | string lastName = showParams[4]; | ||
300 | |||
301 | bool showChildAgents = showParams.Length == 6; | ||
302 | |||
303 | List<ScenePresence> foundAgents = new List<ScenePresence>(); | ||
304 | |||
305 | lock (m_scenes) | ||
306 | { | ||
307 | foreach (Scene scene in m_scenes.Values) | ||
308 | { | ||
309 | ScenePresence sp = scene.GetScenePresence(firstName, lastName); | ||
310 | if (sp != null && (showChildAgents || !sp.IsChildAgent)) | ||
311 | foundAgents.Add(sp); | ||
312 | } | ||
313 | } | ||
314 | |||
315 | if (foundAgents.Count == 0) | ||
316 | return string.Format("No agents found for {0} {1}", firstName, lastName); | ||
317 | |||
318 | StringBuilder report = new StringBuilder(); | ||
319 | |||
320 | foreach (ScenePresence agent in foundAgents) | ||
321 | { | ||
322 | LLClientView client = agent.ControllingClient as LLClientView; | ||
323 | |||
324 | if (client == null) | ||
325 | return "This command is only supported for LLClientView"; | ||
326 | |||
327 | J2KImage[] images = client.ImageManager.GetImages(); | ||
328 | |||
329 | report.AppendFormat( | ||
330 | "In region {0} ({1} agent)\n", | ||
331 | agent.Scene.RegionInfo.RegionName, agent.IsChildAgent ? "child" : "root"); | ||
332 | report.AppendFormat("Images in queue: {0}\n", images.Length); | ||
333 | |||
334 | if (images.Length > 0) | ||
335 | { | ||
336 | report.AppendFormat( | ||
337 | "{0,-36} {1,-8} {2,-10} {3,-9} {4,-9} {5,-7}\n", | ||
338 | "Texture ID", | ||
339 | "Last Seq", | ||
340 | "Priority", | ||
341 | "Start Pkt", | ||
342 | "Has Asset", | ||
343 | "Decoded"); | ||
344 | |||
345 | foreach (J2KImage image in images) | ||
346 | report.AppendFormat( | ||
347 | "{0,36} {1,8} {2,10} {3,10} {4,9} {5,7}\n", | ||
348 | image.TextureID, image.LastSequence, image.Priority, image.StartPacket, image.HasAsset, image.IsDecoded); | ||
349 | } | ||
350 | } | ||
351 | |||
352 | return report.ToString(); | ||
353 | } | ||
243 | 354 | ||
244 | /// <summary> | 355 | /// <summary> |
245 | /// Generate UDP Queue data report for each client | 356 | /// Generate UDP Queue data report for each client |