Exemplo n.º 1
0
        static void Main(string[] argv)
        {
            BlockData.DebugLog = Console.Out;

            if (argv.Length != 1)
            {
                Console.WriteLine("Please specify one input file");
                return;
            }
            SyncLogFileReader    reader = new SyncLogFileReader(argv [0]);
            ProfilerEventHandler data   = new ProfilerEventHandler();

            data.LoadedElements.RecordHeapSnapshots = false;
            while (!reader.HasEnded)
            {
                BlockData currentBlock = null;
                try {
                    currentBlock = reader.ReadBlock();
                    currentBlock.Decode(data, reader);
                } catch (DecodingException e) {
                    Console.WriteLine("Stopping decoding after a DecodingException in block of code {0}, length {1}, file offset {2}, block offset {3}: {4}", e.FailingData.Code, e.FailingData.Length, e.FailingData.FileOffset, e.OffsetInBlock, e.Message);
                    break;
                }
            }

            PrintData(Console.Out, data);
        }
Exemplo n.º 2
0
        public bool LoadProfile(string path)
        {
            this.path = path;
            SyncLogFileReader    rdr  = new SyncLogFileReader(path);
            ProfilerEventHandler data = new ProfilerEventHandler();

            data.LoadedElements.RecordHeapSnapshots = false;
            for (BlockData current = rdr.ReadBlock(); current != null; current = rdr.ReadBlock())
            {
                try
                {
                    current.Decode(data, rdr);
                }
                catch (DecodingException e)
                {
                    Console.Error.WriteLine("Stopping decoding after a DecodingException in block of code {0}, length {1}, file offset {2}, block offset {3}: {4}", e.FailingData.Code, e.FailingData.Length, e.FailingData.FileOffset, e.OffsetInBlock, e.Message);
                    rdr.Close();
                    return(false);
                }
            }
            rdr.Close();
            Gtk.Widget view;
            supports_filtering = false;
            if (data.HasStatisticalData)
            {
                view = new StatView(data, Options);
            }
            else if (data.HasAllocationData)
            {
                view = new AllocationsView(data, Options);
            }
            else
            {
                view = new CallsView(data, Options);
                supports_filtering = true;
            }
            view.ShowAll();
            View = view;
            return(true);
        }