示例#1
0
        private void CreateColumns(OSTypes os)
        {
            DataColumn column = null;

            column = table.Columns.Add("index", typeof(int));
            column.AutoIncrement     = true;
            column.AutoIncrementSeed = 0;
            column.AutoIncrementStep = 1;
            column.ReadOnly          = true;

            table.PrimaryKey = new DataColumn[] { column };

            string[] columnNames = GetColumnNames(os);

            foreach (string columnName in columnNames)
            {
                Type type = typeof(int);
                if (columnName.Equals("time"))
                {
                    type = typeof(string);
                }

                table.Columns.Add(columnName, type);
            }

            column            = table.Columns.Add("cpu", typeof(int));
            column.Expression = "100 - cpu_id";
        }
        public void SetData(string path, OSTypes os)
        {
            this.os = os;
            InitializeCharts();
            InitializeComboBoxPage();

            dataSource.LoadDataAsync(path, os);
        }
示例#3
0
        public string[] GetColumnNames(OSTypes os)
        {
            switch (os)
            {
            case OSTypes.AIX:
                return(new string[] { "time",
                                      "kthr_r", "kthr_b",
                                      "memory_avm", "memory_fre",
                                      "page_re", "page_pi", "page_po", "page_fr", "page_sr", "page_cy",
                                      "faults_in", "faults_sy", "faults_cs",
                                      "cpu_us", "cpu_sy", "cpu_id", "cpu_wa" });

            case OSTypes.BSD:
                return(new string[] { "time",
                                      "procs_r", "procs_b", "procs_w",
                                      "memory_avm", "memory_free",
                                      "page_flt", "page_re", "page_pi", "page_po", "page_fr", "page_sr",
                                      "disk_01", "disk_02",
                                      "faults_in", "faults_sy", "faults_cs",
                                      "cpu_us", "cpu_sy", "cpu_id" });

            case OSTypes.HPUX:
                return(new string[] { "time",
                                      "procs_r", "procs_b", "procs_w",
                                      "memory_avm", "memory_free",
                                      "page_re", "page_at", "page_pi", "page_po", "page_fr", "page_de", "page_sr",
                                      "faults_in", "faults_sy", "faults_cs",
                                      "cpu_us", "cpu_sy", "cpu_id" });

            case OSTypes.Linux:
                return(new string[] { "time",
                                      "procs_r", "procs_b",
                                      "memory_swpd", "memory_free", "memory_buff", "memory_cache",
                                      "swap_si", "swap_so",
                                      "io_bi", "io_bo",
                                      "system_in", "system_cs",
                                      "cpu_us", "cpu_sy", "cpu_id", "cpu_wa", "cpu_st" });

            case OSTypes.Solaris:
                return(new string[] { "time",
                                      "procs_r", "procs_b", "procs_w",
                                      "memory_swap", "memory_free",
                                      "page_re", "page_mf", "page_pi", "page_po", "page_fr", "page_de", "page_sr",
                                      "disk_01", "disk_02", "disk_03", "disk_04",
                                      "faults_in", "faults_sy", "faults_cs",
                                      "cpu_us", "cpu_sy", "cpu_id" });

            default:
                return(new string[] { "time",
                                      "kthr_r", "kthr_b",
                                      "memory_avm", "memory_fre",
                                      "page_re", "page_pi", "page_po", "page_fr", "page_sr", "page_cy",
                                      "faults_in", "faults_sy", "faults_cs",
                                      "cpu_us", "cpu_sy", "cpu_id", "cpu_wa" });
            }
        }
