From 4792e6139a86f2dd93ced34582eef3599b804794 Mon Sep 17 00:00:00 2001 From: Dahlia Trimble Date: Sat, 25 Apr 2009 05:06:01 +0000 Subject: Thanks Bluewall for Mantis #3519: a patch that adds simulator uptime and version to REST/json statistics reporting --- OpenSim/Framework/Servers/BaseOpenSimServer.cs | 5 +++-- OpenSim/Framework/Statistics/BaseStatsCollector.cs | 2 +- .../Framework/Statistics/Interfaces/IStatsCollector.cs | 2 +- OpenSim/Framework/Statistics/SimExtraStatsCollector.cs | 16 +++++++--------- 4 files changed, 12 insertions(+), 13 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs index 45b45b2..483f8b6 100644 --- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs +++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs @@ -37,6 +37,7 @@ using log4net.Appender; using log4net.Core; using log4net.Repository; using OpenSim.Framework.Console; +using OpenSim.Framework.Servers; using OpenSim.Framework.Statistics; using Timer=System.Timers.Timer; @@ -458,9 +459,9 @@ namespace OpenSim.Framework.Servers } } - public string StatReport() + public string StatReport(OSHttpRequest httpRequest) { - return m_stats.XReport(); + return m_stats.XReport((DateTime.Now - m_startuptime).ToString() , m_version ); } protected void RemovePIDFile() diff --git a/OpenSim/Framework/Statistics/BaseStatsCollector.cs b/OpenSim/Framework/Statistics/BaseStatsCollector.cs index ca0907d..38e2dd5 100644 --- a/OpenSim/Framework/Statistics/BaseStatsCollector.cs +++ b/OpenSim/Framework/Statistics/BaseStatsCollector.cs @@ -52,7 +52,7 @@ namespace OpenSim.Framework.Statistics return sb.ToString(); } - public virtual string XReport() + public virtual string XReport(string uptime, string version) { 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 ac8133d..c1a8f73 100644 --- a/OpenSim/Framework/Statistics/Interfaces/IStatsCollector.cs +++ b/OpenSim/Framework/Statistics/Interfaces/IStatsCollector.cs @@ -44,6 +44,6 @@ namespace OpenSim.Framework.Statistics /// /// A /// - string XReport(); + string XReport(string uptime, string version); } } diff --git a/OpenSim/Framework/Statistics/SimExtraStatsCollector.cs b/OpenSim/Framework/Statistics/SimExtraStatsCollector.cs index bab2764..75cc23c 100644 --- a/OpenSim/Framework/Statistics/SimExtraStatsCollector.cs +++ b/OpenSim/Framework/Statistics/SimExtraStatsCollector.cs @@ -384,12 +384,12 @@ Asset service request failures: {3}" + Environment.NewLine, } /// - /// Report back collected statistical information. + /// Report back collected statistical information as json serialization. /// /// - public override string XReport() + public override string XReport(string uptime, string version) { - OSDMap args = new OSDMap(28); + OSDMap args = new OSDMap(30); args["AssetsInCache"] = OSD.FromReal(AssetsInCache); args["TimeAfterCacheMiss"] = OSD.FromReal(assetRequestTimeAfterCacheMiss.Milliseconds / 1000.0); args["BlockedMissingTextureRequests"] = OSD.FromReal(BlockedMissingTextureRequests); @@ -417,14 +417,12 @@ Asset service request failures: {3}" + Environment.NewLine, args["OthrFt"] = OSD.FromReal(otherFrameTime); args["AgntFt"] = OSD.FromReal(agentFrameTime); args["ImgsFt"] = OSD.FromReal(imageFrameTime); - args["Memory"] = OSD.FromString(base.XReport()); + args["Memory"] = OSD.FromString(base.XReport(uptime, version)); + args["Uptime"] = OSD.FromString(uptime); + args["Version"] = OSD.FromString(version); string strBuffer = ""; - // byte[] buffer = new byte[1]; - strBuffer = OSDParser.SerializeJsonString(args); - // UTF8Encoding str = new UTF8Encoding(); - // buffer = str.GetBytes(strBuffer); return strBuffer; } @@ -451,7 +449,7 @@ Asset service request failures: {3}" + Environment.NewLine, return m_statsProvider.GetStats(); } - public string XReport() + public string XReport(string uptime, string version) { return ""; } -- cgit v1.1