Thanks Bluewall for Mantis #3519: a patch that adds simulator uptime and version to REST/json statistics reporting
parent
917849eaac
commit
4792e6139a
|
@ -37,6 +37,7 @@ using log4net.Appender;
|
||||||
using log4net.Core;
|
using log4net.Core;
|
||||||
using log4net.Repository;
|
using log4net.Repository;
|
||||||
using OpenSim.Framework.Console;
|
using OpenSim.Framework.Console;
|
||||||
|
using OpenSim.Framework.Servers;
|
||||||
using OpenSim.Framework.Statistics;
|
using OpenSim.Framework.Statistics;
|
||||||
using Timer=System.Timers.Timer;
|
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()
|
protected void RemovePIDFile()
|
||||||
|
|
|
@ -52,7 +52,7 @@ namespace OpenSim.Framework.Statistics
|
||||||
return sb.ToString();
|
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() ;
|
return (string) Math.Round(GC.GetTotalMemory(false) / 1024.0 / 1024.0).ToString() ;
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,6 +44,6 @@ namespace OpenSim.Framework.Statistics
|
||||||
/// <returns>
|
/// <returns>
|
||||||
/// A <see cref="System.String"/>
|
/// A <see cref="System.String"/>
|
||||||
/// </returns>
|
/// </returns>
|
||||||
string XReport();
|
string XReport(string uptime, string version);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -384,12 +384,12 @@ Asset service request failures: {3}" + Environment.NewLine,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Report back collected statistical information.
|
/// Report back collected statistical information as json serialization.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
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["AssetsInCache"] = OSD.FromReal(AssetsInCache);
|
||||||
args["TimeAfterCacheMiss"] = OSD.FromReal(assetRequestTimeAfterCacheMiss.Milliseconds / 1000.0);
|
args["TimeAfterCacheMiss"] = OSD.FromReal(assetRequestTimeAfterCacheMiss.Milliseconds / 1000.0);
|
||||||
args["BlockedMissingTextureRequests"] = OSD.FromReal(BlockedMissingTextureRequests);
|
args["BlockedMissingTextureRequests"] = OSD.FromReal(BlockedMissingTextureRequests);
|
||||||
|
@ -417,14 +417,12 @@ Asset service request failures: {3}" + Environment.NewLine,
|
||||||
args["OthrFt"] = OSD.FromReal(otherFrameTime);
|
args["OthrFt"] = OSD.FromReal(otherFrameTime);
|
||||||
args["AgntFt"] = OSD.FromReal(agentFrameTime);
|
args["AgntFt"] = OSD.FromReal(agentFrameTime);
|
||||||
args["ImgsFt"] = OSD.FromReal(imageFrameTime);
|
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 = "";
|
string strBuffer = "";
|
||||||
// byte[] buffer = new byte[1];
|
|
||||||
|
|
||||||
strBuffer = OSDParser.SerializeJsonString(args);
|
strBuffer = OSDParser.SerializeJsonString(args);
|
||||||
// UTF8Encoding str = new UTF8Encoding();
|
|
||||||
// buffer = str.GetBytes(strBuffer);
|
|
||||||
|
|
||||||
return strBuffer;
|
return strBuffer;
|
||||||
}
|
}
|
||||||
|
@ -451,7 +449,7 @@ Asset service request failures: {3}" + Environment.NewLine,
|
||||||
return m_statsProvider.GetStats();
|
return m_statsProvider.GetStats();
|
||||||
}
|
}
|
||||||
|
|
||||||
public string XReport()
|
public string XReport(string uptime, string version)
|
||||||
{
|
{
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
|
@ -810,13 +810,12 @@ namespace OpenSim
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Handler to supply the current extended status of this sim
|
/// Handler to supply the current extended status of this sim
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// Currently prints the same a "show stats" plus the uptime of the sim
|
/// Sends the statistical data in a json serialization
|
||||||
public class XSimStatusHandler : IStreamedRequestHandler
|
public class XSimStatusHandler : IStreamedRequestHandler
|
||||||
{
|
{
|
||||||
OpenSimBase m_opensim;
|
OpenSimBase m_opensim;
|
||||||
|
|
||||||
public XSimStatusHandler(OpenSimBase sim)
|
public XSimStatusHandler(OpenSimBase sim)
|
||||||
// public XSimStatusHandler(BaseOpenSimServer sim)
|
|
||||||
{
|
{
|
||||||
m_opensim = sim;
|
m_opensim = sim;
|
||||||
}
|
}
|
||||||
|
@ -824,7 +823,7 @@ namespace OpenSim
|
||||||
public byte[] Handle(string path, Stream request,
|
public byte[] Handle(string path, Stream request,
|
||||||
OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
||||||
{
|
{
|
||||||
return Encoding.UTF8.GetBytes(m_opensim.StatReport());
|
return Encoding.UTF8.GetBytes(m_opensim.StatReport(httpRequest));
|
||||||
}
|
}
|
||||||
|
|
||||||
public string ContentType
|
public string ContentType
|
||||||
|
|
|
@ -10312,7 +10312,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
return handler.PacketQueue.GetStats();
|
return handler.PacketQueue.GetStats();
|
||||||
}
|
}
|
||||||
|
|
||||||
public string XReport()
|
public string XReport(string uptime, string version)
|
||||||
{
|
{
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue