Esempio n. 1
0
        private void BindPerformanceValues()
        {
            DateTime StartP = Convert.ToDateTime(txtStartPeriod.Text);
            DateTime EndP   = Convert.ToDateTime(txtEndPeriod.Text);

            EndP = (EndP.CompareTo(DateTime.Now.Date) == 0 ? DateTime.Now : EndP);

            PerformanceType pt = PerformanceType.Processor;

            string charType = Page.Request.QueryString["chartType"];

            InitControls(charType, StartP, EndP);

            switch (charType)
            {
            case "Processor":
                pt = PerformanceType.Processor;
                break;

            case "Network":
                pt = PerformanceType.Network;
                break;

            case "Memory":
                pt = PerformanceType.Memory;
                break;
            }

            LoadChartData(ChartCounter, pt, StartP, EndP);
        }
Esempio n. 2
0
        private void button_Search_Click(object sender, EventArgs e)
        {
            if (textBox_SettleName.Text.Trim().Equals(""))
            {
                Prompt.Warning("未选择业绩报表!");
                return;
            }

            switch (comboBox_RepType.Text)
            {
            case "个人":
                AchieveType = PerformanceType.own;
                break;

            case "分配":
                AchieveType = PerformanceType.allot;
                break;

            case "调岗":
                AchieveType = PerformanceType.hold;
                break;

            default:
                break;
            }


            ShowPerformance();
        }
Esempio n. 3
0
 /// <summary>
 /// Registers the given <paramref name="type"/>
 /// </summary>
 /// <param name="type">The performance counter type</param>
 public void Register <TPerformanceCounter>(PerformanceType type) where TPerformanceCounter : IPerformanceCounter, new()
 {
     if (!_counters.ContainsKey(type))
     {
         _counters.Add(type, typeof(TPerformanceCounter));
     }
 }
Esempio n. 4
0
 /// <summary>
 /// Creates and initializes a new specific performance counter of type <paramref name="type"/> with
 /// with given <paramref name="name"/>.
 /// </summary>
 /// <param name="name">The name of the performance counter</param>
 /// <param name="type">The type of the performance counter</param>
 /// <returns></returns>
 private void Initialize(string name, PerformanceType type)
 {
     if (!_counters.ContainsKey(name))
     {
         _counters.Add(name, _performanceRegistry.Create(type));
     }
 }
Esempio n. 5
0
        private void CheckLength(PerformanceType performanceType)
        {
            switch (performanceType)
            {
            case PerformanceType.FrameRate:
                if (FramePoints.Count > AmountOfShownPoints)
                {
                    FramePoints.RemoveAt(0);
                }
                RaisePropertyChanged("FramePoints");
                break;

            case PerformanceType.CPU_Usage:
                if (CpuPoints.Count > AmountOfShownPoints)
                {
                    CpuPoints.RemoveAt(0);
                }
                RaisePropertyChanged("CpuPoints");
                break;

            case PerformanceType.RAM_Usage:
                if (RamPoints.Count > AmountOfShownPoints)
                {
                    RamPoints.RemoveAt(0);
                }
                RaisePropertyChanged("RamPoints");
                break;
            }
        }
 public PerformanceAspect(Type loggerServiceType, Type loggerProcessType, uint interval)
 {
     _loggerServiceType = loggerServiceType;
     _loggerProcessType = loggerProcessType;
     _interval          = interval;
     _performanceType   = PerformanceType.Warning;
 }
 public double GetAverage(PerformanceType type)
 {
     if (_log[type].Count > 0)
     {
         return(_log[type].Average(x => x.Value));
     }
     return(0);
 }
 public double GetMedian(PerformanceType type)
 {
     if (_log[type].Count > 0)
     {
         return(_log[type].Median(x => x.Value));
     }
     return(0);
 }
