diff options
author | Dahlia Trimble | 2009-04-25 05:06:01 +0000 |
---|---|---|
committer | Dahlia Trimble | 2009-04-25 05:06:01 +0000 |
commit | 4792e6139a86f2dd93ced34582eef3599b804794 (patch) | |
tree | 6aa308eb6d29c94b882051cea5a6fc92224627db | |
parent | * More debug warning message removal in the FreeSwitchVoiceModule (diff) | |
download | opensim-SC_OLD-4792e6139a86f2dd93ced34582eef3599b804794.zip opensim-SC_OLD-4792e6139a86f2dd93ced34582eef3599b804794.tar.gz opensim-SC_OLD-4792e6139a86f2dd93ced34582eef3599b804794.tar.bz2 opensim-SC_OLD-4792e6139a86f2dd93ced34582eef3599b804794.tar.xz |
Thanks Bluewall for Mantis #3519: a patch that adds simulator uptime and version to REST/json statistics reporting
6 files changed, 15 insertions, 17 deletions
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; | |||
37 | using log4net.Core; | 37 | using log4net.Core; |
38 | using log4net.Repository; | 38 | using log4net.Repository; |
39 | using OpenSim.Framework.Console; | 39 | using OpenSim.Framework.Console; |
40 | using OpenSim.Framework.Servers; | ||
40 | using OpenSim.Framework.Statistics; | 41 | using OpenSim.Framework.Statistics; |
41 | using Timer=System.Timers.Timer; | 42 | using Timer=System.Timers.Timer; |
42 | 43 | ||
@@ -458,9 +459,9 @@ namespace OpenSim.Framework.Servers | |||
458 | } | 459 | } |
459 | } | 460 | } |
460 | 461 | ||
461 | public string StatReport() | 462 | public string StatReport(OSHttpRequest httpRequest) |
462 | { | 463 | { |
463 | return m_stats.XReport(); | 464 | return m_stats.XReport((DateTime.Now - m_startuptime).ToString() , m_version ); |
464 | } | 465 | } |
465 | 466 | ||
466 | protected void RemovePIDFile() | 467 | 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 | |||
52 | return sb.ToString(); | 52 | return sb.ToString(); |
53 | } | 53 | } |
54 | 54 | ||
55 | public virtual string XReport() | 55 | public virtual string XReport(string uptime, string version) |
56 | { | 56 | { |
57 | return (string) Math.Round(GC.GetTotalMemory(false) / 1024.0 / 1024.0).ToString() ; | 57 | return (string) Math.Round(GC.GetTotalMemory(false) / 1024.0 / 1024.0).ToString() ; |
58 | } | 58 | } |
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 | |||
44 | /// <returns> | 44 | /// <returns> |
45 | /// A <see cref="System.String"/> | 45 | /// A <see cref="System.String"/> |
46 | /// </returns> | 46 | /// </returns> |
47 | string XReport(); | 47 | string XReport(string uptime, string version); |
48 | } | 48 | } |
49 | } | 49 | } |
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, | |||
384 | } | 384 | } |
385 | 385 | ||
386 | /// <summary> | 386 | /// <summary> |
387 | /// Report back collected statistical information. | 387 | /// Report back collected statistical information as json serialization. |
388 | /// </summary> | 388 | /// </summary> |
389 | /// <returns></returns> | 389 | /// <returns></returns> |
390 | public override string XReport() | 390 | public override string XReport(string uptime, string version) |
391 | { | 391 | { |
392 | OSDMap args = new OSDMap(28); | 392 | OSDMap args = new OSDMap(30); |
393 | args["AssetsInCache"] = OSD.FromReal(AssetsInCache); | 393 | args["AssetsInCache"] = OSD.FromReal(AssetsInCache); |
394 | args["TimeAfterCacheMiss"] = OSD.FromReal(assetRequestTimeAfterCacheMiss.Milliseconds / 1000.0); | 394 | args["TimeAfterCacheMiss"] = OSD.FromReal(assetRequestTimeAfterCacheMiss.Milliseconds / 1000.0); |
395 | args["BlockedMissingTextureRequests"] = OSD.FromReal(BlockedMissingTextureRequests); | 395 | args["BlockedMissingTextureRequests"] = OSD.FromReal(BlockedMissingTextureRequests); |
@@ -417,14 +417,12 @@ Asset service request failures: {3}" + Environment.NewLine, | |||
417 | args["OthrFt"] = OSD.FromReal(otherFrameTime); | 417 | args["OthrFt"] = OSD.FromReal(otherFrameTime); |
418 | args["AgntFt"] = OSD.FromReal(agentFrameTime); | 418 | args["AgntFt"] = OSD.FromReal(agentFrameTime); |
419 | args["ImgsFt"] = OSD.FromReal(imageFrameTime); | 419 | args["ImgsFt"] = OSD.FromReal(imageFrameTime); |
420 | args["Memory"] = OSD.FromString(base.XReport()); | 420 | args["Memory"] = OSD.FromString(base.XReport(uptime, version)); |
421 | args["Uptime"] = OSD.FromString(uptime); | ||
422 | args["Version"] = OSD.FromString(version); | ||
421 | 423 | ||
422 | string strBuffer = ""; | 424 | string strBuffer = ""; |
423 | // byte[] buffer = new byte[1]; | ||
424 | |||
425 | strBuffer = OSDParser.SerializeJsonString(args); | 425 | strBuffer = OSDParser.SerializeJsonString(args); |
426 | // UTF8Encoding str = new UTF8Encoding(); | ||
427 | // buffer = str.GetBytes(strBuffer); | ||
428 | 426 | ||
429 | return strBuffer; | 427 | return strBuffer; |
430 | } | 428 | } |
@@ -451,7 +449,7 @@ Asset service request failures: {3}" + Environment.NewLine, | |||
451 | return m_statsProvider.GetStats(); | 449 | return m_statsProvider.GetStats(); |
452 | } | 450 | } |
453 | 451 | ||
454 | public string XReport() | 452 | public string XReport(string uptime, string version) |
455 | { | 453 | { |
456 | return ""; | 454 | return ""; |
457 | } | 455 | } |
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index b28e880..286c5a1 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs | |||
@@ -810,13 +810,12 @@ namespace OpenSim | |||
810 | /// <summary> | 810 | /// <summary> |
811 | /// Handler to supply the current extended status of this sim | 811 | /// Handler to supply the current extended status of this sim |
812 | /// </summary> | 812 | /// </summary> |
813 | /// Currently prints the same a "show stats" plus the uptime of the sim | 813 | /// Sends the statistical data in a json serialization |
814 | public class XSimStatusHandler : IStreamedRequestHandler | 814 | public class XSimStatusHandler : IStreamedRequestHandler |
815 | { | 815 | { |
816 | OpenSimBase m_opensim; | 816 | OpenSimBase m_opensim; |
817 | 817 | ||
818 | public XSimStatusHandler(OpenSimBase sim) | 818 | public XSimStatusHandler(OpenSimBase sim) |
819 | // public XSimStatusHandler(BaseOpenSimServer sim) | ||
820 | { | 819 | { |
821 | m_opensim = sim; | 820 | m_opensim = sim; |
822 | } | 821 | } |
@@ -824,7 +823,7 @@ namespace OpenSim | |||
824 | public byte[] Handle(string path, Stream request, | 823 | public byte[] Handle(string path, Stream request, |
825 | OSHttpRequest httpRequest, OSHttpResponse httpResponse) | 824 | OSHttpRequest httpRequest, OSHttpResponse httpResponse) |
826 | { | 825 | { |
827 | return Encoding.UTF8.GetBytes(m_opensim.StatReport()); | 826 | return Encoding.UTF8.GetBytes(m_opensim.StatReport(httpRequest)); |
828 | } | 827 | } |
829 | 828 | ||
830 | public string ContentType | 829 | public string ContentType |
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 40f25ae..48612ab 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | |||
@@ -10312,7 +10312,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
10312 | return handler.PacketQueue.GetStats(); | 10312 | return handler.PacketQueue.GetStats(); |
10313 | } | 10313 | } |
10314 | 10314 | ||
10315 | public string XReport() | 10315 | public string XReport(string uptime, string version) |
10316 | { | 10316 | { |
10317 | return ""; | 10317 | return ""; |
10318 | } | 10318 | } |