From e9cef70f892bfbf4aad0e4471a958367766d849a Mon Sep 17 00:00:00 2001
From: Teravus Ovares
Date: Sat, 3 Jan 2009 03:30:03 +0000
Subject: * Updates the sim stats module. Cleans out some of the rot. * Adds
a prototype web stats module which is disabled by default. It's functional
with one report right now, however, the database structure may change, so I
don't recommend enabling this to keep actual stats right now. I'll let you
know when it's safe. * Adds Prototype for ajaxy web content * removed a
warning or two.
---
CONTRIBUTORS.txt | 1 +
OpenSim/Framework/Servers/BaseHttpServer.cs | 3 +-
OpenSim/Framework/SimStats.cs | 9 +-
.../Framework/Statistics/SimExtraStatsCollector.cs | 65 +-
.../ClientStack/LindenUDP/LLPacketHandler.cs | 4 +
OpenSim/Region/Environment/Scenes/Scene.cs | 78 +-
OpenSim/Region/Environment/Scenes/SceneGraph.cs | 11 +
.../Region/Environment/Scenes/SimStatsReporter.cs | 13 +-
.../Region/UserStatistics/ActiveConnectionsAJAX.cs | 185 +
OpenSim/Region/UserStatistics/Default_Report.cs | 215 +
OpenSim/Region/UserStatistics/HTMLUtil.cs | 185 +
OpenSim/Region/UserStatistics/IStatsReport.cs | 10 +
.../Region/UserStatistics/Prototype_distributor.cs | 33 +
OpenSim/Region/UserStatistics/SimStatsAJAX.cs | 190 +
.../Region/UserStatistics/Updater_distributor.cs | 35 +
OpenSim/Region/UserStatistics/WebStatsModule.cs | 1083 +++++
ThirdPartyLicenses/Prototype.txt | 16 +
bin/data/prototype.js | 4222 ++++++++++++++++++++
bin/data/updater.js | 20 +
prebuild.xml | 48 +
20 files changed, 6360 insertions(+), 66 deletions(-)
create mode 100644 OpenSim/Region/UserStatistics/ActiveConnectionsAJAX.cs
create mode 100644 OpenSim/Region/UserStatistics/Default_Report.cs
create mode 100644 OpenSim/Region/UserStatistics/HTMLUtil.cs
create mode 100644 OpenSim/Region/UserStatistics/IStatsReport.cs
create mode 100644 OpenSim/Region/UserStatistics/Prototype_distributor.cs
create mode 100644 OpenSim/Region/UserStatistics/SimStatsAJAX.cs
create mode 100644 OpenSim/Region/UserStatistics/Updater_distributor.cs
create mode 100644 OpenSim/Region/UserStatistics/WebStatsModule.cs
create mode 100644 ThirdPartyLicenses/Prototype.txt
create mode 100644 bin/data/prototype.js
create mode 100644 bin/data/updater.js
diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt
index b4fff79..bb6503e 100644
--- a/CONTRIBUTORS.txt
+++ b/CONTRIBUTORS.txt
@@ -113,6 +113,7 @@ This software uses components from the following developers:
* Prebuild (http://sourceforge.net/projects/dnpb/)
* LibSecondLife (http://www.libsecondlife.org/wiki/Main_Page)
* DotNetOpenMail v0.5.8b (http://dotnetopenmail.sourceforge.net)
+* Prototype JavaScript Framework ajax (http://www.prototypejs.org/)
In addition, we would like to thank:
diff --git a/OpenSim/Framework/Servers/BaseHttpServer.cs b/OpenSim/Framework/Servers/BaseHttpServer.cs
index 51658f3..ea356ac 100644
--- a/OpenSim/Framework/Servers/BaseHttpServer.cs
+++ b/OpenSim/Framework/Servers/BaseHttpServer.cs
@@ -1091,6 +1091,7 @@ namespace OpenSim.Framework.Servers
{
host = (string)headervals["Host"];
}
+ keysvals.Add("headers",headervals);
if (keysvals.Contains("method"))
{
@@ -1238,7 +1239,7 @@ namespace OpenSim.Framework.Servers
byte[] buffer;
- if (!contentType.Contains("image"))
+ if (!(contentType.Contains("image") || contentType.Contains("x-shockwave-flash")))
{
buffer = Encoding.UTF8.GetBytes(responseString);
}
diff --git a/OpenSim/Framework/SimStats.cs b/OpenSim/Framework/SimStats.cs
index c77d0d4..865dee2 100644
--- a/OpenSim/Framework/SimStats.cs
+++ b/OpenSim/Framework/SimStats.cs
@@ -72,11 +72,18 @@ namespace OpenSim.Framework
get { return m_objectCapacity; }
}
private uint m_objectCapacity;
+
+ public OpenMetaverse.UUID RegionUUID
+ {
+ get { return regionUUID;}
+ }
+ private OpenMetaverse.UUID regionUUID;
public SimStats(
uint regionX, uint regionY, uint regionFlags, uint objectCapacity,
- SimStatsPacket.RegionBlock regionBlock, SimStatsPacket.StatBlock[] statsBlock)
+ SimStatsPacket.RegionBlock regionBlock, SimStatsPacket.StatBlock[] statsBlock, OpenMetaverse.UUID pRUUID)
{
+ regionUUID = pRUUID;
m_regionX = regionX;
m_regionY = regionY;
m_regionFlags = regionFlags;
diff --git a/OpenSim/Framework/Statistics/SimExtraStatsCollector.cs b/OpenSim/Framework/Statistics/SimExtraStatsCollector.cs
index 48bed81..43c73b2 100644
--- a/OpenSim/Framework/Statistics/SimExtraStatsCollector.cs
+++ b/OpenSim/Framework/Statistics/SimExtraStatsCollector.cs
@@ -51,27 +51,27 @@ namespace OpenSim.Framework.Statistics
private long assetServiceRequestFailures;
private long inventoryServiceRetrievalFailures;
- private float timeDilation;
- private float simFps;
- private float physicsFps;
- private float agentUpdates;
- private float rootAgents;
- private float childAgents;
- private float totalPrims;
- private float activePrims;
- private float totalFrameTime;
- private float netFrameTime;
- private float physicsFrameTime;
- private float otherFrameTime;
- private float imageFrameTime;
- private float inPacketsPerSecond;
- private float outPacketsPerSecond;
- private float unackedBytes;
- private float agentFrameTime;
- private float pendingDownloads;
- private float pendingUploads;
- private float activeScripts;
- private float scriptLinesPerSecond;
+ private volatile float timeDilation;
+ private volatile float simFps;
+ private volatile float physicsFps;
+ private volatile float agentUpdates;
+ private volatile float rootAgents;
+ private volatile float childAgents;
+ private volatile float totalPrims;
+ private volatile float activePrims;
+ private volatile float totalFrameTime;
+ private volatile float netFrameTime;
+ private volatile float physicsFrameTime;
+ private volatile float otherFrameTime;
+ private volatile float imageFrameTime;
+ private volatile float inPacketsPerSecond;
+ private volatile float outPacketsPerSecond;
+ private volatile float unackedBytes;
+ private volatile float agentFrameTime;
+ private volatile float pendingDownloads;
+ private volatile float pendingUploads;
+ private volatile float activeScripts;
+ private volatile float scriptLinesPerSecond;
///
/// Number of times that a client thread terminated because of an exception
@@ -87,7 +87,28 @@ namespace OpenSim.Framework.Statistics
public long TexturesInCache { get { return texturesInCache; } }
public long AssetCacheMemoryUsage { get { return assetCacheMemoryUsage; } }
public long TextureCacheMemoryUsage { get { return textureCacheMemoryUsage; } }
-
+
+ public float TimeDilation { get { return timeDilation; } }
+ public float SimFps { get { return simFps; } }
+ public float PhysicsFps { get { return physicsFps; } }
+ public float AgentUpdates { get { return agentUpdates; } }
+ public float RootAgents { get { return rootAgents; } }
+ public float ChildAgents { get { return childAgents; } }
+ public float TotalPrims { get { return totalPrims; } }
+ public float ActivePrims { get { return activePrims; } }
+ public float TotalFrameTime { get { return totalFrameTime; } }
+ public float NetFrameTime { get { return netFrameTime; } }
+ public float PhysicsFrameTime { get { return physicsFrameTime; } }
+ public float OtherFrameTime { get { return otherFrameTime; } }
+ public float ImageFrameTime { get { return imageFrameTime; } }
+ public float InPacketsPerSecond { get { return inPacketsPerSecond; } }
+ public float OutPacketsPerSecond { get { return outPacketsPerSecond; } }
+ public float UnackedBytes { get { return unackedBytes; } }
+ public float AgentFrameTime { get { return agentFrameTime; } }
+ public float PendingDownloads { get { return pendingDownloads; } }
+ public float PendingUploads { get { return pendingUploads; } }
+ public float ActiveScripts { get { return activeScripts; } }
+ public float ScriptLinesPerSecond { get { return scriptLinesPerSecond; } }
///
/// This is the time it took for the last asset request made in response to a cache miss.
///
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLPacketHandler.cs b/OpenSim/Region/ClientStack/LindenUDP/LLPacketHandler.cs
index a698d41..29cfd99 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLPacketHandler.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLPacketHandler.cs
@@ -603,10 +603,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public void Flush()
{
m_PacketQueue.Flush();
+ m_UnackedBytes = (-1 * m_UnackedBytes);
+ SendPacketStats();
}
public void Clear()
{
+ m_UnackedBytes = (-1 * m_UnackedBytes);
+ SendPacketStats();
m_NeedAck.Clear();
m_PendingAcks.Clear();
m_Sequence += 1000000;
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index 408f100..daeb186 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -69,7 +69,7 @@ namespace OpenSim.Region.Environment.Scenes
protected Timer m_restartWaitTimer = new Timer();
- protected SimStatsReporter m_statsReporter;
+ public SimStatsReporter StatsReporter;
protected List m_regionRestartNotifyList = new List();
protected List m_neighbours = new List();
@@ -244,7 +244,7 @@ namespace OpenSim.Region.Environment.Scenes
///
public float SimulatorFPS
{
- get { return m_statsReporter.getLastReportedSimFPS(); }
+ get { return StatsReporter.getLastReportedSimFPS(); }
}
public int TimePhase
@@ -358,10 +358,10 @@ namespace OpenSim.Region.Environment.Scenes
m_physics_enabled = !RegionInfo.RegionSettings.DisablePhysics;
- m_statsReporter = new SimStatsReporter(this);
- m_statsReporter.OnSendStatsResult += SendSimStatsPackets;
+ StatsReporter = new SimStatsReporter(this);
+ StatsReporter.OnSendStatsResult += SendSimStatsPackets;
- m_statsReporter.SetObjectCapacity(objectCapacity);
+ StatsReporter.SetObjectCapacity(objectCapacity);
m_simulatorVersion = simulatorVersion
+ " (OS " + Util.GetOperatingSystemInformation() + ")"
@@ -814,7 +814,7 @@ namespace OpenSim.Region.Environment.Scenes
if (m_update_entities == 1)
{
m_update_entities = 5;
- m_statsReporter.SetUpdateMS(6000);
+ StatsReporter.SetUpdateMS(6000);
}
}
else
@@ -822,7 +822,7 @@ namespace OpenSim.Region.Environment.Scenes
if (m_update_entities == 5)
{
m_update_entities = 1;
- m_statsReporter.SetUpdateMS(3000);
+ StatsReporter.SetUpdateMS(3000);
}
}
@@ -891,20 +891,20 @@ namespace OpenSim.Region.Environment.Scenes
otherMS = System.Environment.TickCount - otherMS;
// if (m_frame%m_update_avatars == 0)
// UpdateInWorldTime();
- m_statsReporter.AddPhysicsFPS(physicsFPS);
- m_statsReporter.AddTimeDilation(m_timedilation);
- m_statsReporter.AddFPS(1);
- m_statsReporter.AddInPackets(0);
- m_statsReporter.SetRootAgents(m_sceneGraph.GetRootAgentCount());
- m_statsReporter.SetChildAgents(m_sceneGraph.GetChildAgentCount());
- m_statsReporter.SetObjects(m_sceneGraph.GetTotalObjectsCount());
- m_statsReporter.SetActiveObjects(m_sceneGraph.GetActiveObjectsCount());
+ StatsReporter.AddPhysicsFPS(physicsFPS);
+ StatsReporter.AddTimeDilation(m_timedilation);
+ StatsReporter.AddFPS(1);
+ StatsReporter.AddInPackets(0);
+ StatsReporter.SetRootAgents(m_sceneGraph.GetRootAgentCount());
+ StatsReporter.SetChildAgents(m_sceneGraph.GetChildAgentCount());
+ StatsReporter.SetObjects(m_sceneGraph.GetTotalObjectsCount());
+ StatsReporter.SetActiveObjects(m_sceneGraph.GetActiveObjectsCount());
frameMS = System.Environment.TickCount - frameMS;
- m_statsReporter.addFrameMS(frameMS);
- m_statsReporter.addPhysicsMS(physicsMS);
- m_statsReporter.addOtherMS(otherMS);
- m_statsReporter.SetActiveScripts(m_sceneGraph.GetActiveScriptsCount());
- m_statsReporter.addScriptLines(m_sceneGraph.GetScriptLPS());
+ StatsReporter.addFrameMS(frameMS);
+ StatsReporter.addPhysicsMS(physicsMS);
+ StatsReporter.addOtherMS(otherMS);
+ StatsReporter.SetActiveScripts(m_sceneGraph.GetActiveScriptsCount());
+ StatsReporter.addScriptLines(m_sceneGraph.GetScriptLPS());
}
}
catch (NotImplementedException)
@@ -2380,8 +2380,8 @@ namespace OpenSim.Region.Environment.Scenes
client.OnObjectOwner += ObjectOwner;
- if (m_statsReporter != null)
- client.OnNetworkStatsUpdate += m_statsReporter.AddPacketsFromClientStats;
+ if (StatsReporter != null)
+ client.OnNetworkStatsUpdate += StatsReporter.AddPacketsFromClientStats;
// EventManager.TriggerOnNewClient(client);
}
@@ -3027,14 +3027,14 @@ namespace OpenSim.Region.Environment.Scenes
if (presence != null)
{
// Nothing is removed here, so down count it as such
- // if (presence.IsChildAgent)
- // {
- // m_sceneGraph.removeUserCount(false);
- // }
- // else
- // {
- // m_sceneGraph.removeUserCount(true);
- // }
+ if (presence.IsChildAgent)
+ {
+ m_sceneGraph.removeUserCount(false);
+ }
+ else
+ {
+ m_sceneGraph.removeUserCount(true);
+ }
// Don't do this to root agents on logout, it's not nice for the viewer
if (presence.IsChildAgent)
@@ -3322,9 +3322,9 @@ namespace OpenSim.Region.Environment.Scenes
if (RegionInfo.ObjectCapacity != 0)
objects = RegionInfo.ObjectCapacity;
- if (m_statsReporter != null)
+ if (StatsReporter != null)
{
- m_statsReporter.SetObjectCapacity(objects);
+ StatsReporter.SetObjectCapacity(objects);
}
objectCapacity = objects;
}
@@ -3430,25 +3430,25 @@ namespace OpenSim.Region.Environment.Scenes
public void AddPacketStats(int inPackets, int outPackets, int unAckedBytes)
{
- m_statsReporter.AddInPackets(inPackets);
- m_statsReporter.AddOutPackets(outPackets);
- m_statsReporter.AddunAckedBytes(unAckedBytes);
+ StatsReporter.AddInPackets(inPackets);
+ StatsReporter.AddOutPackets(outPackets);
+ StatsReporter.AddunAckedBytes(unAckedBytes);
}
public void AddAgentTime(int ms)
{
- m_statsReporter.addFrameMS(ms);
- m_statsReporter.addAgentMS(ms);
+ StatsReporter.addFrameMS(ms);
+ StatsReporter.addAgentMS(ms);
}
public void AddAgentUpdates(int count)
{
- m_statsReporter.AddAgentUpdates(count);
+ StatsReporter.AddAgentUpdates(count);
}
public void AddPendingDownloads(int count)
{
- m_statsReporter.addPendingDownload(count);
+ StatsReporter.addPendingDownload(count);
}
#endregion
diff --git a/OpenSim/Region/Environment/Scenes/SceneGraph.cs b/OpenSim/Region/Environment/Scenes/SceneGraph.cs
index d998dbb..3ffa5c3 100644
--- a/OpenSim/Region/Environment/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneGraph.cs
@@ -306,8 +306,19 @@ namespace OpenSim.Region.Environment.Scenes
if (!resultOfObjectLinked)
{
m_numPrim -= ((SceneObjectGroup) Entities[uuid]).Children.Count;
+
+ if ((((SceneObjectGroup)Entities[uuid]).RootPart.Flags & PrimFlags.Physics) == PrimFlags.Physics)
+ {
+ RemovePhysicalPrim(((SceneObjectGroup)Entities[uuid]).Children.Count);
+ }
}
+
+
+
Entities.Remove(uuid);
+ //SceneObjectGroup part;
+ //((part.RootPart.Flags & PrimFlags.Physics) == PrimFlags.Physics)
+
return true;
}
diff --git a/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs b/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs
index c614f78..e2afa5a 100644
--- a/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs
+++ b/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs
@@ -26,6 +26,7 @@
*/
using System;
+//using System.Collections.Generic;
using System.Timers;
using OpenMetaverse.Packets;
using OpenSim.Framework;
@@ -189,7 +190,7 @@ namespace OpenSim.Region.Environment.Scenes
}
sb[0].StatID = (uint) Stats.TimeDilation;
- sb[0].StatValue = m_timeDilation ; //((((m_timeDilation + (0.10f * statsUpdateFactor)) /10) / statsUpdateFactor));
+ sb[0].StatValue = (Single.IsNaN(m_timeDilation)) ? 0.1f : m_timeDilation ; //((((m_timeDilation + (0.10f * statsUpdateFactor)) /10) / statsUpdateFactor));
sb[1].StatID = (uint) Stats.SimFPS;
sb[1].StatValue = simfps/statsUpdateFactor;
@@ -253,7 +254,7 @@ namespace OpenSim.Region.Environment.Scenes
SimStats simStats
= new SimStats(
- ReportingRegion.RegionLocX, ReportingRegion.RegionLocY, regionFlags, (uint)objectCapacity, rb, sb);
+ ReportingRegion.RegionLocX, ReportingRegion.RegionLocY, regionFlags, (uint)objectCapacity, rb, sb, m_scene.RegionInfo.originRegionID);
handlerSendStatResult = OnSendStatsResult;
if (handlerSendStatResult != null)
@@ -309,7 +310,11 @@ namespace OpenSim.Region.Environment.Scenes
public void SetChildAgents(int childAgents)
{
- m_childAgents = childAgents;
+ m_childAgents = (childAgents > 0) ? childAgents : 0;
+ if (childAgents < 0)
+ {
+ //List avs= m_scene.GetScenePresences();
+ }
}
public void SetObjects(int objects)
@@ -350,6 +355,7 @@ namespace OpenSim.Region.Environment.Scenes
public void AddunAckedBytes(int numBytes)
{
m_unAckedBytes += numBytes;
+ if (m_unAckedBytes < 0) m_unAckedBytes = 0;
}
public void addFrameMS(int ms)
@@ -383,6 +389,7 @@ namespace OpenSim.Region.Environment.Scenes
public void addPendingDownload(int count)
{
m_pendingDownloads += count;
+ if (m_pendingDownloads < 0) m_pendingDownloads = 0;
//m_log.InfoFormat("[stats]: Adding {0} to pending downloads to make {1}", count, m_pendingDownloads);
}
diff --git a/OpenSim/Region/UserStatistics/ActiveConnectionsAJAX.cs b/OpenSim/Region/UserStatistics/ActiveConnectionsAJAX.cs
new file mode 100644
index 0000000..2dcd2b8
--- /dev/null
+++ b/OpenSim/Region/UserStatistics/ActiveConnectionsAJAX.cs
@@ -0,0 +1,185 @@
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Reflection;
+using System.Text;
+using Mono.Data.SqliteClient;
+using OpenMetaverse;
+using OpenSim.Region.Environment.Scenes;
+using OpenSim.Framework.Statistics;
+
+namespace OpenSim.Region.UserStatistics
+{
+ public class ActiveConnectionsAJAX : IStatsController
+ {
+ #region IStatsController Members
+
+ public Hashtable ProcessModel(Hashtable pParams)
+ {
+
+ List m_scene = (List)pParams["Scenes"];
+
+ Hashtable nh = new Hashtable();
+ nh.Add("hdata", m_scene);
+
+ return nh;
+ }
+
+ public string RenderView(Hashtable pModelResult)
+ {
+ List all_scenes = (List) pModelResult["hdata"];
+
+ StringBuilder output = new StringBuilder();
+ HTMLUtil.OL_O(ref output, "");
+ foreach (Scene scene in all_scenes)
+ {
+ List avatarInScene = scene.GetScenePresences();
+
+ HTMLUtil.LI_O(ref output, "");
+ output.Append(scene.RegionInfo.RegionName);
+ HTMLUtil.OL_O(ref output, "");
+ foreach (ScenePresence av in avatarInScene)
+ {
+ Dictionary queues = new Dictionary();
+ if (av.ControllingClient is IStatsCollector)
+ {
+ IStatsCollector isClient = (IStatsCollector) av.ControllingClient;
+ queues = decodeQueueReport(isClient.Report());
+ }
+ HTMLUtil.LI_O(ref output, "");
+ output.Append(av.Name);
+ output.Append(" ");
+ output.Append((av.IsChildAgent ? "Child" : "Root"));
+
+ Dictionary throttles = DecodeClientThrottles(av.ControllingClient.GetThrottlesPacked(1));
+
+ HTMLUtil.UL_O(ref output, "");
+ foreach (string throttlename in throttles.Keys)
+ {
+ HTMLUtil.LI_O(ref output, "");
+ output.Append(throttlename);
+ output.Append(":");
+ output.Append(throttles[throttlename].ToString());
+ if (queues.ContainsKey(throttlename))
+ {
+ output.Append("/");
+ output.Append(queues[throttlename]);
+ }
+ HTMLUtil.LI_C(ref output);
+ }
+ if (queues.ContainsKey("Incoming") && queues.ContainsKey("Outgoing"))
+ {
+ HTMLUtil.LI_O(ref output, "red");
+ output.Append("SEND:");
+ output.Append(queues["Outgoing"]);
+ output.Append("/");
+ output.Append(queues["Incoming"]);
+ HTMLUtil.LI_C(ref output);
+ }
+
+ HTMLUtil.UL_C(ref output);
+ HTMLUtil.LI_C(ref output);
+ }
+ HTMLUtil.OL_C(ref output);
+ }
+ HTMLUtil.OL_C(ref output);
+ return output.ToString();
+ }
+
+ public Dictionary DecodeClientThrottles(byte[] throttle)
+ {
+ Dictionary returndict = new Dictionary();
+ // From mantis http://opensimulator.org/mantis/view.php?id=1374
+ // it appears that sometimes we are receiving empty throttle byte arrays.
+ // TODO: Investigate this behaviour
+ if (throttle.Length == 0)
+ {
+ return new Dictionary();
+ }
+
+ int tResend = -1;
+ int tLand = -1;
+ int tWind = -1;
+ int tCloud = -1;
+ int tTask = -1;
+ int tTexture = -1;
+ int tAsset = -1;
+ int tall = -1;
+ const int singlefloat = 4;
+
+ //Agent Throttle Block contains 7 single floatingpoint values.
+ int j = 0;
+
+ // Some Systems may be big endian...
+ // it might be smart to do this check more often...
+ if (!BitConverter.IsLittleEndian)
+ for (int i = 0; i < 7; i++)
+ Array.Reverse(throttle, j + i * singlefloat, singlefloat);
+
+ // values gotten from OpenMetaverse.org/wiki/Throttle. Thanks MW_
+ // bytes
+ // Convert to integer, since.. the full fp space isn't used.
+ tResend = (int)BitConverter.ToSingle(throttle, j);
+ returndict.Add("Resend", tResend);
+ j += singlefloat;
+ tLand = (int)BitConverter.ToSingle(throttle, j);
+ returndict.Add("Land", tLand);
+ j += singlefloat;
+ tWind = (int)BitConverter.ToSingle(throttle, j);
+ returndict.Add("Wind", tWind);
+ j += singlefloat;
+ tCloud = (int)BitConverter.ToSingle(throttle, j);
+ returndict.Add("Cloud", tCloud);
+ j += singlefloat;
+ tTask = (int)BitConverter.ToSingle(throttle, j);
+ returndict.Add("Task", tTask);
+ j += singlefloat;
+ tTexture = (int)BitConverter.ToSingle(throttle, j);
+ returndict.Add("Texture", tTexture);
+ j += singlefloat;
+ tAsset = (int)BitConverter.ToSingle(throttle, j);
+ returndict.Add("Asset", tAsset);
+
+ tall = tResend + tLand + tWind + tCloud + tTask + tTexture + tAsset;
+ returndict.Add("All", tall);
+
+ return returndict;
+ }
+ public Dictionary decodeQueueReport(string rep)
+ {
+ Dictionary returndic = new Dictionary();
+ if (rep.Length == 79)
+ {
+ int pos = 1;
+ returndic.Add("All", rep.Substring((6 * pos), 8)); pos++;
+ returndic.Add("Incoming", rep.Substring((7 * pos), 8)); pos++;
+ returndic.Add("Outgoing", rep.Substring((7 * pos) , 8)); pos++;
+ returndic.Add("Resend", rep.Substring((7 * pos) , 8)); pos++;
+ returndic.Add("Land", rep.Substring((7 * pos) , 8)); pos++;
+ returndic.Add("Wind", rep.Substring((7 * pos) , 8)); pos++;
+ returndic.Add("Cloud", rep.Substring((7 * pos) , 8)); pos++;
+ returndic.Add("Task", rep.Substring((7 * pos) , 8)); pos++;
+ returndic.Add("Texture", rep.Substring((7 * pos), 8)); pos++;
+ returndic.Add("Asset", rep.Substring((7 * pos), 8));
+ /*
+ * return string.Format("{0,7} {1,7} {2,7} {3,7} {4,7} {5,7} {6,7} {7,7} {8,7} {9,7}",
+ SendQueue.Count(),
+ IncomingPacketQueue.Count,
+ OutgoingPacketQueue.Count,
+ ResendOutgoingPacketQueue.Count,
+ LandOutgoingPacketQueue.Count,
+ WindOutgoingPacketQueue.Count,
+ CloudOutgoingPacketQueue.Count,
+ TaskOutgoingPacketQueue.Count,
+ TextureOutgoingPacketQueue.Count,
+ AssetOutgoingPacketQueue.Count);
+ */
+ }
+
+
+
+ return returndic;
+ }
+ #endregion
+ }
+}
diff --git a/OpenSim/Region/UserStatistics/Default_Report.cs b/OpenSim/Region/UserStatistics/Default_Report.cs
new file mode 100644
index 0000000..02b15ad
--- /dev/null
+++ b/OpenSim/Region/UserStatistics/Default_Report.cs
@@ -0,0 +1,215 @@
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Reflection;
+using System.Text;
+using Mono.Data.SqliteClient;
+using OpenMetaverse;
+using OpenSim.Region.Environment.Scenes;
+using OpenSim.Framework.Statistics;
+
+
+namespace OpenSim.Region.UserStatistics
+{
+ public class Default_Report : IStatsController
+ {
+
+ public Default_Report()
+ {
+
+ }
+
+ #region IStatsController Members
+
+ public Hashtable ProcessModel(Hashtable pParams)
+ {
+ SqliteConnection conn = (SqliteConnection)pParams["DatabaseConnection"];
+ List m_scene = (List)pParams["Scenes"];
+
+ stats_default_page_values mData = rep_DefaultReport_data(conn, m_scene);
+ mData.sim_stat_data = (Dictionary)pParams["SimStats"];
+
+ Hashtable nh = new Hashtable();
+ nh.Add("hdata", mData);
+
+ return nh;
+ }
+
+ public string RenderView(Hashtable pModelResult)
+ {
+ stats_default_page_values mData = (stats_default_page_values) pModelResult["hdata"];
+ return rep_Default_report_view(mData);
+ }
+
+ #endregion
+
+ public string rep_Default_report_view(stats_default_page_values values)
+ {
+
+ StringBuilder output = new StringBuilder();
+
+
+
+ const string TableClass = "defaultr";
+ const string TRClass = "defaultr";
+ const string TDHeaderClass = "header";
+ const string TDDataClass = "content";
+ //const string TDDataClassRight = "contentright";
+ const string TDDataClassCenter = "contentcenter";
+
+ const string STYLESHEET =
+ @"
+
+";
+ HTMLUtil.HtmlHeaders_O(ref output);
+
+ HTMLUtil.InsertProtoTypeAJAX(ref output);
+ string[] ajaxUpdaterDivs = new string[2];
+ int[] ajaxUpdaterSeconds = new int[2];
+ string[] ajaxUpdaterReportFragments = new string[2];
+
+ ajaxUpdaterDivs[0] = "activeconnections";
+ ajaxUpdaterSeconds[0] = 10;
+ ajaxUpdaterReportFragments[0] = "activeconnectionsajax.ajax";
+
+ ajaxUpdaterDivs[1] = "activesimstats";
+ ajaxUpdaterSeconds[1] = 20;
+ ajaxUpdaterReportFragments[1] = "simstatsajax.ajax";
+
+ HTMLUtil.InsertPeriodicUpdaters(ref output, ajaxUpdaterDivs, ajaxUpdaterSeconds, ajaxUpdaterReportFragments);
+
+ output.Append(STYLESHEET);
+ HTMLUtil.HtmlHeaders_C(ref output);
+
+ HTMLUtil.TABLE_O(ref output, TableClass);
+ HTMLUtil.TR_O(ref output, TRClass);
+ HTMLUtil.TD_O(ref output, TDHeaderClass);
+ output.Append("# Users Total");
+ HTMLUtil.TD_C(ref output);
+ HTMLUtil.TD_O(ref output, TDHeaderClass);
+ output.Append("# Sessions Total");
+ HTMLUtil.TD_C(ref output);
+ HTMLUtil.TD_O(ref output, TDHeaderClass);
+ output.Append("Avg Client FPS");
+ HTMLUtil.TD_C(ref output);
+ HTMLUtil.TD_O(ref output, TDHeaderClass);
+ output.Append("Avg Client Mem Use");
+ HTMLUtil.TD_C(ref output);
+ HTMLUtil.TD_O(ref output, TDHeaderClass);
+ output.Append("Avg Sim FPS");
+ HTMLUtil.TD_C(ref output);
+ HTMLUtil.TD_O(ref output, TDHeaderClass);
+ output.Append("Avg Ping");
+ HTMLUtil.TD_C(ref output);
+ HTMLUtil.TD_O(ref output, TDHeaderClass);
+ output.Append("KB Out Total");
+ HTMLUtil.TD_C(ref output);
+ HTMLUtil.TD_O(ref output, TDHeaderClass);
+ output.Append("KB In Total");
+ HTMLUtil.TD_C(ref output);
+ HTMLUtil.TR_C(ref output);
+ HTMLUtil.TR_O(ref output, TRClass);
+ HTMLUtil.TD_O(ref output, TDDataClass);
+ output.Append(values.total_num_users);
+ HTMLUtil.TD_C(ref output);
+ HTMLUtil.TD_O(ref output, TDDataClass);
+ output.Append(values.total_num_sessions);
+ HTMLUtil.TD_C(ref output);
+ HTMLUtil.TD_O(ref output, TDDataClassCenter);
+ output.Append(values.avg_client_fps);
+ HTMLUtil.TD_C(ref output);
+ HTMLUtil.TD_O(ref output, TDDataClassCenter);
+ output.Append(values.avg_client_mem_use);
+ HTMLUtil.TD_C(ref output);
+ HTMLUtil.TD_O(ref output, TDDataClassCenter);
+ output.Append(values.avg_sim_fps);
+ HTMLUtil.TD_C(ref output);
+ HTMLUtil.TD_O(ref output, TDDataClassCenter);
+ output.Append(values.avg_ping);
+ HTMLUtil.TD_C(ref output);
+ HTMLUtil.TD_O(ref output, TDDataClassCenter);
+ output.Append(values.total_kb_out);
+ HTMLUtil.TD_C(ref output);
+ HTMLUtil.TD_O(ref output, TDDataClassCenter);
+ output.Append(values.total_kb_in);
+ HTMLUtil.TD_C(ref output);
+ HTMLUtil.TR_C(ref output);
+ HTMLUtil.TABLE_C(ref output);
+
+ HTMLUtil.HR(ref output, "");
+ HTMLUtil.TABLE_O(ref output, "");
+ HTMLUtil.TR_O(ref output, "");
+ HTMLUtil.TD_O(ref output, "align_top");
+ output.Append("loading...
");
+ HTMLUtil.TD_C(ref output);
+ HTMLUtil.TD_O(ref output, "align_top");
+ output.Append("loading...
");
+
+ HTMLUtil.TD_C(ref output);
+ HTMLUtil.TR_C(ref output);
+ HTMLUtil.TABLE_C(ref output);
+ output.Append("