Esempio n. 9
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="Performance" /> class.
 /// </summary>
 /// <param name="performanceType">
 ///     The performance Type.
 /// </param>
 /// <param name="printDispose">
 ///     The print on dispose operation.
 /// </param>
 /// <param name="memberName">
 ///     The member Name.
 /// </param>
 public Performance(
     PerformanceType performanceType,
     bool printDispose = true,
     [CallerMemberName] string memberName = "")
 {
     this.memberName      = memberName;
     this.printDispose    = printDispose;
     this.performanceType = performanceType;
     this.stopwatch       = Stopwatch.StartNew();
 }
 public Performance(string name, decimal basePrice, IVenue venue, DateTime startTime, PerformanceType type)
 {
     this.Name = name;
     this.BasePrice = basePrice;
     this.Venue = venue;
     this.ValidateVenue();
     this.StartTime = startTime;
     this.Type = type;
     this.tickets = new List<ITicket>();
 }
Esempio n. 11
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="Performance" /> class.
 /// </summary>
 /// <param name="performanceType">
 ///     The performance Type.
 /// </param>
 /// <param name="printDispose">
 ///     The print on dispose operation.
 /// </param>
 /// <param name="memberName">
 ///     The member Name.
 /// </param>
 public Performance(
     PerformanceType performanceType, 
     bool printDispose = true, 
     [CallerMemberName] string memberName = "")
 {
     this.memberName = memberName;
     this.printDispose = printDispose;
     this.performanceType = performanceType;
     this.stopwatch = Stopwatch.StartNew();
 }
        public double GetPeak(PerformanceType type)
        {
            var peak = _log[type]
                       .GroupBy(x => x.SampleTime)
                       .Select(x => new { Key = x.Key, MedianValue = x.Median(y => y.Value) })
                       .OrderByDescending(x => x.MedianValue)
                       .Select(x => x.MedianValue)
                       .FirstOrDefault();

            return(peak);
        }
Esempio n. 13
0
        /// <summary>
        /// Creates a new instance of the given <paramref name="type"/>
        /// </summary>
        /// <param name="type">The type of the performance counter</param>
        /// <returns>New instance of the performance counter</returns>
        public IPerformanceCounter Create(PerformanceType type)
        {
            Type performanceCounterType;

            if (_counters.TryGetValue(type, out performanceCounterType))
            {
                return((IPerformanceCounter)Activator.CreateInstance(performanceCounterType));
            }

            throw new InvalidOperationException($"Could not find a performance counter which supports the type {type}");
        }
Esempio n. 14
0
        private void LoadChartData(Chart control, PerformanceType perfType, DateTime startPeriod, DateTime endPeriod)
        {
            PerformanceDataValue[] perfValues = ES.Services.VPSPC.GetPerfomanceValue(PanelRequest.ItemID, perfType, startPeriod, endPeriod);

            if (perfValues != null)
            {
                foreach (PerformanceDataValue item in perfValues)
                {
                    control.Series["series"].Points.AddY(item.SampleValue);
                }
            }
        }
Esempio n. 15
0
        //------------------------------------------

        //private void ShowAchievement()
        //{
        //    Common.SetColumnStyle(dataGridView_Achievement.Columns["ColArea"], ColType.area);
        //    Common.SetColumnStyle(dataGridView_Achievement.Columns["ColPrice"], ColType.price);
        //    Common.SetColumnStyle(dataGridView_Achievement.Columns["ColAmount"], ColType.amount);
        //    Common.SetColumnStyle(dataGridView_Achievement.Columns["ColTotalAmount"], ColType.amount);
        //    Common.SetColumnStyle(dataGridView_Achievement.Columns["ColAchievement"], ColType.amount);

        //    dataGridView_Achievement.AutoGenerateColumns = false;

        //    dataGridView_Achievement.DataSource = GetAchievementData(AchieveType);

        //    if (dataGridView_Achievement.Rows.Count == 0)
        //        Prompt.Warning("没有符合条件的记录!");
        //}



        private DataTable GetPerformanceData(PerformanceType type)
        {
            string sql = string.Format("select a.ContractID, b.SalesID, CustomerName, Building,Unit,ItemNum, SubscribeDate, ContractDate, b.ReceiptDate, "
                                       + "Area, Price, Amount, TotalAmount, b.salesName, ReceiptAmount, sum(Performance) Performance  from SettleDetail a "
                                       + "inner join PerformanceDetail b on a.SettleID = b.SettleID and a.ID = b.SettleDID "
                                       + "where ReceiptTypeCode = {0} and SalesType = '{1}' and PerformanceType = {2}  and a.SettleID = {3} "
                                       + "group by a.ContractID, b.SalesID, CustomerName, Building,Unit,ItemNum, SubscribeDate, ContractDate,b.ReceiptDate,Area, Price, Amount, TotalAmount,ReceiptAmount,b.salesName "
                                       + "order by b.salesID,CustomerName",
                                       comboBox_RecType.SelectedValue, SalesType, (int)type, textBox_SettleName.Tag);

            return(SqlHelper.ExecuteDataTable(sql));
        }