示例#4
0
        public void LoadDataAsync(string fileName, OSTypes os)
        {
            this.fileName = fileName;
            this.os       = os;

            Thread t = new Thread(new ThreadStart(DoLoadData));

            t.IsBackground = true;
            t.Start();
        }
        public void InitOverviewThreadsChart(Chart chart, OSTypes os)
        {
            Series series = null;

            if (os == OSTypes.AIX)
            {
                series               = chart.Series[0];
                series.Name          = "kthr_r";
                series.XValueMember  = VmstatColumns.COLUMN_DATETIME;
                series.YValueMembers = "kthr_r";

                series               = chart.Series[1];
                series.Name          = "kthr_b";
                series.XValueMember  = VmstatColumns.COLUMN_DATETIME;
                series.YValueMembers = "kthr_b";

                series = chart.Series[2];
                chart.Series.Remove(series);
            }
            else if (os == OSTypes.BSD || os == OSTypes.HPUX || os == OSTypes.Solaris)
            {
                series               = chart.Series[0];
                series.Name          = "procs_r";
                series.XValueMember  = VmstatColumns.COLUMN_DATETIME;
                series.YValueMembers = "procs_r";

                series               = chart.Series[1];
                series.Name          = "procs_b";
                series.XValueMember  = VmstatColumns.COLUMN_DATETIME;
                series.YValueMembers = "procs_b";

                series               = chart.Series[2];
                series.Name          = "procs_w";
                series.XValueMember  = VmstatColumns.COLUMN_DATETIME;
                series.YValueMembers = "procs_w";
            }
            else if (os == OSTypes.Linux)
            {
                series               = chart.Series[0];
                series.Name          = "procs_r";
                series.XValueMember  = VmstatColumns.COLUMN_DATETIME;
                series.YValueMembers = "procs_r";

                series               = chart.Series[1];
                series.Name          = "procs_b";
                series.XValueMember  = VmstatColumns.COLUMN_DATETIME;
                series.YValueMembers = "procs_b";

                series = chart.Series[2];
                chart.Series.Remove(series);
            }
        }
        public void InitPageChart(Chart chart, OSTypes os, string name)
        {
            Series series = null;

            series               = chart.Series[0];
            series.Name          = name;
            series.XValueMember  = VmstatColumns.COLUMN_DATETIME;
            series.YValueMembers = name;

            Title title = null;

            title      = chart.Titles[0];
            title.Text = name;
        }
        public char GetOSType(OSTypes osType)
        {
            switch (osType)
            {
            case OSTypes.Linux:
                return('l');

            case OSTypes.Windows:
                return('w');

            default:
                return(' ');
            }
        }
        public void InitMemoryAvmChart(Chart chart, OSTypes os)
        {
            Series series = null;

            series = chart.Series[0];

            if (os == OSTypes.Linux)
            {
                series.Name          = "memory_swpd";
                series.XValueMember  = VmstatColumns.COLUMN_DATETIME;
                series.YValueMembers = "memory_swpd";

                series               = chart.Series[1];
                series.Name          = "memory_buff";
                series.XValueMember  = VmstatColumns.COLUMN_DATETIME;
                series.YValueMembers = "memory_buff";

                series               = chart.Series[2];
                series.Name          = "memory_cache";
                series.XValueMember  = VmstatColumns.COLUMN_DATETIME;
                series.YValueMembers = "memory_cache";
            }
            else if (os == OSTypes.Solaris)
            {
                series.Name          = "memory_swap";
                series.XValueMember  = VmstatColumns.COLUMN_DATETIME;
                series.YValueMembers = "memory_swap";

                series = chart.Series["Series2"];
                chart.Series.Remove(series);

                series = chart.Series["Series3"];
                chart.Series.Remove(series);
            }
            else
            {
                series.Name          = "memory_avm";
                series.XValueMember  = VmstatColumns.COLUMN_DATETIME;
                series.YValueMembers = "memory_avm";

                series = chart.Series["Series2"];
                chart.Series.Remove(series);

                series = chart.Series["Series3"];
                chart.Series.Remove(series);
            }
        }
        public void InitOverviewMemoryChart(Chart chart, OSTypes os)
        {
            Series series = null;

            series = chart.Series[0];

            if (os == OSTypes.AIX)
            {
                series.XValueMember  = VmstatColumns.COLUMN_DATETIME;
                series.YValueMembers = "memory_fre";
            }
            else
            {
                series.XValueMember  = VmstatColumns.COLUMN_DATETIME;
                series.YValueMembers = "memory_free";
            }
        }
示例#10
0
        public int LoadData(string fileName, OSTypes os)
        {
            CreateColumns(os);

            Regex regex = new Regex(" +");

            char[] separator = new char[] { ' ' };

            string line = null;
            string temp = null;

            string[] values = null;

            int columnCount = table.Columns.Count;
            int len         = columnCount - 2;

            table.BeginLoadData();

            using (TextReader reader = File.OpenText(fileName))
            {
                while ((line = reader.ReadLine()) != null)
                {
                    temp   = regex.Replace(line.Trim().Replace("\t", " "), " ");
                    values = temp.Split(separator, StringSplitOptions.RemoveEmptyEntries);

                    if (values.Length == len)
                    {
                        DataRow row = table.NewRow();
                        for (int i = 0; i < len; i++)
                        {
                            row[i + 1] = values[i];
                        }

                        table.Rows.Add(row);
                    }
                }
            }

            table.EndLoadData();

            dataView = table.AsDataView();

            return(table.Rows.Count);
        }
        public void Build(OSTypes osType)
        {
            InitOverviewCPUChart(OverviewCPUChart);
            InitOverviewMemoryChart(OverviewMemoryChart, osType);
            InitOverviewThreadsChart(OverviewThreadsChart, osType);
            InitOverviewFaultsChart(OverviewFaultsChart, osType);

            InitCPUChart(CPUChart, osType);
            InitCPUTotalChart(CPUTotalChart);

            InitMemoryAvmChart(MemoryAvmChart, osType);
            InitMemoryFreeChart(MemoryFreeChart, osType);

            InitThreadsRChart(ThreadsRChart, osType);
            InitThreadsBChart(ThreadsBChart, osType);

            InitInterruptChart(InterruptChart, osType);
            InitContextSwitchesChart(ContextSwitchesChart, osType);
        }
        public void InitContextSwitchesChart(Chart chart, OSTypes os)
        {
            Series series = null;

            if (os == OSTypes.Linux)
            {
                series               = chart.Series[0];
                series.Name          = "system_cs";
                series.XValueMember  = VmstatColumns.COLUMN_DATETIME;
                series.YValueMembers = "system_cs";
            }
            else
            {
                series               = chart.Series[0];
                series.Name          = "faults_cs";
                series.XValueMember  = VmstatColumns.COLUMN_DATETIME;
                series.YValueMembers = "faults_cs";
            }
        }
        public void InitThreadsRChart(Chart chart, OSTypes os)
        {
            Series series = null;

            if (os == OSTypes.AIX)
            {
                series               = chart.Series[0];
                series.Name          = "kthr_r";
                series.XValueMember  = VmstatColumns.COLUMN_DATETIME;
                series.YValueMembers = "kthr_r";
            }
            else
            {
                series               = chart.Series[0];
                series.Name          = "procs_r";
                series.XValueMember  = VmstatColumns.COLUMN_DATETIME;
                series.YValueMembers = "procs_r";
            }
        }
