Example #1
0
        private static void FillHistogramIntoDiffTypeDescriptor(Histogram histogram, DiffTypeDescriptor[] typeIndexToDiffTypeDescriptor)
        {
            for (int i = 0; i < histogram.typeSizeStacktraceToCount.Length; i++)
            {
                int count = histogram.typeSizeStacktraceToCount[i];
                if (count == 0)
                {
                    continue;
                }

                int[] stacktrace = histogram.readNewLog.stacktraceTable.IndexToStacktrace(i);
                int   typeIndex  = stacktrace[0];
                int   size       = stacktrace[1];

                if (typeIndexToDiffTypeDescriptor[typeIndex] == null)
                {
                    typeIndexToDiffTypeDescriptor[typeIndex] = new DiffTypeDescriptor(typeIndex);
                }

                typeIndexToDiffTypeDescriptor[typeIndex].bSize     += size * count;
                typeIndexToDiffTypeDescriptor[typeIndex].diffSize  += size * count;
                typeIndexToDiffTypeDescriptor[typeIndex].bCount    += count;
                typeIndexToDiffTypeDescriptor[typeIndex].diffCount += count;
            }
        }
Example #2
0
        private static void WriteReport(Histogram aHistogram, Histogram bHistogram)
        {
            DiffTypeDescriptor[] typeIndexToDiffTypeDescriptor = new DiffTypeDescriptor[aHistogram.readNewLog.typeName.Length];

            FillHistogramIntoDiffTypeDescriptor(aHistogram, typeIndexToDiffTypeDescriptor);
            for (int i = 0; i < typeIndexToDiffTypeDescriptor.Length; i++)
            {
                DiffTypeDescriptor td = typeIndexToDiffTypeDescriptor[i];
                if (td != null)
                {
                    td.aSize     = td.bSize;
                    td.diffSize  = -td.bSize;
                    td.aCount    = td.bCount;
                    td.diffCount = -td.bCount;
                    td.bSize     = 0;
                    td.bCount    = 0;
                }
            }
            FillHistogramIntoDiffTypeDescriptor(bHistogram, typeIndexToDiffTypeDescriptor);

            ArrayList          al      = new ArrayList();
            DiffTypeDescriptor totalTd = new DiffTypeDescriptor(0);

            for (int i = 0; i < typeIndexToDiffTypeDescriptor.Length; i++)
            {
                DiffTypeDescriptor td = typeIndexToDiffTypeDescriptor[i];
                if (td != null)
                {
                    al.Add(td);

                    totalTd.aCount    += td.aCount;
                    totalTd.aSize     += td.aSize;
                    totalTd.diffCount += td.diffCount;
                    totalTd.diffSize  += td.diffSize;
                    totalTd.bCount    += td.bCount;
                    totalTd.bSize     += td.bSize;
                }
            }
            al.Sort();

            Console.WriteLine("Start size,Start #instances,End size,End #instances,Diff size,Diff#instances,Typename");
            Console.WriteLine("{0},{1},{2},{3},{4},{5},{6}", totalTd.aSize, totalTd.aCount, totalTd.bSize, totalTd.bCount, totalTd.diffSize, totalTd.diffCount, "Grand total");
            foreach (DiffTypeDescriptor td in al)
            {
                Console.WriteLine("{0},{1},{2},{3},{4},{5},{6}", td.aSize, td.aCount, td.bSize, td.bCount, td.diffSize, td.diffCount, aHistogram.readNewLog.typeName[td.typeIndex]);
            }
        }
Example #3
0
            public int CompareTo(Object o)
            {
                DiffTypeDescriptor that = (DiffTypeDescriptor)o;

                if (that.diffSize < this.diffSize)
                {
                    return(-1);
                }
                else if (that.diffSize > this.diffSize)
                {
                    return(1);
                }
                else
                {
                    return(0);
                }
            }
Example #4
0
        private static void WriteReport(Histogram aHistogram, Histogram bHistogram)
        {
            DiffTypeDescriptor[] typeIndexToDiffTypeDescriptor = new DiffTypeDescriptor[aHistogram.readNewLog.typeName.Length];

            FillHistogramIntoDiffTypeDescriptor(aHistogram, typeIndexToDiffTypeDescriptor);
            for (int i = 0; i < typeIndexToDiffTypeDescriptor.Length; i++)
            {
                DiffTypeDescriptor td = typeIndexToDiffTypeDescriptor[i];
                if (td != null)
                {
                    td.aSize     =   td.bSize;
                    td.diffSize  = - td.bSize;
                    td.aCount    =   td.bCount;
                    td.diffCount = - td.bCount;
                    td.bSize     = 0;
                    td.bCount    = 0;
                }
            }
            FillHistogramIntoDiffTypeDescriptor(bHistogram, typeIndexToDiffTypeDescriptor);

            ArrayList al = new ArrayList();
            DiffTypeDescriptor totalTd = new DiffTypeDescriptor(0);
            for (int i = 0; i < typeIndexToDiffTypeDescriptor.Length; i++)
            {
                DiffTypeDescriptor td = typeIndexToDiffTypeDescriptor[i];
                if (td != null)
                {
                    al.Add(td);

                    totalTd.aCount    += td.aCount;
                    totalTd.aSize     += td.aSize;
                    totalTd.diffCount += td.diffCount;
                    totalTd.diffSize  += td.diffSize;
                    totalTd.bCount    += td.bCount;
                    totalTd.bSize     += td.bSize;
                }
            }
            al.Sort();

            Console.WriteLine("Start size,Start #instances,End size,End #instances,Diff size,Diff#instances,Typename");
            Console.WriteLine("{0},{1},{2},{3},{4},{5},{6}", totalTd.aSize, totalTd.aCount, totalTd.bSize, totalTd.bCount, totalTd.diffSize, totalTd.diffCount, "Grand total");
            foreach (DiffTypeDescriptor td in al)
            {
                Console.WriteLine("{0},{1},{2},{3},{4},{5},{6}", td.aSize, td.aCount, td.bSize, td.bCount, td.diffSize, td.diffCount, aHistogram.readNewLog.typeName[td.typeIndex]);
            }
        }
Example #5
0
        private static void FillHistogramIntoDiffTypeDescriptor(Histogram histogram, DiffTypeDescriptor[] typeIndexToDiffTypeDescriptor)
        {
            for (int i = 0; i < histogram.typeSizeStacktraceToCount.Length; i++)
            {
                int count = histogram.typeSizeStacktraceToCount[i];
                if (count == 0)
                    continue;

                int[] stacktrace = histogram.readNewLog.stacktraceTable.IndexToStacktrace(i);
                int typeIndex = stacktrace[0];
                int size = stacktrace[1];

                if (typeIndexToDiffTypeDescriptor[typeIndex] == null)
                    typeIndexToDiffTypeDescriptor[typeIndex] = new DiffTypeDescriptor(typeIndex);
                typeIndexToDiffTypeDescriptor[typeIndex].bSize += size*count;
                typeIndexToDiffTypeDescriptor[typeIndex].diffSize += size*count;
                typeIndexToDiffTypeDescriptor[typeIndex].bCount += count;
                typeIndexToDiffTypeDescriptor[typeIndex].diffCount += count;
            }
        }