Esempio n. 16
0
        private void LoadChartData(Chart control, PerformanceType perfType, DateTime startPeriod, DateTime endPeriod)
        {
            PerformanceDataValue[] perfValues = ES.Services.VPSPC.GetPerfomanceValue(PanelRequest.ItemID, perfType, startPeriod, endPeriod);

            if (perfValues != null)
            {
                foreach (PerformanceDataValue item in perfValues)
                {
                    control.Series["series"].Points.AddXY(item.TimeSampled.ToString(), item.SampleValue);
                }
            }
        }
 public List <PerformanceDataValue> GetPerfomanceValue(string VmName, PerformanceType perf, DateTime startPeriod, DateTime endPeriod)
 {
     try
     {
         Log.WriteStart("'{0}' GetPerfomanceValue", ProviderSettings.ProviderName);
         List <PerformanceDataValue> result = VirtualizationForPC.GetPerfomanceValue(VmName, perf, startPeriod, endPeriod);
         Log.WriteEnd("'{0}' GetPerfomanceValue", ProviderSettings.ProviderName);
         return(result);
     }
     catch (Exception ex)
     {
         Log.WriteError(String.Format("'{0}' GetPerfomanceValue", ProviderSettings.ProviderName), ex);
         throw;
     }
 }
        public void AddValue(int value, PerformanceType performanceType)
        {
            switch (performanceType)
            {
            case PerformanceType.FrameRate:
                if (value >= 1000)
                {
                    HighFrameRateOverlay.Visibility = Visibility.Visible;
                    FrameRatePlot.Visibility        = Visibility.Hidden;
                }
                else
                {
                    HighFrameRateOverlay.Visibility = Visibility.Hidden;
                    FrameRatePlot.Visibility        = Visibility.Visible;
                }

                graphViewModel.AddPoint(value, performanceType);
                if (graphViewModel.FramePoints.Count > 10)
                {
                    graphViewModel.FramePoints.RemoveAt(0);
                }
                FrameRateCheckBox.Content = $"Frame rate ({value})";
                break;

            case PerformanceType.CPU_Usage:
                graphViewModel.AddPoint(value, performanceType);
                if (graphViewModel.CpuPoints.Count > 10)
                {
                    graphViewModel.CpuPoints.RemoveAt(0);
                }
                CpuCheckBox.Content = $"CPU Usage ( {value}% )";
                break;

            case PerformanceType.RAM_Usage:
                graphViewModel.AddPoint(value, performanceType);
                if (graphViewModel.RamPoints.Count > 10)
                {
                    graphViewModel.RamPoints.RemoveAt(0);
                }
                RamCheckBox.Content = $"RAM Usage ({value}MB)";
                break;
            }
        }
