Пример #1
0
        List <CallDelta> BuildDeltas(List <ServiceCallItem> calls)
        {
            List <CallDelta> deltas = new List <CallDelta>();

            // Generate a list of deltas between all possible pairs of calls
            for (int i = 0; i < calls.Count(); ++i)
            {
                for (int j = i + 1; j < calls.Count(); ++j)
                {
                    var delta = new CallDelta {
                        m_first = calls[i], m_second = calls[j]
                    };

                    // If the delta is below the max freuquency then add it to the list
                    if (delta.DeltaAsMs <= m_maxFrequencyMs)
                    {
                        deltas.Add(delta);
                    }
                }
            }
            return(deltas);
        }
Пример #2
0
            static public Sequence Create(CallDelta delta)
            {
                Sequence s = new Sequence();

                // Walk through the sequence of deltas starting at the supplied delta
                while (delta != null)
                {
                    s.m_seqCalls.Add(delta.m_first);
                    s.m_averageDelta += delta.Delta;

                    // At this point we need to add the last call to the sequence
                    if (delta.m_next == null)
                    {
                        // Add the call after computing the average because there is 1 less delta than calls
                        s.m_averageDelta /= s.m_seqCalls.Count;
                        s.m_seqCalls.Add(delta.m_second);
                    }

                    delta = delta.m_next;
                }

                return(s);
            }