public void SetUp(int testIndex, IIntervalContainer<DateTime> intervalContainer)
 {
     this.numberOfIntervals = this.CollectionCount(testIndex);
     var intervals = GenerateIncludedOneIntoAnotherIntervals(DateTime.Now, this.numberOfIntervals);
     foreach (var interval in intervals)
     {
         intervalContainer.Add(interval);
     }
 }
Example #2
0
        private IIntervalContainer <DateTime> CreateIntervalContainer(IEnumerable <Interval <DateTime> > intervals)
        {
            IIntervalContainer <DateTime> intervalContainer = CreateIntervalContainer();

            foreach (var interval in intervals)
            {
                intervalContainer.Add(interval);
            }
            return(intervalContainer);
        }
Example #3
0
        public void SetUp(int testIndex, IIntervalContainer <DateTime> intervalContainer)
        {
            this.numberOfIntervals = this.CollectionCount(testIndex);
            var intervals = GenerateIncludedOneIntoAnotherIntervals(DateTime.Now, this.numberOfIntervals);

            foreach (var interval in intervals)
            {
                intervalContainer.Add(interval);
            }
        }
        public void Add_Interval(IIntervalContainer <DateTime> container)
        {
            const int intervalLength         = 4;
            const int spaceLength            = 1;
            const int intervalAndSpaceLength = intervalLength + spaceLength;

            for (int i = 0; i < this.numberOfIntervals; i++)
            {
                var intervalToAdd = this.ToDateTimeInterval(this.now, i * intervalAndSpaceLength, ((i + 1) * intervalAndSpaceLength) - spaceLength);
                container.Add(intervalToAdd);
            }
        }
        public void Add_Interval(IIntervalContainer<DateTime> container)
        {
            const int intervalLength = 4;
            const int spaceLength = 1;
            const int intervalAndSpaceLength = intervalLength + spaceLength;

            for (int i = 0; i < this.numberOfIntervals; i++)
            {
                var intervalToAdd = this.ToDateTimeInterval(this.now, i * intervalAndSpaceLength, ((i + 1) * intervalAndSpaceLength) - spaceLength);
                container.Add(intervalToAdd);
            }
        }
Example #6
0
        private void AddRemovedIntervals(IIntervalContainer <DateTime> intervalContainer, List <Interval <DateTime> > intervals)
        {
            stopwatch.Reset();
            long initalMemory = GC.GetTotalMemory(true);

            stopwatch.Start();

            //add second part of intervals
            int halfNumberOfIntervals = intervals.Count / 2;

            for (int i = 0; i < halfNumberOfIntervals; i++)
            {
                intervalContainer.Add(intervals[halfNumberOfIntervals + i]);
            }

            stopwatch.Stop();
            long endAddIntervalsMemory = GC.GetTotalMemory(true);
            long bytesUsed             = endAddIntervalsMemory - initalMemory;

            timeEllapsedReport.AppendLine();
            timeEllapsedReport.AppendLine(string.Format("Time taken for adding {0} intervals: {1} ms", halfNumberOfIntervals, stopwatch.ElapsedMilliseconds));
            timeEllapsedReport.AppendLine(string.Format("Memory used for adding {0} intervals: {1:0.00} MB", halfNumberOfIntervals, BytesToMegabytes(bytesUsed)));
            timeEllapsedReport.AppendLine();
        }
        private void AddRemovedIntervals(IIntervalContainer<DateTime> intervalContainer, List<Interval<DateTime>> intervals)
        {
            stopwatch.Reset();
            long initalMemory = GC.GetTotalMemory(true);
            stopwatch.Start();

            //add second part of intervals
            int halfNumberOfIntervals = intervals.Count / 2;
            for (int i = 0; i < halfNumberOfIntervals; i++)
            {
                intervalContainer.Add(intervals[halfNumberOfIntervals + i]);
            }

            stopwatch.Stop();
            long endAddIntervalsMemory = GC.GetTotalMemory(true);
            long bytesUsed = endAddIntervalsMemory - initalMemory;

            timeEllapsedReport.AppendLine();
            timeEllapsedReport.AppendLine(string.Format("Time taken for adding {0} intervals: {1} ms", halfNumberOfIntervals, stopwatch.ElapsedMilliseconds));
            timeEllapsedReport.AppendLine(string.Format("Memory used for adding {0} intervals: {1:0.00} MB", halfNumberOfIntervals, BytesToMegabytes(bytesUsed)));
            timeEllapsedReport.AppendLine();
        }