Esempio n. 19
0
        /// <summary>
        /// 计算业务员业绩
        /// </summary>
        /// <param name="row"></param>
        /// <param name="recType"></param>
        /// <param name="rate"></param>
        /// <param name="isHold"></param>
        private void SalesPerformance(DataRow row, Receivables recType, double rate, PerformanceType type, bool isHold = false)
        {
            string sql       = string.Empty;
            string salesID   = string.Empty;
            string salesName = string.Empty;
            string deptID    = string.Empty;

            deptID = GetDeptID(row["SalesID"].ToString(), row["ReceiptDate"].ToString()); //调岗时认购业务员也默认此部门,目前此字段无用

            if (isHold)
            {
                salesID   = row["SubscribeSalesID"].ToString();
                salesName = row["SubscribeSalesName"].ToString();
            }
            else
            {
                salesID   = row["SalesID"].ToString();
                salesName = row["SalesName"].ToString();
            }

            string performance = Math.Round(double.Parse(row["RecSettleTotal"].ToString()) * rate / 100, 0, MidpointRounding.AwayFromZero).ToString();

            sql = "insert into PerformanceDetail (SettleDID,SettleID,SalesID,SalesName,DeptID,ReceiptDate, "
                  + "ReceiptTypeCode,ReceiptTypeName,ItemTypeCode,ItemTypeName,ReceiptAmount,Performance,PerformanceType,SalesType) "
                  + " values ( "
                  + row["ID"].ToString()
                  + "," + row["SettleID"].ToString()
                  + "," + salesID
                  + ",'" + salesName + "'"
                  + "," + deptID
                  + ",'" + row["ReceiptDate"].ToString() + "'"
                  + "," + (int)recType
                  + ",'" + recType + "'"
                  + "," + row["ItemTypeCode"].ToString()
                  + ",'" + row["ItemTypeName"].ToString() + "'"
                  + "," + row["RecSettleTotal"].ToString()
                  + "," + performance
                  + "," + (int)type
                  + ",'员工'"
                  + ")";

            SqlHelper.ExecuteNonQuery(sql);
        }
Esempio n. 20
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="subscribeSalesID"></param>
        /// <param name="salesID"></param>
        /// <returns></returns>
        private PerformanceType GetSalesPerformanceType(string subscribeSalesID, string salesID)
        {
            PerformanceType result = PerformanceType.own; //默认为同一人

            if (!subscribeSalesID.Equals(salesID))
            {
                string sql = "select SalesID from sales where SalesID = " + subscribeSalesID + " and OutDate is null";

                if (SqlHelper.ExecuteScalar(sql) == null)
                {
                    result = PerformanceType.allot;  //认购离职,分配
                }
                else
                {
                    result = PerformanceType.hold;  //认购在职,调岗
                }
            }

            return(result);
        }
Esempio n. 21
0
        public void ClearPoints(PerformanceType performanceType)
        {
            switch (performanceType)
            {
            case PerformanceType.FrameRate:
                FramePoints.Clear();
                _frameIndex = 0;
                break;

            case PerformanceType.CPU_Usage:
                CpuPoints.Clear();
                _cpuIndex = 0;
                break;

            case PerformanceType.RAM_Usage:
                RamPoints.Clear();
                _ramIndex = 0;
                break;
            }
            CheckLength(performanceType);
        }
        private void DropLevel()
        {
            switch (SystemPerformanceType)
            {
            case PerformanceType.High:
                SystemPerformanceType = PerformanceType.Mid;
                break;

            case PerformanceType.Low:
                SystemPerformanceType = PerformanceType.Low;
                break;

            case PerformanceType.Mid:
                SystemPerformanceType = PerformanceType.Low;
                break;

            default:
                Debug.LogError("SystemPerformanceType set Error!");
                break;
            }
        }
Esempio n. 23
0
        public void AddPoint(double value, PerformanceType performanceType)
        {
            switch (performanceType)
            {
            case PerformanceType.FrameRate:

                FramePoints.Add(new DataPoint(_frameIndex, value));
                _frameIndex++;
                break;

            case PerformanceType.CPU_Usage:
                CpuPoints.Add(new DataPoint(_cpuIndex, value));
                _cpuIndex++;
                break;

            case PerformanceType.RAM_Usage:
                RamPoints.Add(new DataPoint(_ramIndex, value));
                _ramIndex++;
                break;
            }
            CheckLength(performanceType);
        }
Esempio n. 24
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                txtStartPeriod.Text = DateTime.Now.AddMonths(-1).ToShortDateString();
                txtEndPeriod.Text   = DateTime.Now.ToShortDateString();
            }

            DateTime StartP = Convert.ToDateTime(txtStartPeriod.Text);
            DateTime EndP   = Convert.ToDateTime(txtEndPeriod.Text);

            EndP = (EndP.CompareTo(DateTime.Now.Date) == 0 ? DateTime.Now : EndP);

            PerformanceType pt = PerformanceType.Processor;

            string charType = Page.Request.QueryString["chartType"];

            InitControls(charType, StartP, EndP);

            switch (charType)
            {
            case "Processor":
                pt = PerformanceType.Processor;
                break;

            case "Network":
                pt = PerformanceType.Network;
                break;

            case "Memory":
                pt = PerformanceType.Memory;
                break;
            }

            LoadChartData(ChartCounter, pt, StartP, EndP);
        }
