示例#1
0
        private void Interprete(FunctionMap map, bool reverse, Run run)
        {
            int currentWalk = 0;

            foreach (List <FunctionID> original in stackWalks)
            {
                currentWalk++;
                List <FunctionID> stackWalk;
                if (reverse)
                {
                    stackWalk = new List <FunctionID>(original);
                    stackWalk.Reverse();
                }
                else
                {
                    stackWalk = original;
                }
                for (int i = 0; i < stackWalk.Count; i++)
                {
                    Function function = Run.GetFunctionInfo(map, stackWalk[stackWalk.Count - i - 1], run, reverse);
                    if (function.lastWalk != currentWalk)
                    {
                        function.Samples++;
                        function.stackWalks.Add(new StackWalk(currentWalk, stackWalk.Count - i - 1, stackWalk));
                    }
                    function.lastWalk = currentWalk;
                }
            }
            //foreach (List<FunctionID> stackWalk in stackWalks)
            //{
            //    Function f = Run.GetFunctionInfo(map, stackWalk[0], run);
            //    f.ExclusiveSamples++;
            //}
        }
示例#2
0
        private void InterpreteData()
        {
            int currentWalk = 0;

            foreach (List <int> stackWalk in stackWalks)
            {
                currentWalk++;
                for (int i = 0; i < stackWalk.Count; i++)
                {
                    FunctionInfo function = Run.GetFunctionInfo(functions, stackWalk[stackWalk.Count - i - 1]);
                    if (function.lastWalk != currentWalk)
                    {
                        function.Samples++;
                        function.stackWalks.Add(new StackWalk(currentWalk, stackWalk.Count - i - 1, stackWalk));                       //.GetRange(0, ));
                    }
                    function.lastWalk = currentWalk;
                }
            }
            // combine with above
            foreach (List <int> reversedWalk in stackWalks)
            {
                List <int> stackWalk = new List <int>(reversedWalk);
                stackWalk.Reverse();
                currentWalk++;
                for (int i = 0; i < stackWalk.Count; i++)
                {
                    FunctionInfo function = Run.GetFunctionInfo(callers, stackWalk[stackWalk.Count - i - 1]);
                    if (function.lastWalk != currentWalk)
                    {
                        function.Samples++;
                        function.stackWalks.Add(new StackWalk(currentWalk, stackWalk.Count - i - 1, stackWalk));
                    }
                    function.lastWalk = currentWalk;
                }
            }
            maxSamples = 0;
            foreach (FunctionInfo function in functions.Values)
            {
                if (function.Samples > maxSamples)
                {
                    maxSamples = function.Samples;
                }
            }
        }