Exemplo n.º 1
0
        public override void Draw(TreeNodeAdv node, DrawContext context)
        {
            PlotterInfo info = GetValue(node) as PlotterInfo;

            if (_plotter == null)
            {
                _plotter = new Plotter
                {
                    BackColor         = Color.Black,
                    ShowGrid          = false,
                    OverlaySecondLine = false
                };
            }

            if (info.UseLongData)
            {
                _plotter.UseLongData = true;
                _plotter.LongData1   = info.LongData1;
                _plotter.LongData2   = info.LongData2;
            }
            else
            {
                _plotter.UseLongData = false;
                _plotter.Data1       = info.Data1;
                _plotter.Data2       = info.Data2;
            }

            _plotter.UseSecondLine     = info.UseSecondLine;
            _plotter.OverlaySecondLine = info.OverlaySecondLine;
            _plotter.LineColor1        = info.LineColor1;
            _plotter.LineColor2        = info.LineColor2;

            if ((_plotter.Width != context.Bounds.Width - 1 ||
                 _plotter.Height != context.Bounds.Height - 1) &&
                context.Bounds.Width > 1 && context.Bounds.Height > 1)
            {
                _plotter.Size = new Size(context.Bounds.Width - 1, context.Bounds.Height - 1);
            }

            _plotter.Draw();

            using (Bitmap b = new Bitmap(_plotter.Width, _plotter.Height))
            {
                _plotter.DrawToBitmap(b, new Rectangle(0, 0, b.Width, b.Height));

                context.Graphics.DrawImage(b, context.Bounds.Location);
            }
        }
Exemplo n.º 2
0
        public override void Draw(TreeNodeAdv node, DrawContext context)
        {
            PlotterInfo info = GetValue(node) as PlotterInfo;

            if (_plotter == null)
            {
                _plotter = new Plotter
                {
                    BackColor = Color.Black, 
                    ShowGrid = false, 
                    OverlaySecondLine = false
                };
            }

            if (info.UseLongData)
            {
                _plotter.UseLongData = true;
                _plotter.LongData1 = info.LongData1;
                _plotter.LongData2 = info.LongData2;
            }
            else
            {
                _plotter.UseLongData = false;
                _plotter.Data1 = info.Data1;
                _plotter.Data2 = info.Data2;
            }

            _plotter.UseSecondLine = info.UseSecondLine;
            _plotter.OverlaySecondLine = info.OverlaySecondLine;
            _plotter.LineColor1 = info.LineColor1;
            _plotter.LineColor2 = info.LineColor2;

            if ((_plotter.Width != context.Bounds.Width - 1 || 
                _plotter.Height != context.Bounds.Height - 1) &&
                context.Bounds.Width > 1 && context.Bounds.Height > 1)
                _plotter.Size = new Size(context.Bounds.Width - 1, context.Bounds.Height - 1);

            _plotter.Draw();

            using (Bitmap b = new Bitmap(_plotter.Width, _plotter.Height))
            {
                _plotter.DrawToBitmap(b, new Rectangle(0, 0, b.Width, b.Height));

                context.Graphics.DrawImage(b, context.Bounds.Location);
            }
        }
Exemplo n.º 3
0
        protected PlotterIcon()
        {
            _dataHistory1 = new CircularBuffer<float>(20);
            _dataHistory2 = new CircularBuffer<float>(20);
            _longDataHistory1 = new CircularBuffer<long>(20);
            _longDataHistory2 = new CircularBuffer<long>(20);

            _plotter = new Plotter
            {
                Size = this.Size,
                ShowGrid = false,
                BackColor = Color.Black,
                MoveStep = 2,
                Data1 = _dataHistory1,
                Data2 = _dataHistory2,
                LongData1 = _longDataHistory1,
                LongData2 = _longDataHistory2
            };
        }
