Exemple #1
0
        void AddAlloc(AllocTick key, bool large, double val)
        {
            int id;

            if (!m_typeMap.TryGetValue(key, out id))
            {
                id = m_typeMap.Count;

                m_allocSites.Add(key);
                m_typeMap[key] = id;
            }

            if (val < 0)
            {
                m_hasBadAllocTick = true;
            }

            if (m_hasBadAllocTick)
            {
                // Clap this between 90K and 110K (for small objs) and 90K to 2Meg (for large obects).
                val = Math.Max(val, .090);
                val = Math.Min(val, large ? 2 : .11);
            }

            m_allocSites[id].Add(large, val);
        }
Exemple #2
0
        public void AllocationTick(GCAllocationTickTraceData data, bool large, double value)
        {
            AllocTick key = new AllocTick();

            // May not have type name prior to 4.5
            if (!String.IsNullOrEmpty(data.TypeName))
            {
                key.m_type = data.TypeName;
            }

            TraceCallStack stack = data.CallStack();

            // Walk the call stack to find module above clr
            while ((stack != null) && (stack.Caller != null) && stack.CodeAddress.ModuleName.IsClr())
            {
                stack = stack.Caller;
            }

            if (stack != null)
            {
                key.m_caller1 = stack.CodeAddress.CodeAddressIndex;

                stack = stack.Caller;

                // Walk call stack to find module above mscorlib
                while ((stack != null) && (stack.Caller != null) && stack.CodeAddress.ModuleName.IsMscorlib())
                {
                    stack = stack.Caller;
                }

                if (stack != null)
                {
                    key.m_caller2 = stack.CodeAddress.CodeAddressIndex;
                }
            }

            AddAlloc(key, large, value);
        }
Exemple #3
0
        public void DrawAllocation(Renderer render)
        {
            double total = 0;

            for (int i = 0; i < m_data.allocsites.Count; i++)
            {
                total += m_data.allocsites[i].Alloc;
            }

            double onePercent = total / 100;

            double other = 0;

            int y = 0;

            for (int i = 0; i < m_data.allocsites.Count; i++)
            {
                double alloc = m_data.allocsites[i].Alloc;

                if (alloc >= onePercent)
                {
                    AllocTick key = m_data.allocsites[i];

                    string method = m_data.dataFile.GetMethodName(key.m_caller1);

                    render.DrawAlloc(y, alloc, alloc * 100 / total, key.m_type, method);
                    y++;
                }
                else
                {
                    other += alloc;
                }
            }

            render.DrawAlloc(y, other, other * 100 / total, "Other", String.Empty);
        }