Esempio n. 1
0
        private static void DumpStack(AddressStack stack, MethodStore methods)
        {
            var callstack = stack.Stack;

            for (int i = 0; i < Math.Min(10, callstack.Count); i++)
            {
                Console.WriteLine($"       {methods.GetFullName(callstack[i])}");
            }
        }
Esempio n. 2
0
        public void AddStack(int threadID, AddressStack stack)
        {
            if (_perThreadLastAllocation.TryGetValue(threadID, out var lastAlloc))
            {
                lastAlloc.AddStack(stack);
                _perThreadLastAllocation.Remove(threadID);
                return;
            }

            //Console.WriteLine("no last allocation for the stack event");
        }
Esempio n. 3
0
        internal void AddStack(AddressStack stack)
        {
            var info = GetInfo(stack);

            if (info == null)
            {
                info = new StackInfo(stack);
                _stacks.Add(info);
            }

            info.Count++;
        }
Esempio n. 4
0
        private StackInfo GetInfo(AddressStack stack)
        {
            for (int i = 0; i < _stacks.Count; i++)
            {
                var info = _stacks[i];
                if (stack.Equals(info.Stack))
                {
                    return(info);
                }
            }

            return(null);
        }
        private AddressStack BuildCallStack(ClrStackWalkTraceData data)
        {
            var          length = data.FrameCount;
            AddressStack stack  = new AddressStack(length);

            // frame 0 is the last frame of the stack (i.e. last called method)
            for (int i = 0; i < length; i++)
            {
                stack.AddFrame(data.InstructionPointer(i));
            }

            return(stack);
        }
Esempio n. 6
0
 internal StackInfo(AddressStack stack)
 {
     Count  = 0;
     _stack = stack;
 }