Exemplo n.º 1
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;
		}
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);
        }