Esempio n. 1
0
        LatencyInfo IMailbox.GetLatencyInfo()
        {
            LatencyInfo result = new LatencyInfo();

            base.CreateContext("IMailbox.GetLatency", new DataContext[0]).Execute(delegate
            {
                result = this.WrappedObject.GetLatencyInfo();
            }, true);
            return(result);
        }
Esempio n. 2
0
        public static LatencyInfo operator +(LatencyInfo latencyInfo1, LatencyInfo latencyInfo2)
        {
            if (latencyInfo2.TotalNumberOfRemoteCalls == 0)
            {
                return(latencyInfo1);
            }
            if (latencyInfo1.TotalNumberOfRemoteCalls == 0)
            {
                return(latencyInfo2);
            }
            LatencyInfo latencyInfo3 = new LatencyInfo();

            latencyInfo3.NumberOfLatencySamplingCalls = latencyInfo1.NumberOfLatencySamplingCalls + latencyInfo2.NumberOfLatencySamplingCalls;
            latencyInfo3.Current = latencyInfo2.Current;
            latencyInfo3.TotalNumberOfRemoteCalls = latencyInfo1.TotalNumberOfRemoteCalls + latencyInfo2.TotalNumberOfRemoteCalls;
            latencyInfo3.TotalRemoteCallDuration  = latencyInfo1.TotalRemoteCallDuration + latencyInfo2.TotalRemoteCallDuration;
            if (latencyInfo3.NumberOfLatencySamplingCalls != 0)
            {
                latencyInfo3.Average = (latencyInfo1.Average * latencyInfo1.NumberOfLatencySamplingCalls + latencyInfo2.Average * latencyInfo2.NumberOfLatencySamplingCalls) / latencyInfo3.NumberOfLatencySamplingCalls;
                latencyInfo3.Min     = Math.Min(latencyInfo1.Min, latencyInfo2.Min);
                latencyInfo3.Max     = Math.Max(latencyInfo1.Max, latencyInfo2.Max);
            }
            return(latencyInfo3);
        }