Ejemplo n.º 1
0
        public void Refresh(List <ThreadStack> threadStacks)
        {
            Dictionary <UInt64, Dictionary <UInt32, ThreadStack> > segregated = new Dictionary <UInt64, Dictionary <UInt32, ThreadStack> >();

            for (int i = 0; i < threadStacks.Count; ++i)
            {
                ThreadStack tStack = threadStacks[i];
                Dictionary <UInt32, ThreadStack> tStacks;
                UInt64 did = tStack.DomainId;
                if (!(segregated.TryGetValue(did, out tStacks)))
                {
                    tStacks = new Dictionary <UInt32, ThreadStack>();
                    segregated.Add(did, tStacks);
                }
                tStacks.Add(tStack.OsThreadId, tStack);
            }

            List <UInt64> appDomainsNoLonger = new List <UInt64>();

            foreach (KeyValuePair <UInt64, AppDomainNode> pair in r_appDomainNodes)
            {
                UInt64        oldId     = pair.Key;
                AppDomainNode oldDomain = pair.Value;
                Dictionary <UInt32, ThreadStack> tStacks;
                if (segregated.TryGetValue(oldId, out tStacks))
                {
                    oldDomain.Refresh(tStacks);
                }
                else
                {
                    oldDomain.Remove();
                    appDomainsNoLonger.Add(oldId);
                }
            }

            foreach (UInt64 key in appDomainsNoLonger)
            {
                r_appDomainNodes.Remove(key);
            }

            foreach (KeyValuePair <UInt64, Dictionary <UInt32, ThreadStack> > pair in segregated)
            {
                UInt64        newId = pair.Key;
                AppDomainNode appDomainNode;
                if (!r_appDomainNodes.TryGetValue(newId, out appDomainNode))
                {
                    appDomainNode = new AppDomainNode(r_manager, r_rootNode, pair.Value);
                    r_appDomainNodes.Add(newId, appDomainNode);
                }
            }
        }
Ejemplo n.º 2
0
        public void Refresh(List<ThreadStack> threadStacks)
        {
            Dictionary<UInt64, Dictionary<UInt32, ThreadStack>> segregated = new Dictionary<UInt64, Dictionary<UInt32, ThreadStack>>();
            for (int i = 0; i < threadStacks.Count; ++i)
            {
                ThreadStack tStack = threadStacks[i];
                Dictionary<UInt32, ThreadStack> tStacks;
                UInt64 did = tStack.DomainId;
                if (!(segregated.TryGetValue(did, out tStacks)))
                {
                    tStacks = new Dictionary<UInt32, ThreadStack>();
                    segregated.Add(did, tStacks);
                }
                tStacks.Add(tStack.OsThreadId, tStack);
            }

            List<UInt64> appDomainsNoLonger = new List<UInt64>();

            foreach (KeyValuePair<UInt64, AppDomainNode> pair in r_appDomainNodes)
            {
                UInt64 oldId = pair.Key;
                AppDomainNode oldDomain = pair.Value;
                Dictionary<UInt32, ThreadStack> tStacks;
                if (segregated.TryGetValue(oldId, out tStacks))
                {
                    oldDomain.Refresh(tStacks);
                }
                else
                {
                    oldDomain.Remove();
                    appDomainsNoLonger.Add(oldId);
                }
            }

            foreach (UInt64 key in appDomainsNoLonger)
            {
                r_appDomainNodes.Remove(key);
            }

            foreach (KeyValuePair<UInt64, Dictionary<UInt32, ThreadStack>> pair in segregated)
            {
                UInt64 newId = pair.Key;
                AppDomainNode appDomainNode;
                if (!r_appDomainNodes.TryGetValue(newId, out appDomainNode))
                {
                    appDomainNode = new AppDomainNode(r_manager, r_rootNode, pair.Value);
                    r_appDomainNodes.Add(newId, appDomainNode);
                }
            }
        }