Ejemplo n.º 1
0
        /// <summary>
        /// Returns the cumulative time based on the given base time and duration iteration
        /// </summary>
        /// <param name="iteration">The iteration.</param>
        /// <returns></returns>
        public DateTime CumulativeTime(int iteration)
        {
            var timeSpan = TimeSpan.Zero;

            if (iteration >= 0)
            {
                for (int i = 0; i <= iteration; i++)
                {
                    timeSpan = timeSpan.Add(_items[i % _items.Count].Duration);
                }
            }

            return(BaseTime.Add(timeSpan));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Calculates the first end time when the activity set is first starting.
        /// </summary>
        /// <returns></returns>
        public DateTime CalculateInitialEndTime()
        {
            var endTime = BaseTime;

            // Determine if there should be an initial stagger by looking at the stagger setting for the
            // very last entry.  Since execution of the schedule can be repeated, using the duration of the
            // last segment provides a way to calculate what the initial variance should be.
            var lastSegment = GetSegment(SegmentCount - 1);

            // If there is a stagger for the last segment, then calculate a variance based on the duration of
            // the last segment and add it to the base time.  This will provide an offset to be used for
            // the initial startup of the schedule.  If no stagger is required, then all clients will start
            // at the BaseTime value, which will create a immediate increase in load.
            if (lastSegment.Stagger)
            {
                endTime = BaseTime.Add(Variance(lastSegment.Duration));
            }

            TraceFactory.Logger.Debug("First End Time: {0}".FormatWith(endTime));
            return(endTime);
        }