diff options
author | Charles Krinke | 2009-04-17 21:48:48 +0000 |
---|---|---|
committer | Charles Krinke | 2009-04-17 21:48:48 +0000 |
commit | b4cb45bb79619306b25c67c770165ab752aeb742 (patch) | |
tree | 3d1a7d763a3cc3647aff6a07462971c9f12b2d5c /OpenSim | |
parent | * Add Implementation of Linear Motor and Linear friction from the LSL Vehicle... (diff) | |
download | opensim-SC-b4cb45bb79619306b25c67c770165ab752aeb742.zip opensim-SC-b4cb45bb79619306b25c67c770165ab752aeb742.tar.gz opensim-SC-b4cb45bb79619306b25c67c770165ab752aeb742.tar.bz2 opensim-SC-b4cb45bb79619306b25c67c770165ab752aeb742.tar.xz |
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.
Diffstat (limited to 'OpenSim')
7 files changed, 126 insertions, 1 deletions
diff --git a/OpenSim/ApplicationPlugins/CreateCommsManager/CreateCommsManagerPlugin.cs b/OpenSim/ApplicationPlugins/CreateCommsManager/CreateCommsManagerPlugin.cs index 3985f42..a0c592e 100644 --- a/OpenSim/ApplicationPlugins/CreateCommsManager/CreateCommsManagerPlugin.cs +++ b/OpenSim/ApplicationPlugins/CreateCommsManager/CreateCommsManagerPlugin.cs | |||
@@ -205,6 +205,8 @@ namespace OpenSim.ApplicationPlugins.CreateCommsManager | |||
205 | = new CommunicationsOGS1(m_openSim.NetServersInfo, m_httpServer, m_openSim.AssetCache, libraryRootFolder); | 205 | = new CommunicationsOGS1(m_openSim.NetServersInfo, m_httpServer, m_openSim.AssetCache, libraryRootFolder); |
206 | 206 | ||
207 | m_httpServer.AddStreamHandler(new OpenSim.SimStatusHandler()); | 207 | m_httpServer.AddStreamHandler(new OpenSim.SimStatusHandler()); |
208 | m_httpServer.AddStreamHandler(new OpenSim.XSimStatusHandler(m_openSim)); | ||
209 | |||
208 | } | 210 | } |
209 | 211 | ||
210 | protected virtual void InitialiseHGStandaloneServices(LibraryRootFolder libraryRootFolder) | 212 | protected virtual void InitialiseHGStandaloneServices(LibraryRootFolder libraryRootFolder) |
@@ -240,6 +242,7 @@ namespace OpenSim.ApplicationPlugins.CreateCommsManager | |||
240 | HGServices = ((HGCommunicationsGridMode) m_commsManager).HGServices; | 242 | HGServices = ((HGCommunicationsGridMode) m_commsManager).HGServices; |
241 | 243 | ||
242 | m_httpServer.AddStreamHandler(new OpenSim.SimStatusHandler()); | 244 | m_httpServer.AddStreamHandler(new OpenSim.SimStatusHandler()); |
245 | m_httpServer.AddStreamHandler(new OpenSim.XSimStatusHandler(m_openSim)); | ||
243 | } | 246 | } |
244 | 247 | ||
245 | private void CreateGridInfoService() | 248 | private void CreateGridInfoService() |
@@ -250,4 +253,4 @@ namespace OpenSim.ApplicationPlugins.CreateCommsManager | |||
250 | m_httpServer.AddStreamHandler(new RestStreamHandler("GET", "/get_grid_info", m_gridInfoService.RestGetGridInfoMethod)); | 253 | m_httpServer.AddStreamHandler(new RestStreamHandler("GET", "/get_grid_info", m_gridInfoService.RestGetGridInfoMethod)); |
251 | } | 254 | } |
252 | } | 255 | } |
253 | } \ No newline at end of file | 256 | } |
diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs index 9794a10..f22a6e8 100644 --- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs +++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs | |||
@@ -40,6 +40,10 @@ using OpenSim.Framework.Console; | |||
40 | using OpenSim.Framework.Statistics; | 40 | using OpenSim.Framework.Statistics; |
41 | using Timer=System.Timers.Timer; | 41 | using Timer=System.Timers.Timer; |
42 | 42 | ||
43 | using OpenMetaverse; | ||
44 | using OpenMetaverse.StructuredData; | ||
45 | |||
46 | |||
43 | namespace OpenSim.Framework.Servers | 47 | namespace OpenSim.Framework.Servers |
44 | { | 48 | { |
45 | /// <summary> | 49 | /// <summary> |
@@ -454,6 +458,10 @@ namespace OpenSim.Framework.Servers | |||
454 | } | 458 | } |
455 | } | 459 | } |
456 | 460 | ||
461 | |||
462 | public string StatReport() { | ||
463 | return m_stats.XReport(); | ||
464 | } | ||
457 | 465 | ||
458 | protected void RemovePIDFile() | 466 | protected void RemovePIDFile() |
459 | { | 467 | { |
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 @@ | |||
28 | using System; | 28 | using System; |
29 | using System.Text; | 29 | using System.Text; |
30 | 30 | ||
31 | using OpenMetaverse; | ||
32 | using OpenMetaverse.StructuredData; | ||
33 | |||
34 | |||
31 | namespace OpenSim.Framework.Statistics | 35 | namespace OpenSim.Framework.Statistics |
32 | { | 36 | { |
33 | /// <summary> | 37 | /// <summary> |
@@ -47,5 +51,10 @@ namespace OpenSim.Framework.Statistics | |||
47 | 51 | ||
48 | return sb.ToString(); | 52 | return sb.ToString(); |
49 | } | 53 | } |
54 | |||
55 | public virtual string XReport() | ||
56 | { | ||
57 | return (string) Math.Round(GC.GetTotalMemory(false) / 1024.0 / 1024.0).ToString() ; | ||
58 | } | ||
50 | } | 59 | } |
51 | } | 60 | } |
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 | |||
37 | /// </summary> | 37 | /// </summary> |
38 | /// <returns></returns> | 38 | /// <returns></returns> |
39 | string Report(); | 39 | string Report(); |
40 | |||
41 | /// <summary> | ||
42 | /// Report back collected statistical information in json | ||
43 | /// </summary> | ||
44 | /// <returns> | ||
45 | /// A <see cref="System.String"/> | ||
46 | /// </returns> | ||
47 | string XReport(); | ||
40 | } | 48 | } |
41 | } | 49 | } |
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; | |||
31 | using OpenMetaverse; | 31 | using OpenMetaverse; |
32 | using OpenSim.Framework.Statistics.Interfaces; | 32 | using OpenSim.Framework.Statistics.Interfaces; |
33 | 33 | ||
34 | using OpenMetaverse; | ||
35 | using OpenMetaverse.StructuredData; | ||
36 | |||
34 | namespace OpenSim.Framework.Statistics | 37 | namespace OpenSim.Framework.Statistics |
35 | { | 38 | { |
36 | /// <summary> | 39 | /// <summary> |
@@ -380,6 +383,53 @@ Asset service request failures: {3}" + Environment.NewLine, | |||
380 | 383 | ||
381 | return sb.ToString(); | 384 | return sb.ToString(); |
382 | } | 385 | } |
386 | |||
387 | |||
388 | /// <summary> | ||
389 | /// Report back collected statistical information. | ||
390 | /// </summary> | ||
391 | /// <returns></returns> | ||
392 | public override string XReport() | ||
393 | { | ||
394 | OSDMap args = new OSDMap(28); | ||
395 | args["AssetsInCache"] = OSD.FromReal(AssetsInCache); | ||
396 | args["TimeAfterCacheMiss"] = OSD.FromReal(assetRequestTimeAfterCacheMiss.Milliseconds / 1000.0); | ||
397 | args["BlockedMissingTextureRequests"] = OSD.FromReal(BlockedMissingTextureRequests); | ||
398 | args["AssetServiceRequestFailures"] = OSD.FromReal(AssetServiceRequestFailures); | ||
399 | args["abnormalClientThreadTerminations"] = OSD.FromReal(abnormalClientThreadTerminations); | ||
400 | args["InventoryServiceRetrievalFailures"] = OSD.FromReal(InventoryServiceRetrievalFailures); | ||
401 | args["Dilatn"] = OSD.FromReal(timeDilation); | ||
402 | args["SimFPS"] = OSD.FromReal(simFps); | ||
403 | args["PhyFPS"] = OSD.FromReal(physicsFps); | ||
404 | args["AgntUp"] = OSD.FromReal(agentUpdates); | ||
405 | args["RootAg"] = OSD.FromReal(rootAgents); | ||
406 | args["ChldAg"] = OSD.FromReal(childAgents); | ||
407 | args["Prims"] = OSD.FromReal(totalPrims); | ||
408 | args["AtvPrm"] = OSD.FromReal(activePrims); | ||
409 | args["AtvScr"] = OSD.FromReal(activeScripts); | ||
410 | args["ScrLPS"] = OSD.FromReal(scriptLinesPerSecond); | ||
411 | args["PktsIn"] = OSD.FromReal(inPacketsPerSecond); | ||
412 | args["PktOut"] = OSD.FromReal(outPacketsPerSecond); | ||
413 | args["PendDl"] = OSD.FromReal(pendingDownloads); | ||
414 | args["PendUl"] = OSD.FromReal(pendingUploads); | ||
415 | args["UnackB"] = OSD.FromReal(unackedBytes); | ||
416 | args["TotlFt"] = OSD.FromReal(totalFrameTime); | ||
417 | args["NetFt"] = OSD.FromReal(netFrameTime); | ||
418 | args["PhysFt"] = OSD.FromReal(physicsFrameTime); | ||
419 | args["OthrFt"] = OSD.FromReal(otherFrameTime); | ||
420 | args["AgntFt"] = OSD.FromReal(agentFrameTime); | ||
421 | args["ImgsFt"] = OSD.FromReal(imageFrameTime); | ||
422 | args["Memory"] = OSD.FromString(base.XReport()); | ||
423 | |||
424 | string strBuffer = ""; | ||
425 | byte[] buffer = new byte[1]; | ||
426 | |||
427 | strBuffer = OSDParser.SerializeJsonString(args); | ||
428 | UTF8Encoding str = new UTF8Encoding(); | ||
429 | buffer = str.GetBytes(strBuffer); | ||
430 | |||
431 | return strBuffer; | ||
432 | } | ||
383 | } | 433 | } |
384 | 434 | ||
385 | /// <summary> | 435 | /// <summary> |
@@ -402,5 +452,10 @@ Asset service request failures: {3}" + Environment.NewLine, | |||
402 | { | 452 | { |
403 | return m_statsProvider.GetStats(); | 453 | return m_statsProvider.GetStats(); |
404 | } | 454 | } |
455 | |||
456 | public string XReport() | ||
457 | { | ||
458 | return ""; | ||
459 | } | ||
405 | } | 460 | } |
406 | } | 461 | } |
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index 7aa9f99..18abcad 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs | |||
@@ -807,6 +807,43 @@ namespace OpenSim | |||
807 | } | 807 | } |
808 | } | 808 | } |
809 | 809 | ||
810 | /// <summary> | ||
811 | /// Handler to supply the current extended status of this sim | ||
812 | /// </summary> | ||
813 | /// Currently prints the same a "show stats" plus the uptime of the sim | ||
814 | public class XSimStatusHandler : IStreamedRequestHandler | ||
815 | { | ||
816 | OpenSimBase m_opensim; | ||
817 | |||
818 | public XSimStatusHandler(OpenSimBase sim) | ||
819 | // public XSimStatusHandler(BaseOpenSimServer sim) | ||
820 | { | ||
821 | m_opensim = sim; | ||
822 | } | ||
823 | |||
824 | public byte[] Handle(string path, Stream request, | ||
825 | OSHttpRequest httpRequest, OSHttpResponse httpResponse) | ||
826 | { | ||
827 | return Encoding.UTF8.GetBytes(m_opensim.StatReport()); | ||
828 | } | ||
829 | |||
830 | public string ContentType | ||
831 | { | ||
832 | get { return "text/plain"; } | ||
833 | } | ||
834 | |||
835 | public string HttpMethod | ||
836 | { | ||
837 | get { return "GET"; } | ||
838 | } | ||
839 | |||
840 | public string Path | ||
841 | { | ||
842 | get { return "/simstatusx/"; } | ||
843 | } | ||
844 | } | ||
845 | |||
846 | |||
810 | #endregion | 847 | #endregion |
811 | 848 | ||
812 | /// <summary> | 849 | /// <summary> |
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index ab1816f..6ac0acd 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | |||
@@ -10290,5 +10290,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
10290 | LLPacketHandler handler = (LLPacketHandler) m_PacketHandler; | 10290 | LLPacketHandler handler = (LLPacketHandler) m_PacketHandler; |
10291 | return handler.PacketQueue.GetStats(); | 10291 | return handler.PacketQueue.GetStats(); |
10292 | } | 10292 | } |
10293 | |||
10294 | public string XReport() | ||
10295 | { | ||
10296 | return ""; | ||
10297 | } | ||
10293 | } | 10298 | } |
10294 | } | 10299 | } |