Esempio n. 1
0
        private void RunTriage()
        {
            string[] dumpFiles = GetFilesFromPattern(_options.TriagePattern);
            _context.WriteInfoLine("Triage: enumerated {0} dump files in directory '{1}'", dumpFiles.Length, Path.GetDirectoryName(_options.TriagePattern));
            Dictionary <string, TriageInformation> triages = new Dictionary <string, TriageInformation>();

            for (int i = 0; i < dumpFiles.Length; ++i)
            {
                string dumpFile = dumpFiles[i];
                string analysisProgressMessage = String.Format("Analyzing dump file '{0}' ({1}/{2})", dumpFile, i + 1, dumpFiles.Length);
                _context.WriteInfoLine(analysisProgressMessage);
                Console.Title = analysisProgressMessage;

                _target = new AnalysisTarget(dumpFile, _context);
                TriageInformation triageInformation = new Triage().GetTriageInformation(_context);
                triages.Add(dumpFile, triageInformation);
            }

            _context.WriteLine("{0,-30} {1,-30} {2,-50} {3,-30}", "DUMP", "EVENT", "METHOD", "MEMORY (CMT/RSV/MGD)");
            foreach (var kvp in triages)
            {
                string            dumpFile          = kvp.Key;
                TriageInformation triageInformation = kvp.Value;
                _context.WriteLine("{0,-30} {1,-30} {2,-50} {3,-30}",
                                   dumpFile.TrimStartToLength(30),
                                   triageInformation.GetEventDisplayString().TrimStartToLength(30),
                                   (triageInformation.FaultingMethod ?? "N/A").TrimStartToLength(50),
                                   String.Format("{0}/{1}/{2}",
                                                 triageInformation.CommittedMemoryBytes.ToMemoryUnits(),
                                                 triageInformation.ReservedMemoryBytes.ToMemoryUnits(),
                                                 triageInformation.GCHeapMemoryBytes.ToMemoryUnits()
                                                 )
                                   );
            }

            var groupedByModule = from triage in triages.Values
                                  group triage by triage.FaultingModule into g
                                  let count = g.Count()
                                              select new { Module = g.Key, Count = count };

            _context.WriteLine();
            _context.WriteLine("{0,-30} {1,-12}", "MODULE", "COUNT");
            foreach (var moduleCount in groupedByModule)
            {
                _context.WriteLine("{0,-30} {1,-12}", moduleCount.Module, moduleCount.Count);
            }

            var groupedByEvent = from triage in triages.Values
                                 group triage by triage.GetEventDisplayString() into g
                                 let count = g.Count()
                                             select new { Event = g.Key, Count = count };

            _context.WriteLine();
            _context.WriteLine("{0,-50} {1,-12}", "EVENT", "COUNT");
            foreach (var eventCount in groupedByEvent)
            {
                _context.WriteLine("{0,-50} {1,-12}", eventCount.Event, eventCount.Count);
            }
        }
Esempio n. 2
0
        private void PrintTriageInformation(CommandExecutionContext context, TriageInformation triageInformation)
        {
            context.WriteLine("MODULES  {0} modules loaded", triageInformation.ModuleCount);
            context.WriteLine("THREADS  {0} total threads, {1} managed threads", triageInformation.TotalThreadCount, triageInformation.ManagedThreadCount);
            context.WriteLine("MEMORY   {0} committed, {1} reserved, {2} GC heap",
                              triageInformation.CommittedMemoryBytes.ToMemoryUnits(),
                              triageInformation.ReservedMemoryBytes.ToMemoryUnits(),
                              triageInformation.GCHeapMemoryBytes.ToMemoryUnits());

            context.WriteLine("EVENT    Last event in thread OSID = {0}, managed = {1}",
                              _triageInformation.FaultingThreadOSID, _triageInformation.IsFaultingThreadManaged);
            context.WriteLine("EVENT    {0}", _triageInformation.EventDescription);
            context.WriteLine("EVENT    Exception {0:X8}", _triageInformation.ExceptionCode);
            context.WriteLine("EVENT    Managed exception {0}", _triageInformation.ManagedExceptionType);
            context.WriteLine("EVENT    Faulting module {0}, method {1}", _triageInformation.FaultingModule, _triageInformation.FaultingMethod);
        }
Esempio n. 3
0
        private void PrintTriageInformation(CommandExecutionContext context, TriageInformation triageInformation)
        {
            context.WriteLine("MODULES  {0} modules loaded", triageInformation.ModuleCount);
            context.WriteLine("THREADS  {0} total threads, {1} managed threads", triageInformation.TotalThreadCount, triageInformation.ManagedThreadCount);
            context.WriteLine("MEMORY   {0} committed, {1} reserved, {2} GC heap",
                triageInformation.CommittedMemoryBytes.ToMemoryUnits(),
                triageInformation.ReservedMemoryBytes.ToMemoryUnits(),
                triageInformation.GCHeapMemoryBytes.ToMemoryUnits());

            context.WriteLine("EVENT    Last event in thread OSID = {0}, managed = {1}",
                _triageInformation.FaultingThreadOSID, _triageInformation.IsFaultingThreadManaged);
            context.WriteLine("EVENT    {0}", _triageInformation.EventDescription);
            if (_triageInformation.ExceptionCode != 0)
                context.WriteLine("EVENT    Exception {0:X8}", _triageInformation.ExceptionCode);
            if (!String.IsNullOrEmpty(_triageInformation.ManagedExceptionType))
                context.WriteLine("EVENT    Managed exception {0}", _triageInformation.ManagedExceptionType);
            context.WriteLine("EVENT    Faulting module {0}, method {1}", _triageInformation.FaultingModule, _triageInformation.FaultingMethod);
        }
Esempio n. 4
0
        public void Execute(CommandExecutionContext context)
        {
            TriageInformation triageInformation = GetTriageInformation(context);

            PrintTriageInformation(context, triageInformation);
        }