internal ViewCommentsForm(ReadNewLog log)
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            string[] lines = new string[log.commentEventList.count];
            for (int i = 0; i < log.commentEventList.count; i++)
                lines[i] = string.Format("{0} ({1:f3} secs)", log.commentEventList.eventString[i], log.TickIndexToTime(log.commentEventList.eventTickIndex[i]));
            this.commentTextBox.Lines = lines;
        }
Esempio n. 2
0
        internal static void CommentReport(string logFileName)
        {
            // first read the entire file
            ReadNewLog log = new ReadNewLog(logFileName, false);
            ReadLogResult entireLogResult = GetLogResult(log);
            log.ReadFile(0, long.MaxValue, entireLogResult);

            Console.WriteLine("Comments logged in {0}", logFileName);
            Console.WriteLine("Time (seconds),Comment");
            for (int i = 0; i < log.commentEventList.count; i++)
                Console.WriteLine("{1:f3},{0}", log.commentEventList.eventString[i], log.TickIndexToTime(log.commentEventList.eventTickIndex[i]));
        }
Esempio n. 3
0
        internal static void FinalizerReport(bool criticalFinalizers, string logFileName, string startMarker, string endMarker)
        {
            // first read the entire file
            ReadNewLog log = new ReadNewLog(logFileName, false);
            ReadLogResult entireLogResult = GetLogResult(log);
            log.ReadFile(0, long.MaxValue, entireLogResult);

            // if we were given a start or an end marker, we need to re-read a portion of the file.
            ReadLogResult logResult = entireLogResult;
            if (startMarker != null || endMarker != null)
            {
                int startTickIndex = 0;
                int endTickIndex = entireLogResult.sampleObjectTable.lastTickIndex;

                if (startMarker != null)
                    startTickIndex = FindMarkerTickIndex(startMarker, log);

                if (endMarker != null)
                    endTickIndex = FindMarkerTickIndex(endMarker, log);

                long startPos = log.TickIndexToPos(startTickIndex);
                long endPos = log.TickIndexToPos(endTickIndex);

                // Read the selected portion of the log again
                logResult = new ReadLogResult();
                logResult.liveObjectTable = new LiveObjectTable(log);
                logResult.finalizerHistogram = new Histogram(log);
                logResult.criticalFinalizerHistogram = new Histogram(log);

                log.ReadFile(startPos, endPos, logResult);

                if (startMarker == null)
                    startMarker = CommentRangeForm.startCommentString;
                if (endMarker == null)
                    endMarker = CommentRangeForm.shutdownCommentString;
                Console.WriteLine("{0} summary for {1} Objects between {2} ({3} secs) and {4} ({5} secs)",
                                    criticalFinalizers ? "Critical Finalized" : "Finalized",
                                                    logFileName, 
                                                                startMarker, 
                                                                     log.TickIndexToTime(startTickIndex),
                                                                                   endMarker,
                                                                                        log.TickIndexToTime(endTickIndex));
            }
            else
                Console.WriteLine("{0} summary for {1}",
                                    criticalFinalizers ? "Critical Finalized" : "Finalized",
                                                    logFileName);

            // now we are ready to produce the allocation report from the allocation histogram
            WriteReport(criticalFinalizers ? logResult.criticalFinalizerHistogram : logResult.finalizerHistogram, "");
        }
Esempio n. 4
0
        internal static void SurvivorDifferenceReport(string logFileName, string startMarker, string endMarker)
        {
            // first read the entire file
            ReadNewLog log = new ReadNewLog(logFileName, false);
            ReadLogResult entireLogResult = GetLogResult(log);
            log.ReadFile(0, long.MaxValue, entireLogResult);

            if (startMarker == null)
                startMarker = CommentRangeForm.startCommentString;
            if (endMarker == null)
                endMarker = CommentRangeForm.shutdownCommentString;
            int startTickIndex = FindMarkerTickIndex(startMarker, log);
            int endTickIndex = FindMarkerTickIndex(endMarker, log);

            Histogram startHistogram = GetSurvivorHistogram(log, entireLogResult, 0, int.MaxValue, startMarker);
            Histogram endHistogram = GetSurvivorHistogram(log, entireLogResult, 0, int.MaxValue, endMarker);

            Console.WriteLine("Difference in surviving objects for {0} between {1} ({2} secs) and {3} ({4} secs)",
                                                                    logFileName, 
                                                                                startMarker,
                                                                                     log.TickIndexToTime(startTickIndex),
                                                                                                   endMarker, 
                                                                                                        log.TickIndexToTime(endTickIndex));

            WriteReport(startHistogram, endHistogram);
        }
Esempio n. 5
0
        internal static void SurvivorReport(string logFileName, string startMarker, string endMarker, string[] timeMarker)
        {
            // first read the entire file
            ReadNewLog log = new ReadNewLog(logFileName, false);
            ReadLogResult entireLogResult = GetLogResult(log);
            log.ReadFile(0, long.MaxValue, entireLogResult);

            if (startMarker == null)
                startMarker = CommentRangeForm.startCommentString;
            if (endMarker == null)
                endMarker = CommentRangeForm.shutdownCommentString;
            int startTickIndex = FindMarkerTickIndex(startMarker, log);
            int endTickIndex = FindMarkerTickIndex(endMarker, log);

            if (timeMarker == null || timeMarker.Length == 0)
            {
                timeMarker = new String[1];
                timeMarker[0] = CommentRangeForm.shutdownCommentString;
            }

            Histogram[] histogram = new Histogram[timeMarker.Length];
            Console.Write("Surviving objects for {0} allocated between {1} ({2} secs) and {3} ({4} secs) at",
                                                  logFileName,
                                                                        startMarker, 
                                                                             log.TickIndexToTime(startTickIndex),
                                                                                           endMarker,
                                                                                                log.TickIndexToTime(endTickIndex));
            string separator = "";
            for (int i = 0; i < timeMarker.Length; i++)
            {
                if (timeMarker[i] == null)
                    timeMarker[i] = CommentRangeForm.shutdownCommentString;
                histogram[i] = GetSurvivorHistogram(log, entireLogResult, startTickIndex, endTickIndex, timeMarker[i]);
                int timeTickIndex = FindMarkerTickIndex(timeMarker[i], log);
                Console.Write("{0} {1} ({2} secs) ", separator, timeMarker[i], log.TickIndexToTime(timeTickIndex));
                separator = ",";
            }

            Console.WriteLine();

            WriteReport(histogram, timeMarker);
        }