Beispiel #1
0
		private void RefreshSystemPlot()
		{
			try
			{				
				SystemSummary summary = console.Manager.Admon_GetSystemSummary(console.Credentials);

				if (summary == null)
				{
					logger.Debug("Summary is null!");
				}
				else
				{
					xVal++;
	           
					x1.Add(xVal);

					y1.Add(Convert.ToDouble(summary.PowerUsage));
					y2.Add(Convert.ToDouble(summary.PowerAvailable));

					if (x1.Count > 31)
					{
						x1.RemoveAt(0);
						y1.RemoveAt(0);
						y2.RemoveAt(0);
					}
	          
	        
					int npt=31;
					int []xTime  = new int[npt];
					double []yAvail = new double[npt];
					double []yUsage = new double[npt];

					for (int i=0; i<x1.Count; i++)
					{
						int x2 = ((((31 - x1.Count) + i)) * 2) - 60;
						xTime[i] = x2;
						yAvail[i] = (double) y1[i];
						yUsage[i] = (double) y2[i];
					}

					lineAvail.AbscissaData = xTime;
					lineAvail.OrdinateData = yAvail;

					lineUsage.AbscissaData = xTime;
					lineUsage.OrdinateData = yUsage;

					plotSurface.Refresh();
					
				}
			}
			catch (Exception ex)
			{
				logger.Error("Could not refresh system. Error: ",ex);
			}
		}
        public SystemSummary GetSystemSummary()
        {
            // calculate total number of executors
            ExecutorStorageView[]    executors    = GetExecutors();
            ApplicationStorageView[] applications = GetApplications();
            ThreadStorageView[]      threads      = GetThreads();

            int totalExecutors = executors != null ? executors.Length : 0;

            // calculate number of unfinished applications
            int unfinishedApps = 0;

            foreach (ApplicationStorageView application in applications)
            {
                if (application.State == ApplicationState.AwaitingManifest || application.State == ApplicationState.Ready)
                {
                    unfinishedApps++;
                }
            }

            int unfinishedThreads = 0;

            foreach (ThreadStorageView thread in threads)
            {
                if (thread.State != ThreadState.Dead && thread.State != ThreadState.Finished)
                {
                    unfinishedThreads++;
                }
            }

            float maxPowerValue   = 0;
            int   powerUsage      = 0;
            int   powerAvailable  = 0;
            float totalUsageValue = 0;

            int connectedExecutorCount = 0;

            foreach (ExecutorStorageView executor in executors)
            {
                if (executor.Connected)
                {
                    connectedExecutorCount++;
                    maxPowerValue   += executor.MaxCpu;
                    powerAvailable  += executor.AvailableCpu;
                    powerUsage      += executor.CpuUsage;
                    totalUsageValue += executor.TotalCpuUsage * executor.MaxCpu / (3600 * 1000);
                }
            }

            if (connectedExecutorCount != 0)
            {
                powerAvailable /= connectedExecutorCount;
                powerUsage     /= connectedExecutorCount;
            }
            else
            {
                powerAvailable = 0;
                powerUsage     = 0;
            }

            string powerTotalUsage = String.Format("{0} GHz*Hr", Math.Round(totalUsageValue, 6));
            string maxPower        = String.Format("{0} GHz", Math.Round(maxPowerValue / 1000, 6));

            SystemSummary summary = new SystemSummary(
                maxPower,
                totalExecutors,
                powerUsage,
                powerAvailable,
                powerTotalUsage,
                unfinishedApps,
                unfinishedThreads);

            return(summary);
        }
Beispiel #3
0
        private void RefreshSystemPlot()
        {
            try
            {
                SystemSummary summary = console.Manager.Admon_GetSystemSummary(console.Credentials);

                if (summary == null)
                {
                    logger.Debug("Summary is null!");
                }
                else
                {
                    this.lbMaxPowerAvail.Text   = summary.MaxPower.ToString();
                    this.lbTotalPowerUsage.Text = summary.PowerTotalUsage.ToString();

                    this.lbCurPowerAvail.Text = summary.PowerAvailable.ToString() + " %";
                    this.lbCurPowerUsage.Text = summary.PowerUsage.ToString() + " %";

                    this.lbNumExec.Text     = summary.TotalExecutors.ToString();
                    this.lbRunningApps.Text = summary.UnfinishedApps.ToString();
                    this.lbRunningJobs.Text = summary.UnfinishedThreads.ToString();
                    xVal++;

                    x1.Add(xVal);

                    y1.Add(Convert.ToDouble(summary.PowerUsage));
                    y2.Add(Convert.ToDouble(summary.PowerAvailable));

                    if (x1.Count > 31)
                    {
                        x1.RemoveAt(0);
                        y1.RemoveAt(0);
                        y2.RemoveAt(0);
                    }


                    int       npt    = 31;
                    int []    xTime  = new int[npt];
                    double [] yAvail = new double[npt];
                    double [] yUsage = new double[npt];

                    for (int i = 0; i < x1.Count; i++)
                    {
                        int x2 = ((((31 - x1.Count) + i)) * 2) - 60;
                        xTime[i]  = x2;
                        yAvail[i] = (double)y1[i];
                        yUsage[i] = (double)y2[i];
                    }

                    lineAvail.AbscissaData = xTime;
                    lineAvail.OrdinateData = yAvail;

                    lineUsage.AbscissaData = xTime;
                    lineUsage.OrdinateData = yUsage;

                    plotSurface.Refresh();
                }
            }
            catch (Exception ex)
            {
                logger.Error("Could not refresh system. Error: ", ex);
            }
        }
        public SystemSummary GetSystemSummary()
        {
            // calculate total number of executors
            Int32 totalExecutors = m_executors != null ? m_executors.Count : 0;

            // calculate number of unfinished applications
            Int32 unfinishedApps = 0;

            if (m_applications != null)
            {
                foreach (ApplicationStorageView application in m_applications)
                {
                    if (application.State == ApplicationState.AwaitingManifest || application.State == ApplicationState.Ready)
                    {
                        unfinishedApps++;
                    }
                }
            }

            Int32 unfinishedThreads = 0;

            if (m_threads != null)
            {
                foreach (ThreadStorageView thread in m_threads)
                {
                    if (thread.State != ThreadState.Dead && thread.State != ThreadState.Finished)
                    {
                        unfinishedThreads++;
                    }
                }
            }

            float maxPowerValue   = 0;
            Int32 powerUsage      = 0;
            Int32 powerAvailable  = 0;
            float totalUsageValue = 0;

            if (m_executors != null)
            {
                int connectedExecutorCount = 0;

                foreach (ExecutorStorageView executor in m_executors)
                {
                    if (executor.Connected)
                    {
                        connectedExecutorCount++;
                        maxPowerValue   += executor.MaxCpu;
                        powerAvailable  += executor.AvailableCpu;
                        powerUsage      += executor.CpuUsage;
                        totalUsageValue += executor.TotalCpuUsage * executor.MaxCpu / (3600 * 1000);
                    }
                }

                powerAvailable /= connectedExecutorCount;
                powerUsage     /= connectedExecutorCount;
            }

            String powerTotalUsage = String.Format("{0} GHz*Hr", Math.Round(totalUsageValue, 6));
            String maxPower        = String.Format("{0} GHz", Math.Round(maxPowerValue / 1000, 6));

            SystemSummary summary = new SystemSummary(
                maxPower,
                totalExecutors,
                powerUsage,
                powerAvailable,
                powerTotalUsage,
                unfinishedApps,
                unfinishedThreads);

            return(summary);
        }