Exemplo n.º 4
0
        public PlotterIcon()
        {
            _floatHistory.Add(true);
            _floatHistory.Add(false);
            _longHistory.Add(true);
            _longHistory.Add(false);

            _plotter = new Plotter()
            {
                Size = this.Size,
                ShowGrid = false,
                BackColor = Color.Black,
                MoveStep = 2,
                Data1 = _floatHistory[true],
                Data2 = _floatHistory[false],
                LongData1 = _longHistory[true],
                LongData2 = _longHistory[false]
            };
        }
Exemplo n.º 5
0
        private void LoadStage1()
        {   
            // Maximum physical memory.
            indicatorPhysical.Maximum = (int)_pages;

            // Set indicators color
            indicatorCpu.Color1 = Properties.Settings.Default.PlotterCPUKernelColor;
            indicatorCpu.Color2 = Properties.Settings.Default.PlotterCPUUserColor;
            indicatorIO.Color1 = Properties.Settings.Default.PlotterIOROColor;
            indicatorPhysical.Color1 = Properties.Settings.Default.PlotterMemoryWSColor;  


            // Set up the plotter controls.
            plotterCPU.Data1 = Program.ProcessProvider.FloatHistory["Kernel"];
            plotterCPU.Data2 = Program.ProcessProvider.FloatHistory["User"];
            plotterCPU.GetToolTip = i =>
                Program.ProcessProvider.MostCpuHistory[i] + "\n" +
                ((plotterCPU.Data1[i] + plotterCPU.Data2[i]) * 100).ToString("N2") +
                "% (K " + (plotterCPU.Data1[i] * 100).ToString("N2") +
                "%, U " + (plotterCPU.Data2[i] * 100).ToString("N2") + "%)" + "\n" +
                Program.ProcessProvider.TimeHistory[i].ToString();
            plotterIO.LongData1 = Program.ProcessProvider.LongHistory[SystemStats.IoReadOther];
            plotterIO.LongData2 = Program.ProcessProvider.LongHistory[SystemStats.IoWrite];
            plotterIO.GetToolTip = i =>
                Program.ProcessProvider.MostIoHistory[i] + "\n" +
                "R+O: " + Utils.FormatSize(plotterIO.LongData1[i]) + "\n" +
                "W: " + Utils.FormatSize(plotterIO.LongData2[i]) + "\n" +
                Program.ProcessProvider.TimeHistory[i].ToString();
            plotterMemory.LongData1 = Program.ProcessProvider.LongHistory[SystemStats.Commit];
            plotterMemory.LongData2 = Program.ProcessProvider.LongHistory[SystemStats.PhysicalMemory];
            plotterMemory.GetToolTip = i =>
                "Commit: " + Utils.FormatSize(plotterMemory.LongData1[i]) + "\n" +
                "Phys. Memory: " + Utils.FormatSize(plotterMemory.LongData2[i]) + "\n" +
                Program.ProcessProvider.TimeHistory[i].ToString();

            // Create a plotter per CPU.
            _cpuPlotters = new Plotter[_noOfCPUs];
            tableCPUs.ColumnCount = (int)_noOfCPUs;
            tableCPUs.ColumnStyles.Clear();
            tableCPUs.Dock = DockStyle.Fill;

            for (int i = 0; i < _cpuPlotters.Length; i++)
            {
                Plotter plotter;

                tableCPUs.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 1.0f / _noOfCPUs));
                _cpuPlotters[i] = plotter = new ProcessHacker.Components.Plotter();
                plotter.BackColor = Color.Black;
                plotter.Dock = DockStyle.Fill;
                plotter.Margin = new Padding(i == 0 ? 0 : 3, 0, 0, 0); // nice spacing
                plotter.UseSecondLine = true;
                plotter.Data1 = Program.ProcessProvider.FloatHistory[i.ToString() + " Kernel"];
                plotter.Data2 = Program.ProcessProvider.FloatHistory[i.ToString() + " User"];
                plotter.GetToolTip = j =>
                    Program.ProcessProvider.MostCpuHistory[j] + "\n" +
                    ((plotter.Data1[j] + plotter.Data2[j]) * 100).ToString("N2") +
                    "% (K " + (plotter.Data1[j] * 100).ToString("N2") +
                    "%, U " + (plotter.Data2[j] * 100).ToString("N2") + "%)" + "\n" +
                    Program.ProcessProvider.TimeHistory[j].ToString();
                tableCPUs.Controls.Add(plotter, i, 0);
            }

            tableCPUs.Visible = true;
            tableCPUs.Visible = false;
            checkShowOneGraphPerCPU.Checked = Properties.Settings.Default.ShowOneGraphPerCPU;

            if (_noOfCPUs == 1)
                checkShowOneGraphPerCPU.Enabled = false;

            this.UpdateGraphs();
            this.UpdateInfo();

            Program.ProcessProvider.Updated +=
                new ProcessSystemProvider.ProviderUpdateOnce(ProcessProvider_Updated);
            
            //We need todo this here or TopMost property gets over-rided
            //by AlwaysOnTopCheckbox
            this.SetTopMost();
        }
