diff options
Diffstat (limited to 'OpenSim/Region/UserStatistics/SimStatsAJAX.cs')
-rw-r--r-- | OpenSim/Region/UserStatistics/SimStatsAJAX.cs | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/OpenSim/Region/UserStatistics/SimStatsAJAX.cs b/OpenSim/Region/UserStatistics/SimStatsAJAX.cs index 28051fb..ad848a1 100644 --- a/OpenSim/Region/UserStatistics/SimStatsAJAX.cs +++ b/OpenSim/Region/UserStatistics/SimStatsAJAX.cs | |||
@@ -32,6 +32,7 @@ using System.Reflection; | |||
32 | using System.Text; | 32 | using System.Text; |
33 | using Mono.Data.SqliteClient; | 33 | using Mono.Data.SqliteClient; |
34 | using OpenMetaverse; | 34 | using OpenMetaverse; |
35 | using OpenMetaverse.StructuredData; | ||
35 | using OpenSim.Region.Framework.Scenes; | 36 | using OpenSim.Region.Framework.Scenes; |
36 | using OpenSim.Framework.Monitoring; | 37 | using OpenSim.Framework.Monitoring; |
37 | 38 | ||
@@ -218,6 +219,64 @@ namespace OpenSim.Region.UserStatistics | |||
218 | return output.ToString(); | 219 | return output.ToString(); |
219 | } | 220 | } |
220 | 221 | ||
222 | /// <summary> | ||
223 | /// Return stat information for all regions in the sim. Returns data of the form: | ||
224 | /// <pre> | ||
225 | /// {"REGIONNAME": { | ||
226 | /// "region": "REGIONNAME", | ||
227 | /// "timeDilation": "101", | ||
228 | /// ... // the rest of the stat info | ||
229 | /// }, | ||
230 | /// ... // entries for each region | ||
231 | /// } | ||
232 | /// </pre> | ||
233 | /// </summary> | ||
234 | /// <param name="pModelResult"></param> | ||
235 | /// <returns></returns> | ||
236 | public string RenderJson(Hashtable pModelResult) | ||
237 | { | ||
238 | List<Scene> all_scenes = (List<Scene>) pModelResult["hdata"]; | ||
239 | Dictionary<UUID, USimStatsData> sdatadic = (Dictionary<UUID,USimStatsData>)pModelResult["simstats"]; | ||
240 | |||
241 | OSDMap allStatsInfo = new OpenMetaverse.StructuredData.OSDMap(); | ||
242 | foreach (USimStatsData sdata in sdatadic.Values) | ||
243 | { | ||
244 | OSDMap statsInfo = new OpenMetaverse.StructuredData.OSDMap(); | ||
245 | string regionName = "unknown"; | ||
246 | foreach (Scene sn in all_scenes) | ||
247 | { | ||
248 | if (sn.RegionInfo.RegionID == sdata.RegionId) | ||
249 | { | ||
250 | regionName = sn.RegionInfo.RegionName; | ||
251 | break; | ||
252 | } | ||
253 | } | ||
254 | statsInfo.Add("region", new OSDString(regionName)); | ||
255 | statsInfo.Add("timeDilation", new OSDString(sdata.TimeDilation.ToString())); | ||
256 | statsInfo.Add("simFPS", new OSDString(sdata.SimFps.ToString())); | ||
257 | statsInfo.Add("physicsFPS", new OSDString(sdata.PhysicsFps.ToString())); | ||
258 | statsInfo.Add("agentUpdates", new OSDString(sdata.AgentUpdates.ToString())); | ||
259 | statsInfo.Add("rootAgents", new OSDString(sdata.RootAgents.ToString())); | ||
260 | statsInfo.Add("childAgents", new OSDString(sdata.ChildAgents.ToString())); | ||
261 | statsInfo.Add("totalPrims", new OSDString(sdata.TotalPrims.ToString())); | ||
262 | statsInfo.Add("activePrims", new OSDString(sdata.ActivePrims.ToString())); | ||
263 | statsInfo.Add("activeScripts", new OSDString(sdata.ActiveScripts.ToString())); | ||
264 | statsInfo.Add("scriptLinesPerSec", new OSDString(sdata.ScriptLinesPerSecond.ToString())); | ||
265 | statsInfo.Add("totalFrameTime", new OSDString(sdata.TotalFrameTime.ToString())); | ||
266 | statsInfo.Add("agentFrameTime", new OSDString(sdata.AgentFrameTime.ToString())); | ||
267 | statsInfo.Add("physicsFrameTime", new OSDString(sdata.PhysicsFrameTime.ToString())); | ||
268 | statsInfo.Add("otherFrameTime", new OSDString(sdata.OtherFrameTime.ToString())); | ||
269 | statsInfo.Add("outPacketsPerSec", new OSDString(sdata.OutPacketsPerSecond.ToString())); | ||
270 | statsInfo.Add("inPacketsPerSec", new OSDString(sdata.InPacketsPerSecond.ToString())); | ||
271 | statsInfo.Add("unackedByptes", new OSDString(sdata.UnackedBytes.ToString())); | ||
272 | statsInfo.Add("pendingDownloads", new OSDString(sdata.PendingDownloads.ToString())); | ||
273 | statsInfo.Add("pendingUploads", new OSDString(sdata.PendingUploads.ToString())); | ||
274 | |||
275 | allStatsInfo.Add(regionName, statsInfo); | ||
276 | } | ||
277 | return allStatsInfo.ToString(); | ||
278 | } | ||
279 | |||
221 | #endregion | 280 | #endregion |
222 | } | 281 | } |
223 | } | 282 | } |