Esempio n. 1
0
		public ProfileDialog (string fileName) : base(Gtk.WindowType.Toplevel)
		{
			this.Build ();
			this.TransientFor = IdeApp.Workbench.RootWindow;
			this.DestroyWithParent = true;
			timeLineWidget = new TimeLineWidget (this);
			scrolledwindow1.AddWithViewport (timeLineWidget);
			scrolledwindow1.ShowAll ();
			
			threadStore = new ListStore (typeof(string), typeof(AnalyseVisitor.ThreadContext));
			comboboxThreads.Model = threadStore;
			comboboxThreads.Changed += HandleComboboxThreadsChanged;
			store = new TreeStore (typeof(string), // name
				typeof(string), // icon
				typeof(ulong), // call count
				typeof(double), // time with children %
				typeof(double), // time self (ms)
				typeof(double), // total time (ms)
				typeof(AnalyseVisitor.MethodInfo) // method info
			);
			profileResultsView.Model = store;
			
			var methodColumn = new TreeViewColumn ();
			methodColumn.SortColumnId = 0;
			methodColumn.SortIndicator = true;
			methodColumn.Title = "Method";
			methodColumn.Resizable = true;
			
			var textRender = new CellRendererText ();
			methodColumn.PackStart (textRender, true);
			methodColumn.AddAttribute (textRender, "text", 0);
			profileResultsView.AppendColumn (methodColumn);
			
			var timeSelfColumn = new TreeViewColumn ();
			timeSelfColumn.SortColumnId = TimeSelfColumn;
			timeSelfColumn.SortIndicator = true;
			timeSelfColumn.Title = "Time self (ms)";
			timeSelfColumn.Resizable = true;
			timeSelfColumn.PackStart (textRender, true);
			timeSelfColumn.SetCellDataFunc (textRender, delegate (Gtk.TreeViewColumn column, Gtk.CellRenderer cell,Gtk.TreeModel model, Gtk.TreeIter iter) {
				double time = (double)model.GetValue (iter, TimeSelfColumn);
				((CellRendererText)cell).Text = string.Format ("{0:0.0}", time);
			});
			profileResultsView.AppendColumn (timeSelfColumn);
			
			var totalTimeColumn = new TreeViewColumn ();
			totalTimeColumn.SortColumnId = TimeSelfColumn;
			totalTimeColumn.SortIndicator = true;
			totalTimeColumn.Title = "Total time (ms)";
			totalTimeColumn.Resizable = true;
			totalTimeColumn.PackStart (textRender, true);
			totalTimeColumn.SetCellDataFunc (textRender, delegate (Gtk.TreeViewColumn column, Gtk.CellRenderer cell,Gtk.TreeModel model, Gtk.TreeIter iter) {
				double time = (double)model.GetValue (iter, TotalTimeColumn);
				((CellRendererText)cell).Text = string.Format ("{0:0.0}", time);
			});
			profileResultsView.AppendColumn (totalTimeColumn);
			
			var timeWithChidrenColumn = new TreeViewColumn ();
			timeWithChidrenColumn.SortColumnId = 3;
			timeWithChidrenColumn.SortIndicator = true;
			timeWithChidrenColumn.Title = "Time from parent (%)";
			timeWithChidrenColumn.Resizable = true;
			var timeCellRenderer = new TimeCellRenderer ();
			timeWithChidrenColumn.PackStart (timeCellRenderer, true);
			timeWithChidrenColumn.AddAttribute (timeCellRenderer, "time", 3);
			profileResultsView.AppendColumn (timeWithChidrenColumn);
			
			var callCountColumn = new TreeViewColumn ();
			callCountColumn.SortIndicator = true;
			callCountColumn.SortColumnId = 2;
			callCountColumn.Resizable = true;
			callCountColumn.Title = "Call count";
			callCountColumn.PackStart (textRender, true);
			callCountColumn.SetCellDataFunc (textRender, delegate (Gtk.TreeViewColumn column, Gtk.CellRenderer cell,Gtk.TreeModel model, Gtk.TreeIter iter) {
				ulong callCount = (ulong)model.GetValue (iter, 2);
				((CellRendererText)cell).Text = callCount.ToString ();
			});
			
			profileResultsView.AppendColumn (callCountColumn);
			profileResultsView.TestExpandRow += HandleProfileResultsViewTestExpandRow;
			profileResultsView.ShowExpanders = true;
			buffer = new LogBuffer (fileName, visitor);

			buffer.Updated += delegate {
				Application.Invoke (delegate {
					AnalyzeBuffer ();
				});
			};
			AnalyzeBuffer ();
		}
