From b4cb45bb79619306b25c67c770165ab752aeb742 Mon Sep 17 00:00:00 2001 From: Charles Krinke Date: Fri, 17 Apr 2009 21:48:48 +0000 Subject: Fixes Mantis # 3469. Thank you kindly, BlueWall, for a patch that: This patch adds extended status reporting with the url http://server:port/simstatusx/ [^] . The data is returned in json format as "text/plain" type. --- OpenSim/Framework/Statistics/BaseStatsCollector.cs | 9 ++++ .../Statistics/Interfaces/IStatsCollector.cs | 8 ++++ .../Framework/Statistics/SimExtraStatsCollector.cs | 55 ++++++++++++++++++++++ 3 files changed, 72 insertions(+) (limited to 'OpenSim/Framework/Statistics') diff --git a/OpenSim/Framework/Statistics/BaseStatsCollector.cs b/OpenSim/Framework/Statistics/BaseStatsCollector.cs index 1e59983..a5ce8aa 100644 --- a/OpenSim/Framework/Statistics/BaseStatsCollector.cs +++ b/OpenSim/Framework/Statistics/BaseStatsCollector.cs @@ -28,6 +28,10 @@ using System; using System.Text; +using OpenMetaverse; +using OpenMetaverse.StructuredData; + + namespace OpenSim.Framework.Statistics { /// @@ -47,5 +51,10 @@ namespace OpenSim.Framework.Statistics return sb.ToString(); } + + public virtual string XReport() + { + return (string) Math.Round(GC.GetTotalMemory(false) / 1024.0 / 1024.0).ToString() ; + } } } diff --git a/OpenSim/Framework/Statistics/Interfaces/IStatsCollector.cs b/OpenSim/Framework/Statistics/Interfaces/IStatsCollector.cs index e468fb2..48f28ee 100644 --- a/OpenSim/Framework/Statistics/Interfaces/IStatsCollector.cs +++ b/OpenSim/Framework/Statistics/Interfaces/IStatsCollector.cs @@ -37,5 +37,13 @@ namespace OpenSim.Framework.Statistics /// /// string Report(); + + /// + /// Report back collected statistical information in json + /// + /// + /// A + /// + string XReport(); } } diff --git a/OpenSim/Framework/Statistics/SimExtraStatsCollector.cs b/OpenSim/Framework/Statistics/SimExtraStatsCollector.cs index d6e26e4..8b8b52a 100644 --- a/OpenSim/Framework/Statistics/SimExtraStatsCollector.cs +++ b/OpenSim/Framework/Statistics/SimExtraStatsCollector.cs @@ -31,6 +31,9 @@ using System.Text; using OpenMetaverse; using OpenSim.Framework.Statistics.Interfaces; +using OpenMetaverse; +using OpenMetaverse.StructuredData; + namespace OpenSim.Framework.Statistics { /// @@ -380,6 +383,53 @@ Asset service request failures: {3}" + Environment.NewLine, return sb.ToString(); } + + + /// + /// Report back collected statistical information. + /// + /// + public override string XReport() + { + OSDMap args = new OSDMap(28); + args["AssetsInCache"] = OSD.FromReal(AssetsInCache); + args["TimeAfterCacheMiss"] = OSD.FromReal(assetRequestTimeAfterCacheMiss.Milliseconds / 1000.0); + args["BlockedMissingTextureRequests"] = OSD.FromReal(BlockedMissingTextureRequests); + args["AssetServiceRequestFailures"] = OSD.FromReal(AssetServiceRequestFailures); + args["abnormalClientThreadTerminations"] = OSD.FromReal(abnormalClientThreadTerminations); + args["InventoryServiceRetrievalFailures"] = OSD.FromReal(InventoryServiceRetrievalFailures); + args["Dilatn"] = OSD.FromReal(timeDilation); + args["SimFPS"] = OSD.FromReal(simFps); + args["PhyFPS"] = OSD.FromReal(physicsFps); + args["AgntUp"] = OSD.FromReal(agentUpdates); + args["RootAg"] = OSD.FromReal(rootAgents); + args["ChldAg"] = OSD.FromReal(childAgents); + args["Prims"] = OSD.FromReal(totalPrims); + args["AtvPrm"] = OSD.FromReal(activePrims); + args["AtvScr"] = OSD.FromReal(activeScripts); + args["ScrLPS"] = OSD.FromReal(scriptLinesPerSecond); + args["PktsIn"] = OSD.FromReal(inPacketsPerSecond); + args["PktOut"] = OSD.FromReal(outPacketsPerSecond); + args["PendDl"] = OSD.FromReal(pendingDownloads); + args["PendUl"] = OSD.FromReal(pendingUploads); + args["UnackB"] = OSD.FromReal(unackedBytes); + args["TotlFt"] = OSD.FromReal(totalFrameTime); + args["NetFt"] = OSD.FromReal(netFrameTime); + args["PhysFt"] = OSD.FromReal(physicsFrameTime); + args["OthrFt"] = OSD.FromReal(otherFrameTime); + args["AgntFt"] = OSD.FromReal(agentFrameTime); + args["ImgsFt"] = OSD.FromReal(imageFrameTime); + args["Memory"] = OSD.FromString(base.XReport()); + + string strBuffer = ""; + byte[] buffer = new byte[1]; + + strBuffer = OSDParser.SerializeJsonString(args); + UTF8Encoding str = new UTF8Encoding(); + buffer = str.GetBytes(strBuffer); + + return strBuffer; + } } /// @@ -402,5 +452,10 @@ Asset service request failures: {3}" + Environment.NewLine, { return m_statsProvider.GetStats(); } + + public string XReport() + { + return ""; + } } } -- cgit v1.1