Exemplo n.º 6
0
        public SysInfoWindow()
        {     
            this.InitializeComponent();

            //if (!Settings.Instance.SysInfoWindowBounds.IsEmpty)
                //this.DesktopBounds = Utils.FitRectangle(Settings.Instance.SysInfoWindowBounds, this);

            // Load the pool limit addresses.
            if (_mmSizeOfPagedPoolInBytes == IntPtr.Zero)
            {
                WorkQueue.GlobalQueueWorkItemTag(new Action(() =>
                {
                    try
                    {
                        using (SymbolProvider symbols = new SymbolProvider())
                        {
                            symbols.LoadModule(Windows.KernelFileName, Windows.KernelBase);

                            _mmSizeOfPagedPoolInBytes = (IntPtr)symbols.GetSymbolFromName("MmSizeOfPagedPoolInBytes").Address;
                            _mmMaximumNonPagedPoolInBytes = (IntPtr)symbols.GetSymbolFromName("MmMaximumNonPagedPoolInBytes").Address;
                        }
                    }
                    catch (Exception) { }

                }), "load-mm-addresses");
            }

            this.trackerMemory.values = Program.ProcessProvider.PhysicalMemoryHistory;
            this.trackerMemory.DrawColor = Settings.Instance.PlotterMemoryPrivateColor;

            this.trackerCommit.Maximum = (int)Program.ProcessProvider.Performance.CommitLimit;
            this.trackerCommit.values = Program.ProcessProvider.CommitHistory;
            this.trackerCommit.DrawColor = Settings.Instance.PlotterMemoryWSColor;

            // Set indicators color
            this.indicatorCpu.Color1 = Settings.Instance.PlotterCPUUserColor;
            this.indicatorCpu.Color2 = Settings.Instance.PlotterCPUKernelColor;
            
            this.indicatorIO.Color1 = Settings.Instance.PlotterIOROColor;
            this.indicatorPhysical.Color1 = Settings.Instance.PlotterMemoryPrivateColor;

            this.plotterCPU.LineColor2 = Settings.Instance.PlotterCPUKernelColor;
            this.plotterCPU.LineColor1 = Settings.Instance.PlotterCPUUserColor;

            this.plotterIO.LineColor1 = Settings.Instance.PlotterIOROColor;
            this.plotterIO.LineColor2 = Settings.Instance.PlotterIOWColor;

            // Maximum physical memory.
            this.indicatorPhysical.Maximum = _pages;

            // Set up the plotter controls.
            plotterCPU.Data1 = Program.ProcessProvider.CpuKernelHistory;
            plotterCPU.Data2 = Program.ProcessProvider.CpuUserHistory;
            plotterCPU.GetToolTip = i =>
                Program.ProcessProvider.MostCpuHistory[i] + "\n" +
                ((plotterCPU.Data1[i] + plotterCPU.Data2[i]) * 100).ToString("N2") +
                "% (K " + (plotterCPU.Data1[i] * 100).ToString("N2") +
                "%, U " + (plotterCPU.Data2[i] * 100).ToString("N2") + "%)" + "\n" +
                Program.ProcessProvider.TimeHistory[i].ToString();

            plotterIO.LongData1 = Program.ProcessProvider.IoReadOtherHistory;
            plotterIO.LongData2 = Program.ProcessProvider.IoWriteHistory;
            plotterIO.GetToolTip = i =>
                Program.ProcessProvider.MostIoHistory[i] + "\n" +
                "R+O: " + Utils.FormatSize(plotterIO.LongData1[i]) + "\n" +
                "W: " + Utils.FormatSize(plotterIO.LongData2[i]) + "\n" +
                Program.ProcessProvider.TimeHistory[i].ToString();

            //plotterMemory.Data1 = Program.ProcessProvider.CommitHistory;
            //plotterMemory.Data2 = Program.ProcessProvider.PhysicalMemoryHistory;
            //plotterMemory.GetToolTip = i => "Commit: " + plotterMemory.Data1[i] + "\n" +
            //    "Phys. Memory: " + plotterMemory.Data2[i] + "\n" + Program.ProcessProvider.TimeHistory[i].ToString();

            // Create a plotter per CPU.
            _cpuPlotters = new Plotter[_noOfCPUs];
            tableCPUs.ColumnCount = (int)_noOfCPUs;
            tableCPUs.ColumnStyles.Clear();
            tableCPUs.Dock = DockStyle.Fill;

            for (int i = 0; i < _cpuPlotters.Length; i++)
            {
                Plotter plotter;

                tableCPUs.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 1.0f / _noOfCPUs));
                _cpuPlotters[i] = plotter = new Plotter();
               
                plotter.BackColor = Color.Black;
                plotter.Dock = DockStyle.Fill;
                plotter.Margin = new Padding(i == 0 ? 0 : 3, 0, 0, 0); // nice spacing
                plotter.UseSecondLine = true;
                plotter.Data1 = Program.ProcessProvider.CpusKernelHistory[i];
                plotter.Data2 = Program.ProcessProvider.CpusUserHistory[i];
                plotter.GetToolTip = j =>
                    Program.ProcessProvider.MostCpuHistory[j] + "\n" +
                    ((plotter.Data1[j] + plotter.Data2[j]) * 100).ToString("N2") +
                    "% (K " + (plotter.Data1[j] * 100).ToString("N2") +
                    "%, U " + (plotter.Data2[j] * 100).ToString("N2") + "%)" + "\n" +
                    Program.ProcessProvider.TimeHistory[j].ToString();
               
                this.tableCPUs.Controls.Add(plotter, i, 0);
            }

            this.checkShowOneGraphPerCPU.Checked = Settings.Instance.ShowOneGraphPerCPU;

            if (_noOfCPUs == 1)
                checkShowOneGraphPerCPU.Enabled = false;

            Program.ProcessProvider.Updated += ProcessProvider_Updated;

            //We need to do this here or TopMost property gets over-rided by AlwaysOnTopCheckbox
            this.TopMost = Settings.Instance.AlwaysOnTop;

            this.UpdateGraphs();
            this.UpdateInfo();
        }