Esempio n. 25
0
        //主管业务统计
        private void MngPerformance(DataRow row, Receivables recType, string deptID, string recSalesID)
        {
            string sql       = string.Empty;
            string salesID   = string.Empty;
            string salesName = string.Empty;



            string recDate = row["ReceiptDate"].ToString();

            //主管ID
            sql = string.Format("select SalesID, SalesName from JobTrack where JobType = '主管' and DeptID = {0} and ((BeginDate <= '{1}' and EndDate > '{1}') or (BeginDate <= '{1}' and EndDate is null))", deptID, recDate);
            DataTable dtMng = SqlHelper.ExecuteDataTable(sql);

            foreach (DataRow dr in dtMng.Rows)
            {
                salesID   = dr["SalesID"].ToString();
                salesName = dr["SalesName"].ToString();


                if (salesID == recSalesID)
                {
                    continue; //主管与员工为同一人时,不计算主管业务
                }

                PerformanceType performanceType = PerformanceType.own;
                double          rate            = 100;

                sql = string.Format("select SalesID from JobTrack where DeptID = {0} and ((BeginDate <= '{1}' and EndDate > '{1}') or (BeginDate <= '{1}' and EndDate is null)) and SalesID = {2}", deptID, row["SubscribeDate"].ToString(), dr["SalesID"].ToString());

                object objResult = SqlHelper.ExecuteScalar(sql);
                if (objResult == null)                           //认购时间与任职期间不匹配,为分配业绩
                {
                    drRate          = dtRate.Select("Code = 1"); //allot
                    rate            = double.Parse(drRate[0]["Rate"].ToString());
                    performanceType = PerformanceType.allot;
                }


                string performance = Math.Round(double.Parse(row["RecSettleTotal"].ToString()) * rate / 100, 0, MidpointRounding.AwayFromZero).ToString();

                sql = "insert into PerformanceDetail (SettleDID,SettleID,SalesID,SalesName,DeptID,ReceiptDate, "
                      + "ReceiptTypeCode,ReceiptTypeName,ItemTypeCode,ItemTypeName,ReceiptAmount,Performance,PerformanceType, SalesType) "
                      + " values ( "
                      + row["ID"].ToString()
                      + "," + row["SettleID"].ToString()
                      + "," + salesID
                      + ",'" + salesName + "'"
                      + "," + deptID
                      + ",'" + row["ReceiptDate"].ToString() + "'"
                      + "," + (int)recType
                      + ",'" + recType + "'"
                      + "," + row["ItemTypeCode"].ToString()
                      + ",'" + row["ItemTypeName"].ToString() + "'"
                      + "," + row["RecSettleTotal"].ToString()
                      + "," + performance
                      + "," + (int)performanceType
                      + ",'主管'"
                      + ")";

                SqlHelper.ExecuteNonQuery(sql);
            }

            string parentDeptID = GetParentDeptID(deptID);

            if ((parentDeptID != "") && (parentDeptID != "0"))
            {
                MngPerformance(row, recType, parentDeptID, recSalesID);
            }
        }