Esempio n. 2
0
        public ProfileDialog(string fileName) : base(Gtk.WindowType.Toplevel)
        {
            this.Build();
            this.TransientFor      = IdeApp.Workbench.RootWindow;
            this.DestroyWithParent = true;
            timeLineWidget         = new TimeLineWidget(this);
            scrolledwindow1.AddWithViewport(timeLineWidget);
            scrolledwindow1.ShowAll();

            threadStore              = new ListStore(typeof(string), typeof(AnalyseVisitor.ThreadContext));
            comboboxThreads.Model    = threadStore;
            comboboxThreads.Changed += HandleComboboxThreadsChanged;
            store = new TreeStore(typeof(string),                   // name
                                  typeof(string),                   // icon
                                  typeof(ulong),                    // call count
                                  typeof(double),                   // time with children %
                                  typeof(double),                   // time self (ms)
                                  typeof(double),                   // total time (ms)
                                  typeof(AnalyseVisitor.MethodInfo) // method info
                                  );
            profileResultsView.Model = store;

            var methodColumn = new TreeViewColumn();

            methodColumn.SortColumnId  = 0;
            methodColumn.SortIndicator = true;
            methodColumn.Title         = "Method";
            methodColumn.Resizable     = true;

            var textRender = new CellRendererText();

            methodColumn.PackStart(textRender, true);
            methodColumn.AddAttribute(textRender, "text", 0);
            profileResultsView.AppendColumn(methodColumn);

            var timeSelfColumn = new TreeViewColumn();

            timeSelfColumn.SortColumnId  = TimeSelfColumn;
            timeSelfColumn.SortIndicator = true;
            timeSelfColumn.Title         = "Time self (ms)";
            timeSelfColumn.Resizable     = true;
            timeSelfColumn.PackStart(textRender, true);
            timeSelfColumn.SetCellDataFunc(textRender, delegate(Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter) {
                double time = (double)model.GetValue(iter, TimeSelfColumn);
                ((CellRendererText)cell).Text = string.Format("{0:0.0}", time);
            });
            profileResultsView.AppendColumn(timeSelfColumn);

            var totalTimeColumn = new TreeViewColumn();

            totalTimeColumn.SortColumnId  = TimeSelfColumn;
            totalTimeColumn.SortIndicator = true;
            totalTimeColumn.Title         = "Total time (ms)";
            totalTimeColumn.Resizable     = true;
            totalTimeColumn.PackStart(textRender, true);
            totalTimeColumn.SetCellDataFunc(textRender, delegate(Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter) {
                double time = (double)model.GetValue(iter, TotalTimeColumn);
                ((CellRendererText)cell).Text = string.Format("{0:0.0}", time);
            });
            profileResultsView.AppendColumn(totalTimeColumn);

            var timeWithChidrenColumn = new TreeViewColumn();

            timeWithChidrenColumn.SortColumnId  = 3;
            timeWithChidrenColumn.SortIndicator = true;
            timeWithChidrenColumn.Title         = "Time from parent (%)";
            timeWithChidrenColumn.Resizable     = true;
            var timeCellRenderer = new TimeCellRenderer();

            timeWithChidrenColumn.PackStart(timeCellRenderer, true);
            timeWithChidrenColumn.AddAttribute(timeCellRenderer, "time", 3);
            profileResultsView.AppendColumn(timeWithChidrenColumn);

            var callCountColumn = new TreeViewColumn();

            callCountColumn.SortIndicator = true;
            callCountColumn.SortColumnId  = 2;
            callCountColumn.Resizable     = true;
            callCountColumn.Title         = "Call count";
            callCountColumn.PackStart(textRender, true);
            callCountColumn.SetCellDataFunc(textRender, delegate(Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter) {
                ulong callCount = (ulong)model.GetValue(iter, 2);
                ((CellRendererText)cell).Text = callCount.ToString();
            });

            profileResultsView.AppendColumn(callCountColumn);
            profileResultsView.TestExpandRow += HandleProfileResultsViewTestExpandRow;
            profileResultsView.ShowExpanders  = true;
            buffer = new LogBuffer(fileName, visitor);

            buffer.Updated += delegate {
                Application.Invoke(delegate {
                    AnalyzeBuffer();
                });
            };
            AnalyzeBuffer();
        }