29 using System.Collections;
30 using System.Collections.Generic;
31 using System.Reflection;
33 using Mono.Data.SqliteClient;
35 using OpenMetaverse.StructuredData;
36 using OpenSim.Framework;
37 using OpenSim.Region.Framework.Scenes;
38 using OpenSim.Framework.Monitoring;
46 #region IStatsController Members
48 public string ReportName
55 List<Scene> m_scene = (List<Scene>)pParams[
"Scenes"];
57 Hashtable nh =
new Hashtable();
58 nh.Add(
"hdata", m_scene);
65 List<Scene> all_scenes = (List<Scene>) pModelResult[
"hdata"];
67 StringBuilder output =
new StringBuilder();
68 HTMLUtil.OL_O(ref output,
"");
69 foreach (
Scene scene
in all_scenes)
71 HTMLUtil.LI_O(ref output, String.Empty);
72 output.Append(scene.RegionInfo.RegionName);
73 HTMLUtil.OL_O(ref output, String.Empty);
76 Dictionary<string, string> queues =
new Dictionary<string, string>();
80 queues = decodeQueueReport(isClient.
Report());
82 HTMLUtil.LI_O(ref output, String.Empty);
83 output.Append(av.Name);
84 output.Append(
" ");
85 output.Append((av.IsChildAgent ?
"Child" :
"Root"));
88 output.Append(
"<br />Position: ?");
92 output.Append(string.Format(
"<br /><NOBR>Position: <{0},{1},{2}></NOBR>", (int)av.
AbsolutePosition.X,
93 (
int)av.AbsolutePosition.Y,
98 HTMLUtil.UL_O(ref output, String.Empty);
100 foreach (
string throttlename
in throttles.Keys)
102 HTMLUtil.LI_O(ref output, String.Empty);
103 output.Append(throttlename);
105 output.Append(throttles[throttlename].ToString());
106 if (queues.ContainsKey(throttlename))
109 output.Append(queues[throttlename]);
111 HTMLUtil.LI_C(ref output);
113 if (queues.ContainsKey(
"Incoming") && queues.ContainsKey(
"Outgoing"))
115 HTMLUtil.LI_O(ref output,
"red");
116 output.Append(
"SEND:");
117 output.Append(queues[
"Outgoing"]);
119 output.Append(queues[
"Incoming"]);
120 HTMLUtil.LI_C(ref output);
123 HTMLUtil.UL_C(ref output);
124 HTMLUtil.LI_C(ref output);
126 HTMLUtil.OL_C(ref output);
128 HTMLUtil.OL_C(ref output);
129 return output.ToString();
156 List<Scene> all_scenes = (List<Scene>) pModelResult[
"hdata"];
159 foreach (
Scene scene
in all_scenes)
161 OSDMap sceneInfo =
new OpenMetaverse.StructuredData.OSDMap();
162 List<ScenePresence> avatarInScene = scene.GetScenePresences();
166 presenceInfo.Add(
"Name",
new OSDString(av.
Name));
168 Dictionary<string,string> queues =
new Dictionary<string, string>();
172 queues = decodeQueueReport(isClient.
Report());
174 OSDMap queueInfo =
new OpenMetaverse.StructuredData.OSDMap();
175 foreach (KeyValuePair<string, string> kvp
in queues) {
176 queueInfo.Add(kvp.Key,
new OSDString(kvp.Value));
178 sceneInfo.Add(
"queues", queueInfo);
181 presenceInfo.Add(
"isRoot",
new OSDString(
"false"));
183 presenceInfo.Add(
"isRoot",
new OSDString(
"true"));
187 presenceInfo.Add(
"position",
new OSDString(
"<0, 0, 0>"));
191 presenceInfo.Add(
"position",
new OSDString(
string.Format(
"<{0},{1},{2}>",
198 OSDMap throttleInfo =
new OpenMetaverse.StructuredData.OSDMap();
199 foreach (
string throttlename
in throttles.Keys)
201 throttleInfo.Add(throttlename,
new OSDString(throttles[throttlename].ToString()));
203 presenceInfo.Add(
"throttle", throttleInfo);
205 sceneInfo.Add(av.Name, presenceInfo);
207 regionInfo.Add(scene.RegionInfo.RegionName, sceneInfo);
209 return regionInfo.ToString();
214 Dictionary<string, int> returndict =
new Dictionary<string, int>();
218 if (throttle.Length == 0)
220 return new Dictionary<string, int>();
231 const int singlefloat = 4;
238 if (!BitConverter.IsLittleEndian)
239 for (
int i = 0; i < 7; i++)
240 Array.Reverse(throttle, j + i * singlefloat, singlefloat);
245 tResend = (int)BitConverter.ToSingle(throttle, j);
246 returndict.Add(
"Resend", tResend);
248 tLand = (int)BitConverter.ToSingle(throttle, j);
249 returndict.Add(
"Land", tLand);
251 tWind = (int)BitConverter.ToSingle(throttle, j);
252 returndict.Add(
"Wind", tWind);
254 tCloud = (int)BitConverter.ToSingle(throttle, j);
255 returndict.Add(
"Cloud", tCloud);
257 tTask = (int)BitConverter.ToSingle(throttle, j);
258 returndict.Add(
"Task", tTask);
260 tTexture = (int)BitConverter.ToSingle(throttle, j);
261 returndict.Add(
"Texture", tTexture);
263 tAsset = (int)BitConverter.ToSingle(throttle, j);
264 returndict.Add(
"Asset", tAsset);
266 tall = tResend + tLand + tWind + tCloud + tTask + tTexture + tAsset;
267 returndict.Add(
"All", tall);
273 Dictionary<string, string> returndic =
new Dictionary<string, string>();
274 if (rep.Length == 79)
277 returndic.Add(
"All", rep.Substring((6 * pos), 8)); pos++;
278 returndic.Add(
"Incoming", rep.Substring((7 * pos), 8)); pos++;
279 returndic.Add(
"Outgoing", rep.Substring((7 * pos) , 8)); pos++;
280 returndic.Add(
"Resend", rep.Substring((7 * pos) , 8)); pos++;
281 returndic.Add(
"Land", rep.Substring((7 * pos) , 8)); pos++;
282 returndic.Add(
"Wind", rep.Substring((7 * pos) , 8)); pos++;
283 returndic.Add(
"Cloud", rep.Substring((7 * pos) , 8)); pos++;
284 returndic.Add(
"Task", rep.Substring((7 * pos) , 8)); pos++;
285 returndic.Add(
"Texture", rep.Substring((7 * pos), 8)); pos++;
286 returndic.Add(
"Asset", rep.Substring((7 * pos), 8));
Implemented by classes which collect up non-viewer statistical information
Hashtable ProcessModel(Hashtable pParams)
IClientAPI ControllingClient
OpenMetaverse.StructuredData.OSDMap OSDMap
string Report()
Report back collected statistical information.
byte[] GetThrottlesPacked(float multiplier)
override Vector3 AbsolutePosition
Position of this avatar relative to the region the avatar is in
string RenderJson(Hashtable pModelResult)
Convert active connections information to JSON string. Returns a structure:
string RenderView(Hashtable pModelResult)
Interactive OpenSim region server
Dictionary< string, string > decodeQueueReport(string rep)
virtual string Name
The name of this entity
Dictionary< string, int > DecodeClientThrottles(byte[] throttle)