diff --git a/trunk/ProcessHacker/Components/ProcessTree/ProcessNode.cs b/trunk/ProcessHacker/Components/ProcessTree/ProcessNode.cs index cbf434482..55c924166 100644 --- a/trunk/ProcessHacker/Components/ProcessTree/ProcessNode.cs +++ b/trunk/ProcessHacker/Components/ProcessTree/ProcessNode.cs @@ -144,6 +144,36 @@ namespace ProcessHacker get { return Misc.GetNiceSizeName(_pitem.Process.VirtualMemoryCounters.WorkingSetSize); } } + public string PeakWorkingSet + { + get { return Misc.GetNiceSizeName(_pitem.Process.VirtualMemoryCounters.PeakWorkingSetSize); } + } + + public string VirtualSize + { + get { return Misc.GetNiceSizeName(_pitem.Process.VirtualMemoryCounters.VirtualSize); } + } + + public string PeakVirtualSize + { + get { return Misc.GetNiceSizeName(_pitem.Process.VirtualMemoryCounters.PeakVirtualSize); } + } + + public string PagefileUsage + { + get { return Misc.GetNiceSizeName(_pitem.Process.VirtualMemoryCounters.PagefileUsage); } + } + + public string PeakPagefileUsage + { + get { return Misc.GetNiceSizeName(_pitem.Process.VirtualMemoryCounters.PeakPagefileUsage); } + } + + public string PageFaults + { + get { return _pitem.Process.VirtualMemoryCounters.PageFaultCount.ToString("N0"); } + } + public string CPU { get @@ -189,6 +219,17 @@ namespace ProcessHacker } } + public string BasePriority + { + get + { + if (PID < 4) + return ""; + else + return Misc.GetStringPriority(_pitem.Process.BasePriority); + } + } + public string Description { get @@ -239,6 +280,96 @@ namespace ProcessHacker } } + public string Threads + { + get + { + if (PID < 4) + return ""; + else + return _pitem.Process.NumberOfThreads.ToString(); + } + } + + public string Handles + { + get + { + if (PID < 4) + return ""; + else + return _pitem.Process.HandleCount.ToString(); + } + } + + public int GdiHandlesNumber + { + get + { + try + { + using (var phandle = new Win32.ProcessHandle(PID, Win32.PROCESS_RIGHTS.PROCESS_QUERY_INFORMATION)) + return phandle.GetGuiResources(false); + } + catch + { + return 0; + } + } + } + + public string GdiHandles + { + get + { + if (PID < 4) + return ""; + else + { + int number = this.GdiHandlesNumber; + + if (number == 0) + return ""; + else + return number.ToString(); + } + } + } + + public int UserHandlesNumber + { + get + { + try + { + using (var phandle = new Win32.ProcessHandle(PID, Win32.PROCESS_RIGHTS.PROCESS_QUERY_INFORMATION)) + return phandle.GetGuiResources(true); + } + catch + { + return 0; + } + } + } + + public string UserHandles + { + get + { + if (PID < 4) + return ""; + else + { + int number = this.UserHandlesNumber; + + if (number == 0) + return ""; + else + return number.ToString(); + } + } + } + public Bitmap Icon { get { return _icon; } diff --git a/trunk/ProcessHacker/Components/ProcessTree/ProcessTree.Designer.cs b/trunk/ProcessHacker/Components/ProcessTree/ProcessTree.Designer.cs index cbd30968e..af0cf4ac4 100644 --- a/trunk/ProcessHacker/Components/ProcessTree/ProcessTree.Designer.cs +++ b/trunk/ProcessHacker/Components/ProcessTree/ProcessTree.Designer.cs @@ -35,10 +35,15 @@ this.columnWorkingSet = new Aga.Controls.Tree.TreeColumn(); this.columnCPU = new Aga.Controls.Tree.TreeColumn(); this.columnUsername = new Aga.Controls.Tree.TreeColumn(); + this.columnSessionId = new Aga.Controls.Tree.TreeColumn(); this.columnDescription = new Aga.Controls.Tree.TreeColumn(); this.columnCompany = new Aga.Controls.Tree.TreeColumn(); this.columnFileName = new Aga.Controls.Tree.TreeColumn(); this.columnCommandLine = new Aga.Controls.Tree.TreeColumn(); + this.columnThreads = new Aga.Controls.Tree.TreeColumn(); + this.columnHandles = new Aga.Controls.Tree.TreeColumn(); + this.columnGdiHandles = new Aga.Controls.Tree.TreeColumn(); + this.columnUserHandles = new Aga.Controls.Tree.TreeColumn(); this.nodeIcon = new Aga.Controls.Tree.NodeControls.NodeIcon(); this.nodeName = new Aga.Controls.Tree.NodeControls.NodeTextBox(); this.nodePID = new Aga.Controls.Tree.NodeControls.NodeIntegerTextBox(); @@ -46,12 +51,29 @@ this.nodeWorkingSet = new Aga.Controls.Tree.NodeControls.NodeTextBox(); this.nodeCPU = new Aga.Controls.Tree.NodeControls.NodeTextBox(); this.nodeUsername = new Aga.Controls.Tree.NodeControls.NodeTextBox(); + this.nodeSessionId = new Aga.Controls.Tree.NodeControls.NodeTextBox(); this.nodeDescription = new Aga.Controls.Tree.NodeControls.NodeTextBox(); this.nodeCompany = new Aga.Controls.Tree.NodeControls.NodeTextBox(); this.nodeFileName = new Aga.Controls.Tree.NodeControls.NodeTextBox(); this.nodeCommandLine = new Aga.Controls.Tree.NodeControls.NodeTextBox(); - this.columnSessionId = new Aga.Controls.Tree.TreeColumn(); - this.nodeSessionId = new Aga.Controls.Tree.NodeControls.NodeTextBox(); + this.nodeThreads = new Aga.Controls.Tree.NodeControls.NodeTextBox(); + this.nodeHandles = new Aga.Controls.Tree.NodeControls.NodeTextBox(); + this.nodeGdiHandles = new Aga.Controls.Tree.NodeControls.NodeTextBox(); + this.nodeUserHandles = new Aga.Controls.Tree.NodeControls.NodeTextBox(); + this.columnBasePriority = new Aga.Controls.Tree.TreeColumn(); + this.nodeBasePriority = new Aga.Controls.Tree.NodeControls.NodeTextBox(); + this.columnVirtualSize = new Aga.Controls.Tree.TreeColumn(); + this.columnPeakVirtualSize = new Aga.Controls.Tree.TreeColumn(); + this.columnPeakWorkingSet = new Aga.Controls.Tree.TreeColumn(); + this.columnPageFaults = new Aga.Controls.Tree.TreeColumn(); + this.columnPagefileUsage = new Aga.Controls.Tree.TreeColumn(); + this.columnPeakPagefileUsage = new Aga.Controls.Tree.TreeColumn(); + this.nodePeakWorkingSet = new Aga.Controls.Tree.NodeControls.NodeTextBox(); + this.nodeVirtualSize = new Aga.Controls.Tree.NodeControls.NodeTextBox(); + this.nodePeakVirtualSize = new Aga.Controls.Tree.NodeControls.NodeTextBox(); + this.nodePagefileUsage = new Aga.Controls.Tree.NodeControls.NodeTextBox(); + this.nodePeakPagefileUsage = new Aga.Controls.Tree.NodeControls.NodeTextBox(); + this.nodePageFaults = new Aga.Controls.Tree.NodeControls.NodeTextBox(); this.SuspendLayout(); // // treeProcesses @@ -62,13 +84,24 @@ this.treeProcesses.Columns.Add(this.columnPID); this.treeProcesses.Columns.Add(this.columnPvtMemory); this.treeProcesses.Columns.Add(this.columnWorkingSet); + this.treeProcesses.Columns.Add(this.columnPeakWorkingSet); + this.treeProcesses.Columns.Add(this.columnVirtualSize); + this.treeProcesses.Columns.Add(this.columnPeakVirtualSize); + this.treeProcesses.Columns.Add(this.columnPagefileUsage); + this.treeProcesses.Columns.Add(this.columnPeakPagefileUsage); + this.treeProcesses.Columns.Add(this.columnPageFaults); this.treeProcesses.Columns.Add(this.columnCPU); this.treeProcesses.Columns.Add(this.columnUsername); this.treeProcesses.Columns.Add(this.columnSessionId); + this.treeProcesses.Columns.Add(this.columnBasePriority); this.treeProcesses.Columns.Add(this.columnDescription); this.treeProcesses.Columns.Add(this.columnCompany); this.treeProcesses.Columns.Add(this.columnFileName); this.treeProcesses.Columns.Add(this.columnCommandLine); + this.treeProcesses.Columns.Add(this.columnThreads); + this.treeProcesses.Columns.Add(this.columnHandles); + this.treeProcesses.Columns.Add(this.columnGdiHandles); + this.treeProcesses.Columns.Add(this.columnUserHandles); this.treeProcesses.DefaultToolTipProvider = null; this.treeProcesses.DisplayDraggingNodes = true; this.treeProcesses.Dock = System.Windows.Forms.DockStyle.Fill; @@ -84,13 +117,24 @@ this.treeProcesses.NodeControls.Add(this.nodePID); this.treeProcesses.NodeControls.Add(this.nodePvtMemory); this.treeProcesses.NodeControls.Add(this.nodeWorkingSet); + this.treeProcesses.NodeControls.Add(this.nodePeakWorkingSet); + this.treeProcesses.NodeControls.Add(this.nodeVirtualSize); + this.treeProcesses.NodeControls.Add(this.nodePeakVirtualSize); + this.treeProcesses.NodeControls.Add(this.nodePagefileUsage); + this.treeProcesses.NodeControls.Add(this.nodePeakPagefileUsage); + this.treeProcesses.NodeControls.Add(this.nodePageFaults); this.treeProcesses.NodeControls.Add(this.nodeCPU); this.treeProcesses.NodeControls.Add(this.nodeUsername); this.treeProcesses.NodeControls.Add(this.nodeSessionId); + this.treeProcesses.NodeControls.Add(this.nodeBasePriority); this.treeProcesses.NodeControls.Add(this.nodeDescription); this.treeProcesses.NodeControls.Add(this.nodeCompany); this.treeProcesses.NodeControls.Add(this.nodeFileName); this.treeProcesses.NodeControls.Add(this.nodeCommandLine); + this.treeProcesses.NodeControls.Add(this.nodeThreads); + this.treeProcesses.NodeControls.Add(this.nodeHandles); + this.treeProcesses.NodeControls.Add(this.nodeGdiHandles); + this.treeProcesses.NodeControls.Add(this.nodeUserHandles); this.treeProcesses.SelectedNode = null; this.treeProcesses.SelectionMode = Aga.Controls.Tree.TreeSelectionMode.Multi; this.treeProcesses.ShowNodeToolTips = true; @@ -152,6 +196,16 @@ this.columnUsername.TooltipText = null; this.columnUsername.Width = 130; // + // columnSessionId + // + this.columnSessionId.Header = "Session ID"; + this.columnSessionId.IsVisible = false; + this.columnSessionId.Sortable = true; + this.columnSessionId.SortOrder = System.Windows.Forms.SortOrder.None; + this.columnSessionId.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; + this.columnSessionId.TooltipText = null; + this.columnSessionId.Width = 20; + // // columnDescription // this.columnDescription.Header = "Description"; @@ -181,11 +235,50 @@ // columnCommandLine // this.columnCommandLine.Header = "Command Line"; + this.columnCommandLine.IsVisible = false; this.columnCommandLine.Sortable = true; this.columnCommandLine.SortOrder = System.Windows.Forms.SortOrder.None; this.columnCommandLine.TooltipText = null; this.columnCommandLine.Width = 200; // + // columnThreads + // + this.columnThreads.Header = "Threads"; + this.columnThreads.IsVisible = false; + this.columnThreads.Sortable = true; + this.columnThreads.SortOrder = System.Windows.Forms.SortOrder.None; + this.columnThreads.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; + this.columnThreads.TooltipText = null; + this.columnThreads.Width = 35; + // + // columnHandles + // + this.columnHandles.Header = "Handles"; + this.columnHandles.IsVisible = false; + this.columnHandles.Sortable = true; + this.columnHandles.SortOrder = System.Windows.Forms.SortOrder.None; + this.columnHandles.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; + this.columnHandles.TooltipText = null; + this.columnHandles.Width = 35; + // + // columnGdiHandles + // + this.columnGdiHandles.Header = "GDI Handles"; + this.columnGdiHandles.IsVisible = false; + this.columnGdiHandles.SortOrder = System.Windows.Forms.SortOrder.None; + this.columnGdiHandles.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; + this.columnGdiHandles.TooltipText = null; + this.columnGdiHandles.Width = 35; + // + // columnUserHandles + // + this.columnUserHandles.Header = "USER Handles"; + this.columnUserHandles.IsVisible = false; + this.columnUserHandles.SortOrder = System.Windows.Forms.SortOrder.None; + this.columnUserHandles.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; + this.columnUserHandles.TooltipText = null; + this.columnUserHandles.Width = 35; + // // nodeIcon // this.nodeIcon.DataPropertyName = "Icon"; @@ -250,6 +343,16 @@ this.nodeUsername.ParentColumn = this.columnUsername; this.nodeUsername.Trimming = System.Drawing.StringTrimming.EllipsisCharacter; // + // nodeSessionId + // + this.nodeSessionId.DataPropertyName = "SessionId"; + this.nodeSessionId.EditEnabled = false; + this.nodeSessionId.IncrementalSearchEnabled = true; + this.nodeSessionId.LeftMargin = 3; + this.nodeSessionId.ParentColumn = this.columnSessionId; + this.nodeSessionId.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; + this.nodeSessionId.Trimming = System.Drawing.StringTrimming.EllipsisCharacter; + // // nodeDescription // this.nodeDescription.DataPropertyName = "Description"; @@ -286,24 +389,183 @@ this.nodeCommandLine.ParentColumn = this.columnCommandLine; this.nodeCommandLine.Trimming = System.Drawing.StringTrimming.EllipsisCharacter; // - // columnSessionId + // nodeThreads // - this.columnSessionId.Header = "Session ID"; - this.columnSessionId.IsVisible = false; - this.columnSessionId.Sortable = true; - this.columnSessionId.SortOrder = System.Windows.Forms.SortOrder.None; - this.columnSessionId.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; - this.columnSessionId.TooltipText = null; + this.nodeThreads.DataPropertyName = "Threads"; + this.nodeThreads.EditEnabled = false; + this.nodeThreads.IncrementalSearchEnabled = true; + this.nodeThreads.LeftMargin = 3; + this.nodeThreads.ParentColumn = this.columnThreads; + this.nodeThreads.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; + this.nodeThreads.Trimming = System.Drawing.StringTrimming.EllipsisCharacter; // - // nodeSessionId + // nodeHandles // - this.nodeSessionId.DataPropertyName = "SessionId"; - this.nodeSessionId.EditEnabled = false; - this.nodeSessionId.IncrementalSearchEnabled = true; - this.nodeSessionId.LeftMargin = 3; - this.nodeSessionId.ParentColumn = this.columnSessionId; - this.nodeSessionId.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; - this.nodeSessionId.Trimming = System.Drawing.StringTrimming.EllipsisCharacter; + this.nodeHandles.DataPropertyName = "Handles"; + this.nodeHandles.EditEnabled = false; + this.nodeHandles.IncrementalSearchEnabled = true; + this.nodeHandles.LeftMargin = 3; + this.nodeHandles.ParentColumn = this.columnHandles; + this.nodeHandles.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; + this.nodeHandles.Trimming = System.Drawing.StringTrimming.EllipsisCharacter; + // + // nodeGdiHandles + // + this.nodeGdiHandles.DataPropertyName = "GdiHandles"; + this.nodeGdiHandles.EditEnabled = false; + this.nodeGdiHandles.IncrementalSearchEnabled = true; + this.nodeGdiHandles.LeftMargin = 3; + this.nodeGdiHandles.ParentColumn = this.columnGdiHandles; + this.nodeGdiHandles.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; + this.nodeGdiHandles.Trimming = System.Drawing.StringTrimming.EllipsisCharacter; + // + // nodeUserHandles + // + this.nodeUserHandles.DataPropertyName = "UserHandles"; + this.nodeUserHandles.EditEnabled = false; + this.nodeUserHandles.IncrementalSearchEnabled = true; + this.nodeUserHandles.LeftMargin = 3; + this.nodeUserHandles.ParentColumn = this.columnUserHandles; + this.nodeUserHandles.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; + this.nodeUserHandles.Trimming = System.Drawing.StringTrimming.EllipsisCharacter; + // + // columnBasePriority + // + this.columnBasePriority.Header = "Base Priority"; + this.columnBasePriority.IsVisible = false; + this.columnBasePriority.Sortable = true; + this.columnBasePriority.SortOrder = System.Windows.Forms.SortOrder.None; + this.columnBasePriority.TooltipText = null; + this.columnBasePriority.Width = 70; + // + // nodeBasePriority + // + this.nodeBasePriority.DataPropertyName = "BasePriority"; + this.nodeBasePriority.EditEnabled = false; + this.nodeBasePriority.IncrementalSearchEnabled = true; + this.nodeBasePriority.LeftMargin = 3; + this.nodeBasePriority.ParentColumn = this.columnBasePriority; + this.nodeBasePriority.Trimming = System.Drawing.StringTrimming.EllipsisCharacter; + // + // columnVirtualSize + // + this.columnVirtualSize.Header = "Virtual Size"; + this.columnVirtualSize.IsVisible = false; + this.columnVirtualSize.Sortable = true; + this.columnVirtualSize.SortOrder = System.Windows.Forms.SortOrder.None; + this.columnVirtualSize.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; + this.columnVirtualSize.TooltipText = null; + this.columnVirtualSize.Width = 70; + // + // columnPeakVirtualSize + // + this.columnPeakVirtualSize.Header = "Peak Virtual Size"; + this.columnPeakVirtualSize.IsVisible = false; + this.columnPeakVirtualSize.Sortable = true; + this.columnPeakVirtualSize.SortOrder = System.Windows.Forms.SortOrder.None; + this.columnPeakVirtualSize.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; + this.columnPeakVirtualSize.TooltipText = null; + this.columnPeakVirtualSize.Width = 70; + // + // columnPeakWorkingSet + // + this.columnPeakWorkingSet.Header = "Peak Working Set"; + this.columnPeakWorkingSet.IsVisible = false; + this.columnPeakWorkingSet.Sortable = true; + this.columnPeakWorkingSet.SortOrder = System.Windows.Forms.SortOrder.None; + this.columnPeakWorkingSet.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; + this.columnPeakWorkingSet.TooltipText = null; + this.columnPeakWorkingSet.Width = 70; + // + // columnPageFaults + // + this.columnPageFaults.Header = "Page Faults"; + this.columnPageFaults.IsVisible = false; + this.columnPageFaults.Sortable = true; + this.columnPageFaults.SortOrder = System.Windows.Forms.SortOrder.None; + this.columnPageFaults.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; + this.columnPageFaults.TooltipText = null; + this.columnPageFaults.Width = 60; + // + // columnPagefileUsage + // + this.columnPagefileUsage.Header = "Pagefile Usage"; + this.columnPagefileUsage.IsVisible = false; + this.columnPagefileUsage.Sortable = true; + this.columnPagefileUsage.SortOrder = System.Windows.Forms.SortOrder.None; + this.columnPagefileUsage.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; + this.columnPagefileUsage.TooltipText = null; + this.columnPagefileUsage.Width = 70; + // + // columnPeakPagefileUsage + // + this.columnPeakPagefileUsage.Header = "Peak Pagefile Usage"; + this.columnPeakPagefileUsage.IsVisible = false; + this.columnPeakPagefileUsage.Sortable = true; + this.columnPeakPagefileUsage.SortOrder = System.Windows.Forms.SortOrder.None; + this.columnPeakPagefileUsage.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; + this.columnPeakPagefileUsage.TooltipText = null; + this.columnPeakPagefileUsage.Width = 70; + // + // nodePeakWorkingSet + // + this.nodePeakWorkingSet.DataPropertyName = "PeakWorkingSet"; + this.nodePeakWorkingSet.EditEnabled = false; + this.nodePeakWorkingSet.IncrementalSearchEnabled = true; + this.nodePeakWorkingSet.LeftMargin = 3; + this.nodePeakWorkingSet.ParentColumn = this.columnPeakWorkingSet; + this.nodePeakWorkingSet.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; + this.nodePeakWorkingSet.Trimming = System.Drawing.StringTrimming.EllipsisCharacter; + // + // nodeVirtualSize + // + this.nodeVirtualSize.DataPropertyName = "VirtualSize"; + this.nodeVirtualSize.EditEnabled = false; + this.nodeVirtualSize.IncrementalSearchEnabled = true; + this.nodeVirtualSize.LeftMargin = 3; + this.nodeVirtualSize.ParentColumn = this.columnVirtualSize; + this.nodeVirtualSize.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; + this.nodeVirtualSize.Trimming = System.Drawing.StringTrimming.EllipsisCharacter; + // + // nodePeakVirtualSize + // + this.nodePeakVirtualSize.DataPropertyName = "PeakVirtualSize"; + this.nodePeakVirtualSize.EditEnabled = false; + this.nodePeakVirtualSize.IncrementalSearchEnabled = true; + this.nodePeakVirtualSize.LeftMargin = 3; + this.nodePeakVirtualSize.ParentColumn = this.columnPeakVirtualSize; + this.nodePeakVirtualSize.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; + this.nodePeakVirtualSize.Trimming = System.Drawing.StringTrimming.EllipsisCharacter; + // + // nodePagefileUsage + // + this.nodePagefileUsage.DataPropertyName = "PagefileUsage"; + this.nodePagefileUsage.EditEnabled = false; + this.nodePagefileUsage.IncrementalSearchEnabled = true; + this.nodePagefileUsage.LeftMargin = 3; + this.nodePagefileUsage.ParentColumn = this.columnPagefileUsage; + this.nodePagefileUsage.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; + this.nodePagefileUsage.Trimming = System.Drawing.StringTrimming.EllipsisCharacter; + // + // nodePeakPagefileUsage + // + this.nodePeakPagefileUsage.DataPropertyName = "PeakPagefileUsage"; + this.nodePeakPagefileUsage.EditEnabled = false; + this.nodePeakPagefileUsage.IncrementalSearchEnabled = true; + this.nodePeakPagefileUsage.LeftMargin = 3; + this.nodePeakPagefileUsage.ParentColumn = this.columnPeakPagefileUsage; + this.nodePeakPagefileUsage.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; + this.nodePeakPagefileUsage.Trimming = System.Drawing.StringTrimming.EllipsisCharacter; + // + // nodePageFaults + // + this.nodePageFaults.DataPropertyName = "PageFaults"; + this.nodePageFaults.EditEnabled = false; + this.nodePageFaults.IncrementalSearchEnabled = true; + this.nodePageFaults.LeftMargin = 3; + this.nodePageFaults.ParentColumn = this.columnPageFaults; + this.nodePageFaults.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; + this.nodePageFaults.Trimming = System.Drawing.StringTrimming.EllipsisCharacter; // // ProcessTree // @@ -343,5 +605,27 @@ private Aga.Controls.Tree.NodeControls.NodeTextBox nodeCommandLine; private Aga.Controls.Tree.TreeColumn columnSessionId; private Aga.Controls.Tree.NodeControls.NodeTextBox nodeSessionId; + private Aga.Controls.Tree.TreeColumn columnThreads; + private Aga.Controls.Tree.TreeColumn columnHandles; + private Aga.Controls.Tree.TreeColumn columnGdiHandles; + private Aga.Controls.Tree.TreeColumn columnUserHandles; + private Aga.Controls.Tree.NodeControls.NodeTextBox nodeThreads; + private Aga.Controls.Tree.NodeControls.NodeTextBox nodeHandles; + private Aga.Controls.Tree.NodeControls.NodeTextBox nodeGdiHandles; + private Aga.Controls.Tree.NodeControls.NodeTextBox nodeUserHandles; + private Aga.Controls.Tree.TreeColumn columnBasePriority; + private Aga.Controls.Tree.NodeControls.NodeTextBox nodeBasePriority; + private Aga.Controls.Tree.TreeColumn columnVirtualSize; + private Aga.Controls.Tree.TreeColumn columnPeakVirtualSize; + private Aga.Controls.Tree.TreeColumn columnPeakWorkingSet; + private Aga.Controls.Tree.TreeColumn columnPageFaults; + private Aga.Controls.Tree.TreeColumn columnPagefileUsage; + private Aga.Controls.Tree.TreeColumn columnPeakPagefileUsage; + private Aga.Controls.Tree.NodeControls.NodeTextBox nodePeakWorkingSet; + private Aga.Controls.Tree.NodeControls.NodeTextBox nodeVirtualSize; + private Aga.Controls.Tree.NodeControls.NodeTextBox nodePeakVirtualSize; + private Aga.Controls.Tree.NodeControls.NodeTextBox nodePagefileUsage; + private Aga.Controls.Tree.NodeControls.NodeTextBox nodePeakPagefileUsage; + private Aga.Controls.Tree.NodeControls.NodeTextBox nodePageFaults; } } diff --git a/trunk/ProcessHacker/Components/ProcessTree/ProcessTree.cs b/trunk/ProcessHacker/Components/ProcessTree/ProcessTree.cs index 00e41792c..3d826d034 100644 --- a/trunk/ProcessHacker/Components/ProcessTree/ProcessTree.cs +++ b/trunk/ProcessHacker/Components/ProcessTree/ProcessTree.cs @@ -37,6 +37,7 @@ namespace ProcessHacker public new event MouseEventHandler MouseUp; public new event EventHandler DoubleClick; public event EventHandler SelectionChanged; + private bool _draw = true; private bool _needsRestructure = false; public ProcessTree() @@ -115,6 +116,12 @@ namespace ProcessHacker } } + public bool Draw + { + get { return _draw; } + set { _draw = value; } + } + public override ContextMenu ContextMenu { get { return treeProcesses.ContextMenu; } @@ -173,16 +180,19 @@ namespace ProcessHacker private void provider_Updated() { - this.BeginInvoke(new MethodInvoker(delegate + if (_draw) { - if (_needsRestructure) + this.BeginInvoke(new MethodInvoker(delegate { - _needsRestructure = false; - _treeModel.CallStructureChanged(new TreePathEventArgs(new TreePath())); - } + if (_needsRestructure) + { + _needsRestructure = false; + _treeModel.CallStructureChanged(new TreePathEventArgs(new TreePath())); + } - treeProcesses.Invalidate(); - })); + treeProcesses.Invalidate(); + })); + } } private void PerformDelayed(int delay, MethodInvoker action) diff --git a/trunk/ProcessHacker/Components/ProcessTree/ProcessTreeModel.cs b/trunk/ProcessHacker/Components/ProcessTree/ProcessTreeModel.cs index b45fd093f..6e37c4bec 100644 --- a/trunk/ProcessHacker/Components/ProcessTree/ProcessTreeModel.cs +++ b/trunk/ProcessHacker/Components/ProcessTree/ProcessTreeModel.cs @@ -216,12 +216,33 @@ namespace ProcessHacker else if (sortC == "working set") return ModifySort(n1.ProcessItem.Process.VirtualMemoryCounters.WorkingSetSize.CompareTo( n2.ProcessItem.Process.VirtualMemoryCounters.WorkingSetSize), sortO); + else if (sortC == "peak working set") + return ModifySort(n1.ProcessItem.Process.VirtualMemoryCounters.PeakWorkingSetSize.CompareTo( + n2.ProcessItem.Process.VirtualMemoryCounters.PeakWorkingSetSize), sortO); + else if (sortC == "virtual size") + return ModifySort(n1.ProcessItem.Process.VirtualMemoryCounters.VirtualSize.CompareTo( + n2.ProcessItem.Process.VirtualMemoryCounters.VirtualSize), sortO); + else if (sortC == "peak virtual size") + return ModifySort(n1.ProcessItem.Process.VirtualMemoryCounters.PeakVirtualSize.CompareTo( + n2.ProcessItem.Process.VirtualMemoryCounters.PeakVirtualSize), sortO); + else if (sortC == "pagefile usage") + return ModifySort(n1.ProcessItem.Process.VirtualMemoryCounters.PagefileUsage.CompareTo( + n2.ProcessItem.Process.VirtualMemoryCounters.PagefileUsage), sortO); + else if (sortC == "peak pagefile usage") + return ModifySort(n1.ProcessItem.Process.VirtualMemoryCounters.PeakPagefileUsage.CompareTo( + n2.ProcessItem.Process.VirtualMemoryCounters.PeakPagefileUsage), sortO); + else if (sortC == "page faults") + return ModifySort(n1.ProcessItem.Process.VirtualMemoryCounters.PageFaultCount.CompareTo( + n2.ProcessItem.Process.VirtualMemoryCounters.PageFaultCount), sortO); else if (sortC == "cpu") return ModifySort(n1.ProcessItem.CPUUsage.CompareTo(n2.ProcessItem.CPUUsage), sortO); else if (sortC == "username") return ModifySort(n1.Username.CompareTo(n2.Username), sortO); else if (sortC == "session id") return ModifySort(n1.ProcessItem.SessionId.CompareTo(n2.ProcessItem.SessionId), sortO); + else if (sortC == "base priority") + return ModifySort(n1.ProcessItem.Process.BasePriority.CompareTo( + n2.ProcessItem.Process.BasePriority), sortO); else if (sortC == "description") return ModifySort(n1.Description.CompareTo(n2.Description), sortO); else if (sortC == "company") @@ -230,6 +251,16 @@ namespace ProcessHacker return ModifySort(n1.FileName.CompareTo(n2.FileName), sortO); else if (sortC == "command line") return ModifySort(n1.CommandLine.CompareTo(n2.CommandLine), sortO); + else if (sortC == "threads") + return ModifySort(n1.ProcessItem.Process.NumberOfThreads.CompareTo( + n2.ProcessItem.Process.NumberOfThreads), sortO); + else if (sortC == "handles") + return ModifySort(n1.ProcessItem.Process.HandleCount.CompareTo( + n2.ProcessItem.Process.HandleCount), sortO); + else if (sortC == "gdi handles") + return ModifySort(n1.GdiHandlesNumber.CompareTo(n2.GdiHandlesNumber), sortO); + else if (sortC == "user handles") + return ModifySort(n1.UserHandlesNumber.CompareTo(n2.UserHandlesNumber), sortO); else return 0; })); diff --git a/trunk/ProcessHacker/Forms/HackerWindow.Designer.cs b/trunk/ProcessHacker/Forms/HackerWindow.Designer.cs index 2f32cb19f..67e4cf3e3 100644 --- a/trunk/ProcessHacker/Forms/HackerWindow.Designer.cs +++ b/trunk/ProcessHacker/Forms/HackerWindow.Designer.cs @@ -960,6 +960,7 @@ this.Text = "Process Hacker"; this.Load += new System.EventHandler(this.HackerWindow_Load); this.SizeChanged += new System.EventHandler(this.HackerWindow_SizeChanged); + this.VisibleChanged += new System.EventHandler(this.HackerWindow_VisibleChanged); this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.HackerWindow_FormClosing); ((System.ComponentModel.ISupportInitialize)(this.statusGeneral)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.statusCPU)).EndInit(); diff --git a/trunk/ProcessHacker/Forms/HackerWindow.cs b/trunk/ProcessHacker/Forms/HackerWindow.cs index df1b82774..245f04b5d 100644 --- a/trunk/ProcessHacker/Forms/HackerWindow.cs +++ b/trunk/ProcessHacker/Forms/HackerWindow.cs @@ -2372,5 +2372,10 @@ namespace ProcessHacker tabControlBig.Invalidate(false); } + + private void HackerWindow_VisibleChanged(object sender, EventArgs e) + { + treeProcesses.Draw = this.Visible; + } } } diff --git a/trunk/ProcessHacker/Forms/ProcessWindow.cs b/trunk/ProcessHacker/Forms/ProcessWindow.cs index 986127ab3..7e91c7c49 100644 --- a/trunk/ProcessHacker/Forms/ProcessWindow.cs +++ b/trunk/ProcessHacker/Forms/ProcessWindow.cs @@ -759,42 +759,49 @@ namespace ProcessHacker // update statistics if (tabControl.SelectedTab == tabStatistics) { - labelCPUPriority.Text = item.Process.BasePriority.ToString(); - labelCPUKernelTime.Text = Misc.GetNiceTimeSpan(new TimeSpan(item.Process.KernelTime)); - labelCPUUserTime.Text = Misc.GetNiceTimeSpan(new TimeSpan(item.Process.UserTime)); - labelCPUTotalTime.Text = Misc.GetNiceTimeSpan(new TimeSpan(item.Process.KernelTime + item.Process.UserTime)); - - labelMemoryPB.Text = Misc.GetNiceSizeName(item.Process.VirtualMemoryCounters.PrivateBytes); - labelMemoryWS.Text = Misc.GetNiceSizeName(item.Process.VirtualMemoryCounters.WorkingSetSize); - labelMemoryPWS.Text = Misc.GetNiceSizeName(item.Process.VirtualMemoryCounters.PeakWorkingSetSize); - labelMemoryVS.Text = Misc.GetNiceSizeName(item.Process.VirtualMemoryCounters.VirtualSize); - labelMemoryPVS.Text = Misc.GetNiceSizeName(item.Process.VirtualMemoryCounters.PeakVirtualSize); - labelMemoryPU.Text = Misc.GetNiceSizeName(item.Process.VirtualMemoryCounters.PagefileUsage); - labelMemoryPPU.Text = Misc.GetNiceSizeName(item.Process.VirtualMemoryCounters.PeakPagefileUsage); - labelMemoryPF.Text = item.Process.VirtualMemoryCounters.PageFaultCount.ToString("N0"); - - labelIOReads.Text = item.Process.IoCounters.ReadOperationCount.ToString("N0"); - labelIOReadBytes.Text = Misc.GetNiceSizeName(item.Process.IoCounters.ReadTransferCount); - labelIOWrites.Text = item.Process.IoCounters.WriteOperationCount.ToString("N0"); - labelIOWriteBytes.Text = Misc.GetNiceSizeName(item.Process.IoCounters.WriteTransferCount); - labelIOOther.Text = item.Process.IoCounters.OtherOperationCount.ToString("N0"); - labelIOOtherBytes.Text = Misc.GetNiceSizeName(item.Process.IoCounters.OtherTransferCount); - - labelOtherHandles.Text = item.Process.HandleCount.ToString("N0"); - - try - { - using (var phandle = new Win32.ProcessHandle(_pid, Program.MinProcessQueryRights)) - { - labelOtherGDIHandles.Text = phandle.GetGuiResources(false).ToString("N0"); - labelOtherUSERHandles.Text = phandle.GetGuiResources(true).ToString("N0"); - } - } - catch - { } + this.UpdateStatistics(); } } + private void UpdateStatistics() + { + ProcessItem item = Program.HackerWindow.ProcessProvider.Dictionary[_pid]; + + labelCPUPriority.Text = item.Process.BasePriority.ToString(); + labelCPUKernelTime.Text = Misc.GetNiceTimeSpan(new TimeSpan(item.Process.KernelTime)); + labelCPUUserTime.Text = Misc.GetNiceTimeSpan(new TimeSpan(item.Process.UserTime)); + labelCPUTotalTime.Text = Misc.GetNiceTimeSpan(new TimeSpan(item.Process.KernelTime + item.Process.UserTime)); + + labelMemoryPB.Text = Misc.GetNiceSizeName(item.Process.VirtualMemoryCounters.PrivateBytes); + labelMemoryWS.Text = Misc.GetNiceSizeName(item.Process.VirtualMemoryCounters.WorkingSetSize); + labelMemoryPWS.Text = Misc.GetNiceSizeName(item.Process.VirtualMemoryCounters.PeakWorkingSetSize); + labelMemoryVS.Text = Misc.GetNiceSizeName(item.Process.VirtualMemoryCounters.VirtualSize); + labelMemoryPVS.Text = Misc.GetNiceSizeName(item.Process.VirtualMemoryCounters.PeakVirtualSize); + labelMemoryPU.Text = Misc.GetNiceSizeName(item.Process.VirtualMemoryCounters.PagefileUsage); + labelMemoryPPU.Text = Misc.GetNiceSizeName(item.Process.VirtualMemoryCounters.PeakPagefileUsage); + labelMemoryPF.Text = item.Process.VirtualMemoryCounters.PageFaultCount.ToString("N0"); + + labelIOReads.Text = item.Process.IoCounters.ReadOperationCount.ToString("N0"); + labelIOReadBytes.Text = Misc.GetNiceSizeName(item.Process.IoCounters.ReadTransferCount); + labelIOWrites.Text = item.Process.IoCounters.WriteOperationCount.ToString("N0"); + labelIOWriteBytes.Text = Misc.GetNiceSizeName(item.Process.IoCounters.WriteTransferCount); + labelIOOther.Text = item.Process.IoCounters.OtherOperationCount.ToString("N0"); + labelIOOtherBytes.Text = Misc.GetNiceSizeName(item.Process.IoCounters.OtherTransferCount); + + labelOtherHandles.Text = item.Process.HandleCount.ToString("N0"); + + try + { + using (var phandle = new Win32.ProcessHandle(_pid, Program.MinProcessQueryRights)) + { + labelOtherGDIHandles.Text = phandle.GetGuiResources(false).ToString("N0"); + labelOtherUSERHandles.Text = phandle.GetGuiResources(true).ToString("N0"); + } + } + catch + { } + } + private void fileCurrentDirectory_TextBoxLeave(object sender, EventArgs e) { if (fileCurrentDirectory.Text != _realCurrentDirectory) @@ -1155,6 +1162,9 @@ namespace ProcessHacker if (_handleP != null) if (_handleP.Enabled = tabControl.SelectedTab == tabHandles) _handleP.RunOnceAsync(); + + if (tabControl.SelectedTab == tabStatistics) + this.UpdateStatistics(); } #endregion diff --git a/trunk/ProcessHacker/Misc/Misc.cs b/trunk/ProcessHacker/Misc/Misc.cs index 1c52d8c09..191835c9f 100644 --- a/trunk/ProcessHacker/Misc/Misc.cs +++ b/trunk/ProcessHacker/Misc/Misc.cs @@ -397,6 +397,27 @@ namespace ProcessHacker time.Milliseconds); } + /// + /// Gets the string representation of a priority number. + /// + /// A priority number. + /// A string. + public static string GetStringPriority(int priority) + { + if (priority >= 24) + return "Realtime"; + else if (priority >= 13) + return "High"; + else if (priority >= 10) + return "Above Normal"; + else if (priority >= 8) + return "Normal"; + else if (priority >= 6) + return "Below Normal"; + else + return "Idle"; + } + /// /// Parses a path string and returns the actual path name, removing \SystemRoot and \??\. ///