Пример #1
0
			internal ViewState(SortingBehaviour in_sort, SortingBehaviour in_highlight)
			{
				sort = in_sort;
				highlight = in_highlight;

				showCalls = showAllocs = showAssemblies = true;
			}
Пример #2
0
		private void InitForm()
		{
			Controls.Clear();
			if (controlCollection != null)
			{
				controlCollection.Controls.Clear();
			}
			InitializeComponent();
			defaultFont = new Font(new FontFamily("Tahoma"), 8);
			
			DiffTreeListView treeView = new DiffTreeListView(this);
			treeView.Dock = DockStyle.Fill;
			treeView.Font = defaultFont;

			SortingBehaviour sort = new SortingBehaviour();
			SortingBehaviour highlight = new SortingBehaviour();
			sort.sortingOrder = highlight.sortingOrder = -1;
			sort.counterId = -1;
			highlight.counterId = 2;

			/* add columns */
			treeView.AddColumn(new ColumnInformation(-1, "Function name", ColumnInformation.ColumnTypes.Tree), 250);
			foreach(int counter in DiffStatistics.DefaultCounters)
			{
				AddColumn(treeView, counter);
			}

			treeView.ColumnClick += new EventHandler(SortOn);
			
			treeView.TokenObject = new ViewState(sort, highlight);
			treeView.Root = Root;
			
			
			treeView.Size = new System.Drawing.Size(332, 108);
			treeView.Visible = true;
			controlCollection.Controls.Add(treeView);
			SetcallTreeView();
			this.Visible = true;
		}
Пример #3
0
        private void menuItem2_Click(object sender, System.EventArgs e)
        {
            SortAndHighlightSelector s = new SortAndHighlightSelector(viewState.sort, viewState.highlight);
            DialogResult res = s.ShowDialog(this);
            if(res == DialogResult.OK)
            {
                SortingBehaviour ss = new SortingBehaviour();
                SortingBehaviour hh = new SortingBehaviour();
                s.GetSortResults(ss, hh);

                if(ss.sortingOrder != viewState.sort.sortingOrder || ss.counterId != viewState.sort.counterId ||
                    hh.sortingOrder != viewState.highlight.sortingOrder || hh.counterId != viewState.highlight.counterId)
                {
                    viewState.sort = ss;
                    viewState.highlight = hh;
                    callTreeView.Resort();
                }
            }
        }
Пример #4
0
 public void Sort(string[] myArray)
 {
     SortingBehaviour.Sort(myArray);
 }
Пример #5
0
        private void InitForm( bool fFirstTime )
        {
            Controls.Clear();
            if (controlCollection != null)
            {
                controlCollection.Controls.Clear();
            }
            InitializeComponent();
            if(!forCompare)
            {
                /* extract font for the call tree */
                defaultFont = MainForm.instance.font;
                stackView.Font = defaultFont;
                //stackView.HeaderStyle = ColumnHeaderStyle.Nonclickable;
                menuItemShowFuture.Checked = fShowSubtree;

                ResizeForm();
            }

            /* intialize backing store */
            backingStoreFileName = Path.GetTempFileName();
            backingStore = new FileStream(backingStoreFileName, FileMode.Truncate, FileAccess.ReadWrite, FileShare.ReadWrite);
            writer = new BitWriter(backingStore);
            pos = 0;

            threads = new Dictionary<int, ThreadState>();
            globalCallStats = new GlobalCallStats[1 + names.Length];
            globalAllocStats = new GlobalAllocStats[1 + types.Length];

            assemblyNames = new ArrayList();
            assemblyNameToIdMap = new Hashtable();

            /* compute everything about the run */
            if(!BuildTreeAndComputeStats())
            {
                Dispose();
                return;
            }

            backingStore.Position = 0;
            reader = new BitReader(backingStore);

            manyThreads = (threads.Count > 5);

            if(manyThreads)
            {
                threadIDLabel.Location = new System.Drawing.Point(8, 12);
                threadIDLabel.Name = "threadIDLabel";
                threadIDLabel.Size = new System.Drawing.Size(64, 16);
                threadIDLabel.TabIndex = 2;
                threadIDLabel.Text = "Thread ID";

                threadIDList.Location = new System.Drawing.Point(72, 10);
                threadIDList.Name = "threadIDList";
                threadIDList.TabIndex = 0;
                threadIDList.SelectedValueChanged += new EventHandler(threadIDList_SelectedValueChanged);

                Controls.Add(threadIDList);
                Controls.Add(threadIDLabel);
            }
            else
            {
                tabs = new TabControl();
                tabs.Dock = System.Windows.Forms.DockStyle.Left;
                tabs.Font = defaultFont;
                tabs.Size = new System.Drawing.Size(332, 108);
                tabs.TabIndex = 0;
                tabs.SelectedIndexChanged += new EventHandler(TabsSelectedIndexChanged);

                controlCollection.Controls.Add(tabs);
            }

            foreach(int e in threads.Keys)
            {
                TabPage page = new TabPage(e.ToString());
                page.BorderStyle = BorderStyle.None;

                TreeListView treeView = new TreeListView(this);
                treeView.Dock = DockStyle.Fill;
                treeView.Font = defaultFont;

                /* initial sorting and highlighting behaviour:
                    * 1) sort in order of execution,
                    * 2) highlight the one that allocated the most */
                SortingBehaviour sort = new SortingBehaviour();
                SortingBehaviour highlight = new SortingBehaviour();
                sort.sortingOrder = highlight.sortingOrder = -1;
                sort.counterId = -1;
                highlight.counterId = 2;

                /* add columns */
                treeView.AddColumn(new ColumnInformation(-1, "Function name", ColumnInformation.ColumnTypes.Tree), 250);
                foreach(int counter in Statistics.DefaultCounters)
                {
                    AddColumn(treeView, counter);
                }

                treeView.ColumnClick += new EventHandler(SortOn);
                treeView.SelectedIndexChanged += new EventHandler(ShowCurrentStack);

                treeView.TokenObject = new ViewState(sort, highlight);
                treeView.Root = (TreeNode)((ThreadState)threads[e]).stack[0];

                if(manyThreads)
                {
                    threadIDList.Items.Add(e);
                    ((ThreadState)threads[e]).callTreeView = treeView;
                    treeView.Visible = false;
                    treeView.Size = new System.Drawing.Size(332, 108);
                    controlCollection.Controls.Add(treeView);
                }
                else
                {
                    page.Controls.Add(treeView);
                    tabs.Controls.Add(page);
                    if(e == firstThread)
                    {
                        tabs.SelectedTab = null;
                        tabs.SelectedTab = page;
                    }
                }
            }

            if(manyThreads)
            {
                currentThreadId = -1;
                threadIDList.SelectedItem = firstThread;
            }

            CallTreeForm_Resize(null, null);

            if (splitterX != -1)
            {
                splitter.SplitPosition = splitterX;
            }

            previousSplitterLocation = splitter.Location.X;
            if(!forCompare)
            {
                Visible = true;

                // Create a blank context menu for the stackview control.  We'll fill it in when the user right clicks
                ContextMenu contextMenu = new ContextMenu();
                stackView.ContextMenu = contextMenu;
            }
        }