private void OnAllocationTick(GCAllocationTickTraceData data)
        {
            if (FilterOutEvent(data))
            {
                return;
            }

            if (_verbose)
            {
                Console.WriteLine($"{data.AllocationKind,7} | {data.AllocationAmount64,10} : {data.TypeName}");

                var callstack = data.CallStack();
                if (callstack != null)
                {
                    DumpStack(callstack);
                }
            }

            _allocations.AddAllocation(data.AllocationKind, (ulong)data.AllocationAmount64, data.TypeName);
        }
Esempio n. 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);
        }