Exemplo n.º 7
0
        private void LoadStage1()
        {
            // Maximum physical memory.
            indicatorPhysical.Maximum = (int)_pages;

            // Set indicators color
            indicatorCpu.Color1      = Properties.Settings.Default.PlotterCPUKernelColor;
            indicatorCpu.Color2      = Properties.Settings.Default.PlotterCPUUserColor;
            indicatorIO.Color1       = Properties.Settings.Default.PlotterIOROColor;
            indicatorPhysical.Color1 = Properties.Settings.Default.PlotterMemoryWSColor;


            // Set up the plotter controls.
            plotterCPU.Data1      = Program.ProcessProvider.FloatHistory["Kernel"];
            plotterCPU.Data2      = Program.ProcessProvider.FloatHistory["User"];
            plotterCPU.GetToolTip = i =>
                                    Program.ProcessProvider.MostCpuHistory[i] + "\n" +
                                    ((plotterCPU.Data1[i] + plotterCPU.Data2[i]) * 100).ToString("N2") +
                                    "% (K " + (plotterCPU.Data1[i] * 100).ToString("N2") +
                                    "%, U " + (plotterCPU.Data2[i] * 100).ToString("N2") + "%)" + "\n" +
                                    Program.ProcessProvider.TimeHistory[i].ToString();
            plotterIO.LongData1  = Program.ProcessProvider.LongHistory[SystemStats.IoReadOther];
            plotterIO.LongData2  = Program.ProcessProvider.LongHistory[SystemStats.IoWrite];
            plotterIO.GetToolTip = i =>
                                   Program.ProcessProvider.MostIoHistory[i] + "\n" +
                                   "R+O: " + Utils.FormatSize(plotterIO.LongData1[i]) + "\n" +
                                   "W: " + Utils.FormatSize(plotterIO.LongData2[i]) + "\n" +
                                   Program.ProcessProvider.TimeHistory[i].ToString();
            plotterMemory.LongData1  = Program.ProcessProvider.LongHistory[SystemStats.Commit];
            plotterMemory.LongData2  = Program.ProcessProvider.LongHistory[SystemStats.PhysicalMemory];
            plotterMemory.GetToolTip = i =>
                                       "Commit: " + Utils.FormatSize(plotterMemory.LongData1[i]) + "\n" +
                                       "Phys. Memory: " + Utils.FormatSize(plotterMemory.LongData2[i]) + "\n" +
                                       Program.ProcessProvider.TimeHistory[i].ToString();

            // Create a plotter per CPU.
            _cpuPlotters          = new Plotter[_noOfCPUs];
            tableCPUs.ColumnCount = (int)_noOfCPUs;
            tableCPUs.ColumnStyles.Clear();
            tableCPUs.Dock = DockStyle.Fill;

            for (int i = 0; i < _cpuPlotters.Length; i++)
            {
                Plotter plotter;

                tableCPUs.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 1.0f / _noOfCPUs));
                _cpuPlotters[i]       = plotter = new ProcessHacker.Components.Plotter();
                plotter.BackColor     = Color.Black;
                plotter.Dock          = DockStyle.Fill;
                plotter.Margin        = new Padding(i == 0 ? 0 : 3, 0, 0, 0); // nice spacing
                plotter.UseSecondLine = true;
                plotter.Data1         = Program.ProcessProvider.FloatHistory[i.ToString() + " Kernel"];
                plotter.Data2         = Program.ProcessProvider.FloatHistory[i.ToString() + " User"];
                plotter.GetToolTip    = j =>
                                        Program.ProcessProvider.MostCpuHistory[j] + "\n" +
                                        ((plotter.Data1[j] + plotter.Data2[j]) * 100).ToString("N2") +
                                        "% (K " + (plotter.Data1[j] * 100).ToString("N2") +
                                        "%, U " + (plotter.Data2[j] * 100).ToString("N2") + "%)" + "\n" +
                                        Program.ProcessProvider.TimeHistory[j].ToString();
                tableCPUs.Controls.Add(plotter, i, 0);
            }

            tableCPUs.Visible = true;
            tableCPUs.Visible = false;
            checkShowOneGraphPerCPU.Checked = Properties.Settings.Default.ShowOneGraphPerCPU;

            if (_noOfCPUs == 1)
            {
                checkShowOneGraphPerCPU.Enabled = false;
            }

            this.UpdateGraphs();
            this.UpdateInfo();

            Program.ProcessProvider.Updated +=
                new ProcessSystemProvider.ProviderUpdateOnce(ProcessProvider_Updated);

            //We need todo this here or TopMost property gets over-rided
            //by AlwaysOnTopCheckbox
            this.SetTopMost();
        }