예제 #1
0
        public void showRpt(int selpage, int needinit)
        {
            switch (selpage)
            {
            case 1:
                if (needinit == 1)
                {
                    this.genRptPara1.pageInit_1(this);
                }
                else
                {
                    this.genRptPara1.pageInit_2(0);
                }
                this.genRptPara1.Visible  = true;
                this.EgenRptShow1.Visible = false;
                this.genRptPara1.resettime();
                this.m_inAnalysisFlg = 1;
                return;

            case 2:
                Program.IdleTimer_Pause(2);
                this.genRptPara1.pageInit_2(1);
                this.genRptPara1.Visible  = true;
                this.EgenRptShow1.Visible = false;
                if (this.m_inAnalysisFlg == 2)
                {
                    return;
                }
                this.m_pParaClass = new EGenRptParaClass();
                this.m_pParaClass.pageInit(this.genRptPara1);
                this.m_inAnalysisFlg  = 2;
                this.m_oldAnalysisFlg = 2;
                System.Threading.ThreadPool.QueueUserWorkItem(new System.Threading.WaitCallback(this.prepare_dataProc), this.m_pParaClass);
                this.dTimer.Enabled = true;
                return;

            case 3:
                this.genRptPara1.Visible  = false;
                this.EgenRptShow1.Visible = true;
                this.EgenRptShow1.pageInit(this, this.m_pParaClass, this.m_retDataSet);
                DebugCenter.GetInstance().appendToFile("PowerAnalysis Finish.");
                Program.IdleTimer_Run(2);
                this.m_inAnalysisFlg = 4;
                return;

            case 4:
                this.genRptPara1.Visible  = false;
                this.EgenRptShow1.Visible = true;
                this.m_inAnalysisFlg      = 4;
                return;

            default:
                return;
            }
        }