Esempio n. 26
0
        private void Performance()
        {
            string settleId = dataGridView_SettleMain.CurrentRow.Cells["ColSettleID"].Value.ToString();
            string sql      = string.Format("select ID, SettleID, ContractID, ItemTypeCode, ItemTypeName, SubscribeDate, SubscribeSalesID,SubscribeSalesName, ReceiptDate, SalesID, SalesName, RecSettleTotal, FirstSettle from SettleDetail where SettleID = {0}", settleId);

            DataTable dtSettleDetail = SqlHelper.ExecuteDataTable(sql);

            foreach (DataRow drSettle in dtSettleDetail.Rows)
            {
                double rate = 0;

                if (drSettle["FirstSettle"].ToString().Equals("1")) //成销
                {
                    PerformanceType performanceType = GetSalesPerformanceType(drSettle["SubscribeSalesID"].ToString(), drSettle["SalesID"].ToString());

                    switch (performanceType)
                    {
                    case PerformanceType.own:      //个人
                        SalesPerformance(drSettle, Receivables.成销, 100, performanceType);
                        break;

                    case PerformanceType.allot:             //分配
                        drRate = dtRate.Select("Code = 1"); //allot
                        rate   = double.Parse(drRate[0]["Rate"].ToString());

                        SalesPerformance(drSettle, Receivables.成销, rate, performanceType);

                        break;

                    case PerformanceType.hold:              //调岗
                        drRate = dtRate.Select("Code = 2"); //hold

                        rate = double.Parse(drRate[0]["Rate"].ToString());

                        SalesPerformance(drSettle, Receivables.成销, rate, performanceType, true);


                        drRate = dtRate.Select("Code = 3");     //takeover

                        rate = double.Parse(drRate[0]["Rate"].ToString());

                        SalesPerformance(drSettle, Receivables.成销, rate, performanceType);

                        break;
                    }

                    string myid = drSettle["ID"].ToString();

                    Console.WriteLine("the ID: " + myid);

                    string deptID = GetDeptID(drSettle["SalesID"].ToString(), drSettle["ReceiptDate"].ToString());

                    MngPerformance(drSettle, Receivables.成销, deptID, drSettle["SalesID"].ToString());
                }
                else
                {
                    sql = string.Format("select a.ID, a.SettleID, ItemTypeCode, ItemTypeName, SubscribeDate, SubscribeSalesID,SubscribeSalesName,"
                                        + "b.SalesID, b.SalesName, RecDate as ReceiptDate, b.Amount as RecSettleTotal,TypeCode from SettleDetail a "
                                        + "inner join Receipt b on a.ContractID = b.ContractID and a.SettleID = b.SettleState "
                                        + "where a.ContractID = {0} and SettleState = {1}", drSettle["ContractID"].ToString(), settleId);

                    DataTable dtReceipt = SqlHelper.ExecuteDataTable(sql);

                    foreach (DataRow drReceipt in dtReceipt.Rows)
                    {
                        PerformanceType performanceType = GetSalesPerformanceType(drReceipt["SubscribeSalesID"].ToString(), drReceipt["SalesID"].ToString());

                        Receivables recType = (Receivables)int.Parse(drReceipt["TypeCode"].ToString());

                        switch (performanceType)
                        {
                        case PerformanceType.own:      //个人
                            SalesPerformance(drReceipt, recType, 100, performanceType);
                            break;

                        case PerformanceType.allot:             //分配
                            drRate = dtRate.Select("Code = 1"); //allot
                            rate   = double.Parse(drRate[0]["Rate"].ToString());

                            SalesPerformance(drReceipt, recType, rate, performanceType);

                            break;

                        case PerformanceType.hold:              //调岗
                            drRate = dtRate.Select("Code = 2"); //hold

                            rate = double.Parse(drRate[0]["Rate"].ToString());

                            SalesPerformance(drReceipt, recType, rate, performanceType, true);


                            drRate = dtRate.Select("Code = 3");     //takeover

                            rate = double.Parse(drRate[0]["Rate"].ToString());

                            SalesPerformance(drReceipt, recType, rate, performanceType);

                            break;
                        }

                        string deptID = GetDeptID(drReceipt["SalesID"].ToString(), drSettle["ReceiptDate"].ToString());

                        MngPerformance(drReceipt, recType, deptID, drReceipt["SalesID"].ToString());
                    }
                }
            }
        }
