예제 #1
0
        private long GetValueForLayout(NodeModel root, SizeLayouts layout)
        {
            long value = 0;

            switch (layout)
            {
            case SizeLayouts.Constant:
                value = 1;
                break;

            case SizeLayouts.MethodSize:
                value = root.XNode.Lines;
                break;

            case SizeLayouts.TimeInMethod:
                // why is this negetive?? HAVENT RETURNED YET, property should return 0 i think if  neg, or detect still inside and return that
                if (root.XNode.CalledIn != null)
                {
                    foreach (FunctionCall call in root.XNode.CalledIn)
                    {
                        value += call.TotalTimeInsideDest;
                    }
                }
                break;

            case SizeLayouts.Hits:
                if (root.XNode.CalledIn != null)
                {
                    foreach (FunctionCall call in root.XNode.CalledIn)
                    {
                        value += call.TotalHits;
                    }
                }
                break;

            case SizeLayouts.TimePerHit:
                if (root.XNode.CalledIn != null)
                {
                    int count = 0;

                    foreach (FunctionCall call in root.XNode.CalledIn)
                    {
                        if (call.TotalHits > 0)
                        {
                            count++;
                            value += call.TotalTimeInsideDest / call.TotalHits;
                        }
                    }

                    if (count > 0)
                    {
                        value /= count;
                    }
                }

                break;
            }

            return(value);
        }
예제 #2
0
        private long GetValueForLayout(NodeModel root, SizeLayouts layout)
        {
            long value = 0;

            switch (layout)
            {
                case SizeLayouts.Constant:
                    value = 1;
                    break;
                case SizeLayouts.MethodSize:
                    value = root.XNode.Lines;
                    break;
                case SizeLayouts.TimeInMethod:
                    // why is this negetive?? HAVENT RETURNED YET, property should return 0 i think if  neg, or detect still inside and return that
                    if (root.XNode.CalledIn != null)
                        foreach (FunctionCall call in root.XNode.CalledIn)
                            value += call.TotalTimeInsideDest;
                    break;
                case SizeLayouts.Hits:
                    if (root.XNode.CalledIn != null)
                        foreach (FunctionCall call in root.XNode.CalledIn)
                            value += call.TotalHits;
                    break;
                case SizeLayouts.TimePerHit:
                    if (root.XNode.CalledIn != null)
                    {
                        int count = 0;

                        foreach (FunctionCall call in root.XNode.CalledIn)
                            if (call.TotalHits > 0)
                            {
                                count++;
                                value += call.TotalTimeInsideDest / call.TotalHits;
                            }

                        if (count > 0)
                            value /= count;
                    }

                    break;
            }

            return value;
        }