예제 #2
0
        private void prepare_dataProc(object param)
        {
            System.DateTime  now = System.DateTime.Now;
            EGenRptParaClass eGenRptParaClass = param as EGenRptParaClass;

            this.m_retDataSet = new System.Collections.Generic.List <object>();
            DataTable[] array = new DataTable[]
            {
                null,
                null,
                null,
                null
            };
            DataTable[] array2 = new DataTable[]
            {
                null,
                null,
                null,
                null
            };
            DataTable[] array3 = new DataTable[]
            {
                null,
                null,
                null,
                null
            };
            DataTable[] array4 = new DataTable[]
            {
                null,
                null,
                null,
                null
            };
            System.Collections.Generic.Dictionary <long, RackStatusOne> item = null;
            double[] array5 = new double[4];
            double[] array6 = new double[4];
            double[] array7 = new double[4];
            double[] array8 = new double[4];
            array5[0] = -1.0;
            array5[1] = -1.0;
            array5[2] = -1.0;
            array5[3] = -1.0;
            array6[0] = -1.0;
            array6[1] = -1.0;
            array6[2] = -1.0;
            array6[3] = -1.0;
            array7[0] = -1.0;
            array7[1] = -1.0;
            array7[2] = -1.0;
            array7[3] = -1.0;
            array8[0] = -1.0;
            array8[1] = -1.0;
            array8[2] = -1.0;
            array8[3] = -1.0;
            System.Collections.ArrayList gppara_list = eGenRptParaClass.gppara_list;
            string[] array9  = new string[4];
            string[] array10 = new string[4];
            string[] array11 = new string[4];
            string[] array12 = new string[4];
            for (int i = 0; i < 4; i++)
            {
                array9[i]  = null;
                array11[i] = null;
                array12[i] = null;
            }
            for (int j = 0; j < gppara_list.Count; j++)
            {
                string[] array13 = gppara_list[j].ToString().Split(new char[]
                {
                    '|'
                });
                array9[j]  = array13[EGenRptShow.AnalysisIndex_devIDs];
                array10[j] = array13[EGenRptShow.AnalysisIndex_invaliddevIDs];
                array12[j] = array13[EGenRptShow.AnalysisIndex_gpTP];
                array11[j] = array13[EGenRptShow.AnalysisIndex_portIDs];
            }
            if (eGenRptParaClass.chkchart1_Checked() || eGenRptParaClass.chkchart2_Checked() || eGenRptParaClass.chkchart3_Checked() || eGenRptParaClass.chkchart4_Checked() || eGenRptParaClass.chkchart5_Checked() || eGenRptParaClass.chkchart7_Checked() || eGenRptParaClass.chkchart9_Checked())
            {
                for (int k = 0; k < gppara_list.Count; k++)
                {
                    string[] array14 = gppara_list[k].ToString().Split(new char[]
                    {
                        '|'
                    });
                    if (array[k] == null)
                    {
                        System.DateTime now2 = System.DateTime.Now;
                        DebugCenter.GetInstance().appendToFile("PowerAnalysis - PD: GP:" + array14[EGenRptShow.AnalysisIndex_gpNM] + " SSS.");
                        array[k] = DBTools.GetChart1Data(eGenRptParaClass.strBegin, eGenRptParaClass.strEnd, array9[k], array11[k], eGenRptParaClass.groupby, array12[k], eGenRptParaClass.dblibnameDev, eGenRptParaClass.dblibnamePort);
                        System.DateTime now3     = System.DateTime.Now;
                        System.TimeSpan timeSpan = now3 - now2;
                        DebugCenter.GetInstance().appendToFile("PowerAnalysis - PD: GP:" + array14[EGenRptShow.AnalysisIndex_gpNM] + " EEE. sp(s) = " + timeSpan.TotalSeconds.ToString("F3"));
                        DBProcessUtil.TransferRatio(array[k], "power_consumption", 10000.0);
                        array5[k] = timeSpan.TotalSeconds;
                    }
                }
            }
            if (eGenRptParaClass.chkchart2_Checked() || eGenRptParaClass.chkchart7_Checked())
            {
                for (int l = 0; l < gppara_list.Count; l++)
                {
                    string[] array15 = gppara_list[l].ToString().Split(new char[]
                    {
                        '|'
                    });
                    if (array2[l] == null)
                    {
                        System.DateTime now4 = System.DateTime.Now;
                        DebugCenter.GetInstance().appendToFile("PowerAnalysis - POWER: GP:" + array15[EGenRptShow.AnalysisIndex_gpNM] + " SSS.");
                        array2[l] = DBTools.GetChart2Data(eGenRptParaClass.strBegin, eGenRptParaClass.strEnd, array9[l], array11[l], eGenRptParaClass.groupby, array12[l]);
                        System.DateTime now5      = System.DateTime.Now;
                        System.TimeSpan timeSpan2 = now5 - now4;
                        DebugCenter.GetInstance().appendToFile("PowerAnalysis - POWER: GP:" + array15[EGenRptShow.AnalysisIndex_gpNM] + " EEE. sp(s) = " + timeSpan2.TotalSeconds.ToString("F3"));
                        DBProcessUtil.TransferRatio(array2[l], "power", 10000.0);
                        array6[l] = timeSpan2.TotalSeconds;
                    }
                }
            }
            if (eGenRptParaClass.chkchart6_Checked())
            {
                System.DateTime now6 = System.DateTime.Now;
                DebugCenter.GetInstance().appendToFile("PowerAnalysis - Energy Saving: SSS.");
                System.Collections.ArrayList allRack_NoEmpty = RackInfo.GetAllRack_NoEmpty();
                string text = "";
                foreach (RackInfo rackInfo in allRack_NoEmpty)
                {
                    text = text + rackInfo.DeviceInfo + ",";
                }
                if (text.Length > 1)
                {
                    text = text.Substring(0, text.Length - 1);
                }
                else
                {
                    text = "0";
                }
                DataSet dataSet = ClientAPI.getDataSet(0);
                item = boardDataUtil.RackCal_infor(allRack_NoEmpty, dataSet);
                System.DateTime now7      = System.DateTime.Now;
                System.TimeSpan timeSpan3 = now7 - now6;
                DebugCenter.GetInstance().appendToFile("PowerAnalysis - Energy Saving: EEE. sp(s) = " + timeSpan3.TotalSeconds.ToString("F3"));
            }
            if (eGenRptParaClass.chkchart8_Checked())
            {
                for (int m = 0; m < gppara_list.Count; m++)
                {
                    string[] array16 = gppara_list[m].ToString().Split(new char[]
                    {
                        '|'
                    });
                    System.DateTime now8 = System.DateTime.Now;
                    DebugCenter.GetInstance().appendToFile("PowerAnalysis - InventoryList PD: GP:" + array16[EGenRptShow.AnalysisIndex_gpNM] + " SSS.");
                    array4[m] = DBTools.GetOutLetPDAndName(array12[m], eGenRptParaClass.dblibnamePort, eGenRptParaClass.dblibnameDev, eGenRptParaClass.strBegin, eGenRptParaClass.strEnd, array11[m], array10[m]);
                    DBProcessUtil.TransferRatio(array4[m], "power_consumption", 10000.0);
                    System.DateTime now9      = System.DateTime.Now;
                    System.TimeSpan timeSpan4 = now9 - now8;
                    DebugCenter.GetInstance().appendToFile("PowerAnalysis - InventoryList PD: GP:" + array16[EGenRptShow.AnalysisIndex_gpNM] + " EEE. sp(s) = " + timeSpan4.TotalSeconds.ToString("F3"));
                    System.DateTime now10 = System.DateTime.Now;
                    DebugCenter.GetInstance().appendToFile("PowerAnalysis - InventoryList POWER: GP:" + array16[EGenRptShow.AnalysisIndex_gpNM] + " SSS.");
                    array3[m] = DBTools.GetOutLetPowerAndName(array12[m], eGenRptParaClass.strBegin, eGenRptParaClass.strEnd, array11[m], array10[m]);
                    DBProcessUtil.TransferRatio(array3[m], "power", 10000.0);
                    System.DateTime now11     = System.DateTime.Now;
                    System.TimeSpan timeSpan5 = now11 - now10;
                    DebugCenter.GetInstance().appendToFile("PowerAnalysis - InventoryList POWER: GP:" + array16[EGenRptShow.AnalysisIndex_gpNM] + " EEE. sp(s) = " + timeSpan5.TotalSeconds.ToString("F3"));
                    array7[m] = timeSpan4.TotalSeconds;
                    array8[m] = timeSpan5.TotalSeconds;
                }
            }
            this.m_retDataSet.Add(array[0]);
            this.m_retDataSet.Add(array[1]);
            this.m_retDataSet.Add(array[2]);
            this.m_retDataSet.Add(array[3]);
            this.m_retDataSet.Add(array2[0]);
            this.m_retDataSet.Add(array2[1]);
            this.m_retDataSet.Add(array2[2]);
            this.m_retDataSet.Add(array2[3]);
            this.m_retDataSet.Add(array3[0]);
            this.m_retDataSet.Add(array3[1]);
            this.m_retDataSet.Add(array3[2]);
            this.m_retDataSet.Add(array3[3]);
            this.m_retDataSet.Add(array4[0]);
            this.m_retDataSet.Add(array4[1]);
            this.m_retDataSet.Add(array4[2]);
            this.m_retDataSet.Add(array4[3]);
            this.m_retDataSet.Add(item);
            this.m_inAnalysisFlg = 3;
            System.DateTime now12     = System.DateTime.Now;
            System.TimeSpan timeSpan6 = now12 - now;
            double          num       = 0.0;

            for (int n = 0; n < gppara_list.Count; n++)
            {
                string[] array17 = gppara_list[n].ToString().Split(new char[]
                {
                    '|'
                });
                string str = "PowerAnalysis prepare_dataProc";
                if (array5[n] >= 0.0)
                {
                    str  = str + " | PD: " + array5[n].ToString("F3");
                    num += array5[n];
                }
                if (array6[n] >= 0.0)
                {
                    str  = str + " | POWER: " + array6[n].ToString("F3");
                    num += array6[n];
                }
                if (array7[n] >= 0.0)
                {
                    str  = str + " | InventoryPD: " + array7[n].ToString("F3");
                    num += array7[n];
                }
                if (array8[n] >= 0.0)
                {
                    str  = str + " | InventoryPOWER: " + array8[n].ToString("F3");
                    num += array8[n];
                }
                DebugCenter.GetInstance().appendToFile(str + " | " + array17[EGenRptShow.AnalysisIndex_gpNM]);
            }
            DebugCenter.GetInstance().appendToFile(string.Concat(new object[]
            {
                "PowerAnalysis - Threads: ",
                MultiThreadQuery.getQueryThreads(),
                " prepare_dataProc(s) | Total: ",
                timeSpan6.TotalSeconds.ToString("F3"),
                " | DATABASE: ",
                num.ToString("F3"),
                " | Other: ",
                (timeSpan6.TotalSeconds - num).ToString("F3")
            }));
        }