예제 #1
0
            // This method captures the time during which any copy was in progress
            // each copy time period is record in the Interval list
            private long GetTotalCopyMillis(ShuffleSchedulerImpl.CopyTimeTracker.Interval newInterval
                                            )
            {
                if (newInterval == null)
                {
                    return(copyMillis);
                }
                IList <ShuffleSchedulerImpl.CopyTimeTracker.Interval> result = new AList <ShuffleSchedulerImpl.CopyTimeTracker.Interval
                                                                                          >(intervals.Count + 1);

                foreach (ShuffleSchedulerImpl.CopyTimeTracker.Interval interval in intervals)
                {
                    if (interval.end < newInterval.start)
                    {
                        result.AddItem(interval);
                    }
                    else
                    {
                        if (interval.start > newInterval.end)
                        {
                            result.AddItem(newInterval);
                            newInterval = interval;
                        }
                        else
                        {
                            newInterval = new ShuffleSchedulerImpl.CopyTimeTracker.Interval(Math.Min(interval
                                                                                                     .start, newInterval.start), Math.Max(newInterval.end, interval.end));
                        }
                    }
                }
                result.AddItem(newInterval);
                intervals = result;
                //compute total millis
                long length = 0;

                foreach (ShuffleSchedulerImpl.CopyTimeTracker.Interval interval_1 in intervals)
                {
                    length += interval_1.GetIntervalLength();
                }
                return(length);
            }
예제 #2
0
 public virtual void Add(long s, long e)
 {
     ShuffleSchedulerImpl.CopyTimeTracker.Interval interval = new ShuffleSchedulerImpl.CopyTimeTracker.Interval
                                                                  (s, e);
     copyMillis = GetTotalCopyMillis(interval);
 }