Ejemplo n.º 1
0
        internal static TimeSpan Measure(string apiName, string hintStr, TimeSpan maxAllowedLatency, Action action)
        {
            TimeSpan result;

            LatencyChecker.Measure(apiName, hintStr, maxAllowedLatency, TimeSpan.MaxValue, null, delegate()
            {
                action();
                return(0);
            }, out result);
            return(result);
        }
Ejemplo n.º 2
0
        internal static int MeasureClusApiAndKillIfExceeds(string apiName, string hintStr, Func <int> func)
        {
            TimerCallback latencyCallback = null;

            if (LatencyChecker.EnableClusterKill)
            {
                latencyCallback = new TimerCallback(LatencyChecker.OnClusApiHang);
            }
            TimeSpan currentLatency;
            int      result = LatencyChecker.Measure(apiName, hintStr, TimeSpan.FromSeconds((double)RegistryParameters.ClusApiLatencyAllowedInSec), TimeSpan.FromSeconds((double)RegistryParameters.ClusApiHangActionLatencyAllowedInSec), latencyCallback, func, out currentLatency);

            LatencyChecker.RaiseGreenEventIfNeeded(currentLatency);
            return(result);
        }
Ejemplo n.º 3
0
        internal static int MeasureClusApi(string apiName, string hintStr, Func <int> func)
        {
            TimeSpan timeSpan;

            return(LatencyChecker.Measure(apiName, hintStr, TimeSpan.FromSeconds((double)RegistryParameters.ClusApiLatencyAllowedInSec), TimeSpan.MaxValue, null, func, out timeSpan));
        }