diff options
-rw-r--r-- | OpenSim/Framework/Monitoring/Watchdog.cs | 31 | ||||
-rw-r--r-- | OpenSim/Region/Application/OpenSimBase.cs | 9 |
2 files changed, 33 insertions, 7 deletions
diff --git a/OpenSim/Framework/Monitoring/Watchdog.cs b/OpenSim/Framework/Monitoring/Watchdog.cs index d4cf02f..02f11fa 100644 --- a/OpenSim/Framework/Monitoring/Watchdog.cs +++ b/OpenSim/Framework/Monitoring/Watchdog.cs | |||
@@ -97,6 +97,32 @@ namespace OpenSim.Framework.Monitoring | |||
97 | /// /summary> | 97 | /// /summary> |
98 | public static event Action<ThreadWatchdogInfo> OnWatchdogTimeout; | 98 | public static event Action<ThreadWatchdogInfo> OnWatchdogTimeout; |
99 | 99 | ||
100 | /// <summary> | ||
101 | /// Is this watchdog active? | ||
102 | /// </summary> | ||
103 | public static bool Enabled | ||
104 | { | ||
105 | get { return m_enabled; } | ||
106 | set | ||
107 | { | ||
108 | // m_log.DebugFormat("[MEMORY WATCHDOG]: Setting MemoryWatchdog.Enabled to {0}", value); | ||
109 | |||
110 | if (value == m_enabled) | ||
111 | return; | ||
112 | |||
113 | m_enabled = value; | ||
114 | |||
115 | if (m_enabled) | ||
116 | { | ||
117 | // Set now so we don't get alerted on the first run | ||
118 | LastWatchdogThreadTick = Environment.TickCount & Int32.MaxValue; | ||
119 | } | ||
120 | |||
121 | m_watchdogTimer.Enabled = m_enabled; | ||
122 | } | ||
123 | } | ||
124 | private static bool m_enabled; | ||
125 | |||
100 | private static readonly ILog m_log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | 126 | private static readonly ILog m_log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); |
101 | private static Dictionary<int, ThreadWatchdogInfo> m_threads; | 127 | private static Dictionary<int, ThreadWatchdogInfo> m_threads; |
102 | private static System.Timers.Timer m_watchdogTimer; | 128 | private static System.Timers.Timer m_watchdogTimer; |
@@ -115,11 +141,6 @@ namespace OpenSim.Framework.Monitoring | |||
115 | m_watchdogTimer = new System.Timers.Timer(WATCHDOG_INTERVAL_MS); | 141 | m_watchdogTimer = new System.Timers.Timer(WATCHDOG_INTERVAL_MS); |
116 | m_watchdogTimer.AutoReset = false; | 142 | m_watchdogTimer.AutoReset = false; |
117 | m_watchdogTimer.Elapsed += WatchdogTimerElapsed; | 143 | m_watchdogTimer.Elapsed += WatchdogTimerElapsed; |
118 | |||
119 | // Set now so we don't get alerted on the first run | ||
120 | LastWatchdogThreadTick = Environment.TickCount & Int32.MaxValue; | ||
121 | |||
122 | m_watchdogTimer.Start(); | ||
123 | } | 144 | } |
124 | 145 | ||
125 | /// <summary> | 146 | /// <summary> |
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index 37cfe1d..f784398 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs | |||
@@ -305,8 +305,13 @@ namespace OpenSim | |||
305 | m_httpServerPort = m_networkServersInfo.HttpListenerPort; | 305 | m_httpServerPort = m_networkServersInfo.HttpListenerPort; |
306 | SceneManager.OnRestartSim += handleRestartRegion; | 306 | SceneManager.OnRestartSim += handleRestartRegion; |
307 | 307 | ||
308 | // Only start the memory watchdog once all regions are ready | 308 | // Only enable the watchdogs when all regions are ready. Otherwise we get false positives when cpu is |
309 | SceneManager.OnRegionsReadyStatusChange += sm => MemoryWatchdog.Enabled = sm.AllRegionsReady; | 309 | // heavily used during initial startup. |
310 | // | ||
311 | // FIXME: It's also possible that region ready status should be flipped during an OAR load since this | ||
312 | // also makes heavy use of the CPU. | ||
313 | SceneManager.OnRegionsReadyStatusChange | ||
314 | += sm => { MemoryWatchdog.Enabled = sm.AllRegionsReady; Watchdog.Enabled = sm.AllRegionsReady; }; | ||
310 | } | 315 | } |
311 | 316 | ||
312 | /// <summary> | 317 | /// <summary> |