示例#14
0
        private void toolStripComboBoxServerType_SelectedIndexChanged(object sender, EventArgs e)
        {
            int index = toolStripComboBoxServerType.SelectedIndex;

            switch (index)
            {
            case 0:
                osType = OSTypes.AIX;
                break;

            case 1:
                osType = OSTypes.HPUX;
                break;

            case 2:
                osType = OSTypes.Solaris;
                break;

            case 4:
                osType = OSTypes.Linux;
                break;

            case 5:
                osType = OSTypes.BSD;
                break;

            default:
                osType = OSTypes.AIX;
                break;
            }

            Options options = new Options();

            options.OS = index;
            XmlSerializerFacade facade = new XmlSerializerFacade(typeof(Options), "options.config", options);

            facade.Serialize();
        }
示例#15
0
        public string[] GetPageNames(OSTypes os)
        {
            switch (os)
            {
            case OSTypes.AIX:
                return(new string[] { "page_re", "page_pi", "page_po", "page_fr", "page_sr", "page_cy" });

            case OSTypes.BSD:
                return(new string[] { "page_flt", "page_re", "page_pi", "page_po", "page_fr", "page_sr" });

            case OSTypes.HPUX:
                return(new string[] { "page_re", "page_at", "page_pi", "page_po", "page_fr", "page_de", "page_sr" });

            case OSTypes.Linux:
                return(new string[] { "swap_si", "swap_so" });

            case OSTypes.Solaris:
                return(new string[] { "page_re", "page_mf", "page_pi", "page_po", "page_fr", "page_de", "page_sr" });

            default:
                return(new string[] { "page_re", "page_pi", "page_po", "page_fr", "page_sr", "page_cy" });
            }
        }
        public void InitOverviewFaultsChart(Chart chart, OSTypes os)
        {
            Series series = null;

            if (os == OSTypes.Linux)
            {
                series               = chart.Series[0];
                series.Name          = "system_cs";
                series.XValueMember  = VmstatColumns.COLUMN_DATETIME;
                series.YValueMembers = "system_cs";

                series               = chart.Series[1];
                series.Name          = "system_in";
                series.XValueMember  = VmstatColumns.COLUMN_DATETIME;
                series.YValueMembers = "system_in";

                series = chart.Series[2];
                chart.Series.Remove(series);
            }
            else
            {
                series               = chart.Series[0];
                series.Name          = "faults_cs";
                series.XValueMember  = VmstatColumns.COLUMN_DATETIME;
                series.YValueMembers = "faults_cs";

                series               = chart.Series[1];
                series.Name          = "faults_in";
                series.XValueMember  = VmstatColumns.COLUMN_DATETIME;
                series.YValueMembers = "faults_in";

                series               = chart.Series[2];
                series.Name          = "faults_sy";
                series.XValueMember  = VmstatColumns.COLUMN_DATETIME;
                series.YValueMembers = "faults_sy";
            }
        }
        public void InitCPUChart(Chart chart, OSTypes os)
        {
            Series series = null;

            series = chart.Series["cpu_us"];
            series.XValueMember  = VmstatColumns.COLUMN_DATETIME;
            series.YValueMembers = "cpu_us";

            series = chart.Series["cpu_sy"];
            series.XValueMember  = VmstatColumns.COLUMN_DATETIME;
            series.YValueMembers = "cpu_sy";

            if (os == OSTypes.AIX || os == OSTypes.Linux)
            {
                series = chart.Series["cpu_wa"];
                series.XValueMember  = VmstatColumns.COLUMN_DATETIME;
                series.YValueMembers = "cpu_wa";
            }
            else
            {
                series = chart.Series["cpu_wa"];
                chart.Series.Remove(series);
            }

            if (os == OSTypes.Linux)
            {
                series = chart.Series["cpu_st"];
                series.XValueMember  = VmstatColumns.COLUMN_DATETIME;
                series.YValueMembers = "cpu_st";
            }
            else
            {
                series = chart.Series["cpu_st"];
                chart.Series.Remove(series);
            }
        }