Esempio n. 27
0
		public List<Virtualization.PerformanceDataValue> GetPerfomanceValue(string VmName, PerformanceType perf, DateTime startPeriod, DateTime endPeriod)
		{
			List<Virtualization.PerformanceDataValue> ret = new List<Virtualization.PerformanceDataValue>();

			/* This test code */
			//Random random = new Random((int)DateTime.Now.Ticks);

			//TimeSpan count = (endPeriod - startPeriod);

			//for (int pointIndex = 0; pointIndex < 20; pointIndex++)
			//{
			//    ret.Add(new Virtualization.PerformanceDataValue() { SampleValue = random.Next(1, 99), TimeSampled = DateTime.Now });
			//}

			//return ret;


			using (WSPMonitoringServiceClient client = GetMonitoringServiceClient())
			{
				client.Open();

				PerformanceData[] pdOneVM = null;

				switch (perf)
				{
					case PerformanceType.Processor:
						pdOneVM = client.GetSingleVMHyperVCPUCounters(MonitoringServerNameSettings, VmName);
						break;
					case PerformanceType.Network:
						pdOneVM = client.GetSingleVMHyperVVirtualNetwork(MonitoringServerNameSettings, VmName);
						break;
					case PerformanceType.Memory:
						pdOneVM = client.GetSingleVMHyperVGuestMemoryPagesAllocated(MonitoringServerNameSettings, VmName);
						break;
					//case PerformanceType.DiskIO:
					//    break;

				}

				if ((pdOneVM != null) && (pdOneVM.Length > 0))
				{
					WebsitePanel.Providers.VirtualizationForPC.MonitoringWebService.PerformanceDataValue[] retData =
						client.GetMonitoringPerformanceValues(MonitoringServerNameSettings, pdOneVM[0], startPeriod, endPeriod);

					int index = 1;

					if (retData.Length > 100)
					{
						index = (int)Math.Ceiling(((double)retData.Length) / 100);
					}

					for (int i = 0; i < retData.Length; i = i + index)
					{
						WebsitePanel.Providers.VirtualizationForPC.MonitoringWebService.PerformanceDataValue curr = retData[i];

						ret.Add(new Virtualization.PerformanceDataValue()
						{
							SampleValue = curr.SampleValue
							,
							TimeAdded = curr.TimeAdded
							,
							TimeSampled = curr.TimeSampled
							,
							ExtensionData = curr.ExtensionData
						});
					}
				}

				client.Close();
			}

			return ret;

			/* This test code */
			//Random random = new Random((int)DateTime.Now.Ticks);

			//TimeSpan count = (endPeriod - startPeriod);

			//for (int pointIndex = 0; pointIndex < 20; pointIndex++)
			//{
			//    ret.Add(new Virtualization.PerformanceDataValue() { SampleValue = random.Next(1, 99) });
			//}

			//return ret;
		}
Esempio n. 28
0
 public async Task <bool> Delete(PerformanceType entity)
 {
     _db.PerformanceTypes.Remove(entity);
     return(await Save());
 }
		/// <remarks/>
		public void GetPerfomanceValueAsync(string VmName, PerformanceType perf, System.DateTime startPeriod, System.DateTime endPeriod)
		{
			this.GetPerfomanceValueAsync(VmName, perf, startPeriod, endPeriod, null);
		}
		/// <remarks/>
		public System.IAsyncResult BeginGetPerfomanceValue(string VmName, PerformanceType perf, System.DateTime startPeriod, System.DateTime endPeriod, System.AsyncCallback callback, object asyncState)
		{
			return this.BeginInvoke("GetPerfomanceValue", new object[] {
                        VmName,
                        perf,
                        startPeriod,
                        endPeriod}, callback, asyncState);
		}
		public PerformanceDataValue[] GetPerfomanceValue(string VmName, PerformanceType perf, System.DateTime startPeriod, System.DateTime endPeriod)
		{
			object[] results = this.Invoke("GetPerfomanceValue", new object[] {
                        VmName,
                        perf,
                        startPeriod,
                        endPeriod});
			return ((PerformanceDataValue[])(results[0]));
		}
 void Awake()
 {
     SystemPerformanceType = PerformanceType.High;
     mIsFirst = true;
 }
