예제 #1
0
        public void UpdateCallees(IList <MethodPerformanceInfo> invocationsList)
        {
            _allCalleePerformanceInfo = new ObservableCollection <MethodPerformanceInfo>(invocationsList);
            // ToList needed here to stop Except from being executed in a deferred manner
            var removedPerformanceInfo = CalleePerformanceInfos.Except(invocationsList).ToList();

            foreach (var performanceInfo in removedPerformanceInfo)
            {
                if (_allCalleePerformanceInfo.Contains(performanceInfo))
                {
                    // another call still exists
                    continue;
                }
                _calleePerformanceInfos.Remove(performanceInfo);
                performanceInfo._callerPerformanceInfos.Remove(this);
            }
            var addedPerformanceInfo = invocationsList.Except(CalleePerformanceInfos).ToList();

            foreach (var performanceInfo in addedPerformanceInfo)
            {
                _calleePerformanceInfos.Add(performanceInfo);
                performanceInfo._callerPerformanceInfos.Add(this);
            }
        }