예제 #1
0
        protected TimeSpan ComputeNewTimeOut(double ms, TimeStats stats, double min, double stdevs)
        {
            stats.AddSample(ms);
            double timeout = stats.Average + stdevs * stats.StdDev;

            timeout = Math.Max(min, timeout);
            return(TimeSpan.FromMilliseconds(timeout));
        }
예제 #2
0
 public void AddAckSampleFor(RequestState reqs, ISender s, TimeSpan rtt)
 {
     lock ( _sync ) {
         var tsp = GetStatsFor(s);
         tsp.First.AddSample(rtt.TotalMilliseconds);
         tsp.Second.AddSample(rtt.TotalMilliseconds);
         _global_stats.AddSample(rtt.TotalMilliseconds);
         //Update the minimum:
         _min_timeout = Math.Min(_min_timeout, tsp.First.AvePlusKStdDev(_STD_DEVS));
         _min_timeout = Math.Min(_min_timeout, tsp.Second.AvePlusKStdDev(_STD_DEVS));
         _min_timeout = Math.Min(_min_timeout, _global_stats.AvePlusKStdDev(_STD_DEVS));
     }
 }
예제 #3
0
 public void AddReplySampleFor(RequestState reqs, ISender s, TimeSpan rtt)
 {
     /*
      * Let's look at how long it took to get this reply:
      */
     if (reqs.GotAck)
     {
         lock (_sync) {
             TimeStats ts = _acked_rtt_stats;
             ts.AddSample(rtt.TotalMilliseconds);
             _min_timeout = Math.Min(_min_timeout, ts.AvePlusKStdDev(_STD_DEVS));
         }
     }
     else
     {
         AddAckSampleFor(reqs, s, rtt);
     }
 }
예제 #4
0
 protected TimeSpan ComputeNewTimeOut(double ms, TimeStats stats, double min, double stdevs) {
   stats.AddSample(ms);
   double timeout = stats.Average + stdevs * stats.StdDev;
   timeout = Math.Max(min, timeout);
   return TimeSpan.FromMilliseconds( timeout );
 }