diff options
Diffstat (limited to 'OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs')
-rw-r--r-- | OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs b/OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs new file mode 100644 index 0000000..d4a7692 --- /dev/null +++ b/OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs | |||
@@ -0,0 +1,70 @@ | |||
1 | using System.Collections.Generic; | ||
2 | using System.Reflection; | ||
3 | using log4net; | ||
4 | using Nini.Config; | ||
5 | using OpenSim.Region.CoreModules.Framework.Monitoring.Monitors; | ||
6 | using OpenSim.Region.Framework.Interfaces; | ||
7 | using OpenSim.Region.Framework.Scenes; | ||
8 | |||
9 | namespace OpenSim.Region.CoreModules.Framework.Monitoring | ||
10 | { | ||
11 | public class MonitorModule : IRegionModule | ||
12 | { | ||
13 | private Scene m_scene; | ||
14 | private readonly List<IMonitor> m_monitors = new List<IMonitor>(); | ||
15 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
16 | |||
17 | public void DebugMonitors(string module, string[] args) | ||
18 | { | ||
19 | foreach (IMonitor monitor in m_monitors) | ||
20 | { | ||
21 | m_log.Info("[MonitorModule] " + m_scene.RegionInfo.RegionName + " reports " + monitor.GetName() + " = " + monitor.GetValue()); | ||
22 | } | ||
23 | } | ||
24 | |||
25 | #region Implementation of IRegionModule | ||
26 | |||
27 | public void Initialise(Scene scene, IConfigSource source) | ||
28 | { | ||
29 | m_scene = scene; | ||
30 | |||
31 | |||
32 | m_scene.AddCommand(this, "monitor report", | ||
33 | "monitor report", | ||
34 | "Returns a variety of statistics about the current region and/or simulator", | ||
35 | DebugMonitors); | ||
36 | } | ||
37 | |||
38 | public void PostInitialise() | ||
39 | { | ||
40 | m_monitors.Add(new AgentCountMonitor(m_scene)); | ||
41 | m_monitors.Add(new ChildAgentCountMonitor(m_scene)); | ||
42 | m_monitors.Add(new GCMemoryMonitor()); | ||
43 | m_monitors.Add(new ObjectCountMonitor(m_scene)); | ||
44 | m_monitors.Add(new PhysicsFrameMonitor(m_scene)); | ||
45 | m_monitors.Add(new PhysicsUpdateFrameMonitor(m_scene)); | ||
46 | m_monitors.Add(new PWSMemoryMonitor()); | ||
47 | m_monitors.Add(new ThreadCountMonitor()); | ||
48 | m_monitors.Add(new TotalFrameMonitor(m_scene)); | ||
49 | m_monitors.Add(new EventFrameMonitor(m_scene)); | ||
50 | m_monitors.Add(new LandFrameMonitor(m_scene)); | ||
51 | } | ||
52 | |||
53 | public void Close() | ||
54 | { | ||
55 | |||
56 | } | ||
57 | |||
58 | public string Name | ||
59 | { | ||
60 | get { return "Region Health Monitoring Module"; } | ||
61 | } | ||
62 | |||
63 | public bool IsSharedModule | ||
64 | { | ||
65 | get { return false; } | ||
66 | } | ||
67 | |||
68 | #endregion | ||
69 | } | ||
70 | } | ||