aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Framework/Monitoring/Alerts/DeadlockAlert.cs
blob: b546ccb9fb49089b087812364a7782e4e7f85cc0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
using OpenSim.Region.CoreModules.Framework.Monitoring.Monitors;

namespace OpenSim.Region.CoreModules.Framework.Monitoring.Alerts
{
    class DeadlockAlert : IAlert
    {
        private LastFrameTimeMonitor m_monitor;

        public DeadlockAlert(LastFrameTimeMonitor m_monitor)
        {
            this.m_monitor = m_monitor;
        }

        #region Implementation of IAlert

        public string GetName()
        {
            return "Potential Deadlock Alert";
        }

        public void Test()
        {
            if (m_monitor.GetValue() > 60 * 1000)
            {
                if(OnTriggerAlert != null)
                {
                    OnTriggerAlert(typeof (DeadlockAlert),
                                   (int) (m_monitor.GetValue()/1000) + " second(s) since last frame processed.", true);
                }
            }
        }

        public event Alert OnTriggerAlert;

        #endregion
    }
}