Esempio n. 33
0
 public Performance(string name, decimal basePrice, IVenue venue, DateTime startTime, PerformanceType type)
 {
     this.Name      = name;
     this.BasePrice = basePrice;
     this.Venue     = venue;
     this.ValidateVenue();
     this.StartTime = startTime;
     this.Type      = type;
     this.tickets   = new List <ITicket>();
 }
		/// <remarks/>
		public void GetPerfomanceValueAsync(string VmName, PerformanceType perf, System.DateTime startPeriod, System.DateTime endPeriod, object userState)
		{
			if ((this.GetPerfomanceValueOperationCompleted == null))
			{
				this.GetPerfomanceValueOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetPerfomanceValueOperationCompleted);
			}
			this.InvokeAsync("GetPerfomanceValue", new object[] {
                        VmName,
                        perf,
                        startPeriod,
                        endPeriod}, this.GetPerfomanceValueOperationCompleted, userState);
		}
Esempio n. 35
0
 public PerformanceDataValue[] GetPerfomanceValue(int ItemID, PerformanceType perf, DateTime startPeriod, DateTime endPeriod)
 {
     return(VirtualizationServerControllerForPrivateCloud.GetPerfomanceValue(ItemID, perf, startPeriod, endPeriod));
 }
 public PerformanceDataValue[] GetPerfomanceValue(int ItemID, PerformanceType perf, DateTime startPeriod, DateTime endPeriod)
 {
     object[] results = this.Invoke("GetPerfomanceValue", new object[] {
                 ItemID, perf, startPeriod, endPeriod});
     return ((PerformanceDataValue[])(results[0]));
 }
Esempio n. 37
0
 public async Task <bool> Update(PerformanceType entity)
 {
     _db.PerformanceTypes.Update(entity);
     return(await Save());
 }
 public PerformanceAspect(Type loggerServiceType, Type loggerProcessType)
 {
     _loggerServiceType = loggerServiceType;
     _loggerProcessType = loggerProcessType;
     _performanceType   = PerformanceType.Info;
 }
        /// <summary>
        /// Get performance date for selected VM
        /// </summary>
        /// <param name="ItemID"></param>
        /// <param name="perf"></param>
        /// <param name="startPeriod"></param>
        /// <param name="endPeriod"></param>
        /// <returns></returns>
        public static PerformanceDataValue[] GetPerfomanceValue(int ItemID, PerformanceType perf, DateTime startPeriod, DateTime endPeriod)
        {
            PerformanceDataValue[] ret;
            // Get required info about selected VM by ItemID
            try
            {
                ServiceProviderItem serviceProviderItem = PackageController.GetPackageItem(ItemID);
                ServiceInfo serviceInfo = ServerController.GetServiceInfo(serviceProviderItem.ServiceId);

                var vs = GetVirtualizationProxy(serviceProviderItem.ServiceId);

                ret = vs.GetPerfomanceValue(serviceProviderItem.Name, perf, startPeriod, endPeriod);
            }
            catch (Exception ex)
            {
                ret = null;
            }
            return ret;
        }
Esempio n. 40
0
 /// <summary>
 ///     Performance Constructor, starting a new Stopwatch.
 /// </summary>
 public Performance(PerformanceType performanceType, [CallerMemberName] string memberName = "")
 {
     this.memberName      = memberName;
     this.performanceType = performanceType;
     stopwatch            = Stopwatch.StartNew();
 }
 public PerformanceDataValue[] GetPerfomanceValue(int ItemID, PerformanceType perf, DateTime startPeriod, DateTime endPeriod)
 {
     return VirtualizationServerControllerForPrivateCloud.GetPerfomanceValue(ItemID, perf, startPeriod, endPeriod);
 }
 public List<PerformanceDataValue> GetPerfomanceValue(string VmName, PerformanceType perf, DateTime startPeriod, DateTime endPeriod)
 {
     try
     {
         Log.WriteStart("'{0}' GetPerfomanceValue", ProviderSettings.ProviderName);
         List<PerformanceDataValue> result = VirtualizationForPC.GetPerfomanceValue(VmName, perf, startPeriod, endPeriod);
         Log.WriteEnd("'{0}' GetPerfomanceValue", ProviderSettings.ProviderName);
         return result;
     }
     catch (Exception ex)
     {
         Log.WriteError(String.Format("'{0}' GetPerfomanceValue", ProviderSettings.ProviderName), ex);
         throw;
     }
 }