示例#1
0
        public void CalculateCumulativeHistogramData()
        {
            // Delete existing cumulative histogram data - it will be replaced with new data
            CumulativeHistogramData chd = new CumulativeHistogramData(_CaptureState);
            chd.DeleteCumulativeHistogramData();

            ProcessCapturePackets pcp = new ProcessCapturePackets();
            BindingList<BatchIntervalMarked> batchIntervals = new BindingList<BatchIntervalMarked>();

            // Get the batch intervals
            BindingList<BatchIntervalMarked> unmarkedBatchIntervals = new BindingList<BatchIntervalMarked>();
            BindingList<BatchIntervalMarked> markedBatchIntervals = new BindingList<BatchIntervalMarked>();
            BindingList<CumulativeInterval> cumulativeIntervals = new BindingList<CumulativeInterval>();
            cumulativeIntervals = pcp.GetCumulativeIntervals();

            foreach (CumulativeInterval ci in cumulativeIntervals)
            {
                if (ci.Marked)
                {
                    BatchIntervalMarked bim = new BatchIntervalMarked();
                    bim.BatchIntervalId = 0;
                    bim.CaptureBatchId = 0;
                    bim.IntervalNumber = ci.CumulativeIntervalNumber;
                    bim.Marked = CaptureState.Marked;
                    bim.PacketCount = ci.PacketCount;
                    markedBatchIntervals.Add(bim);
                }
                else
                {
                    BatchIntervalMarked bim = new BatchIntervalMarked();
                    bim.BatchIntervalId = 0;
                    bim.CaptureBatchId = 0;
                    bim.IntervalNumber = ci.CumulativeIntervalNumber;
                    bim.Marked = CaptureState.Unmarked;
                    bim.PacketCount = ci.PacketCount;
                    unmarkedBatchIntervals.Add(bim);
                }
            }

            switch (_CaptureState)
            {
                case CaptureState.Marked:
                    CalculateCumulativeHistogramProbability(markedBatchIntervals, BatchType.Cumulative, CaptureState.Marked);
                    break;
                case CaptureState.Unmarked:
                    CalculateCumulativeHistogramProbability(unmarkedBatchIntervals, BatchType.Cumulative, CaptureState.Unmarked);
                    break;
            }
        }