Beispiel #1
0
        private void AddIndexStat(StatInfoItem statInfoItem)
        {
            foreach (var propertyInfo in statInfoItem.Item.GetType().GetProperties(BindingFlags.Instance | BindingFlags.Public))
            {
                if (propertyInfo.Name == "Name")
                {
                    statInfoItem.Title = propertyInfo.GetValue(statInfoItem.Item, null).ToString();
                    ViewOptions.Add(statInfoItem.Title);
                    continue;
                }

                if (propertyInfo.Name == "Performance")
                {
                    var performance = propertyInfo.GetValue(statInfoItem.Item, null) as IndexingPerformanceStats[];
                    if (performance == null || performance.Length == 0)
                    {
                        continue;
                    }

                    var performanceMessage = "";

                    foreach (var indexingPerformanceStats in performance)
                    {
                        performanceMessage += string.Format(@"
Operation:         {0}
Input:              {1:#,#}
Output:              {2:#,#}
Duration:          {3}
Duration in ms: {4:#,#}
", indexingPerformanceStats.Operation,
                                                            indexingPerformanceStats.InputCount,
                                                            indexingPerformanceStats.OutputCount,
                                                            indexingPerformanceStats.Duration,
                                                            indexingPerformanceStats.DurationMilliseconds);
                    }

                    statInfoItem.ItemData.Add("Performance", performanceMessage);

                    continue;
                }

                if (propertyInfo.GetValue(statInfoItem.Item, null) == null)
                {
                    continue;
                }

                int isZero;
                var isInt = int.TryParse(propertyInfo.GetValue(statInfoItem.Item, null).ToString(), out isZero);
                if (isInt && isZero == 0)
                {
                    continue;
                }

                statInfoItem.ItemData.Add(propertyInfo.Name, GetValueWithFormat(propertyInfo.GetValue(statInfoItem.Item, null)));
            }
        }
Beispiel #2
0
        private void UpdateStatistics()
        {
            StatsData = ApplicationModel.Database.Value.Statistics;
            Statistics.Clear();
            ViewOptions.Clear();
            ViewOptions.Add("All");
            ViewOptions.Add("Single Items");

            if (StatsData.Value == null)
            {
                Thread.Sleep(100);
                UpdateStatistics();
                return;
            }

            foreach (var propertyInfo in StatsData.Value.GetType().GetProperties(BindingFlags.Instance | BindingFlags.Public))
            {
                var enumerable = propertyInfo.GetValue(StatsData.Value, null) as IEnumerable <object>;

                if (enumerable != null)
                {
                    var list = enumerable as List <object> ?? enumerable.ToList();
                    if (list.Count == 0)
                    {
                        continue;
                    }

                    if ((list.First() is string == false) && (list.First() is IndexStats == false))
                    {
                        continue;
                    }

                    var statInfo = new StatInfo
                    {
                        IsList    = true,
                        ListItems = new List <StatInfoItem>(),
                    };

                    foreach (var item in list)
                    {
                        var statInfoItem = new StatInfoItem(item);

                        if (statInfoItem.ItemType == typeof(IndexStats))
                        {
                            AddIndexStat(statInfoItem);
                        }

                        statInfo.ListItems.Add(statInfoItem);
                    }

                    Statistics.Add(propertyInfo.Name, statInfo);
                    ViewOptions.Add(propertyInfo.Name);
                }
                else
                {
                    if (string.IsNullOrEmpty(propertyInfo.GetValue(StatsData.Value, null).ToString()) || propertyInfo.GetValue(StatsData.Value, null).ToString() == "0")
                    {
                        continue;
                    }

                    Statistics.Add(propertyInfo.Name, new StatInfo
                    {
                        Message = GetValueWithFormat(propertyInfo.GetValue(StatsData.Value, null))
                    });
                }
            }

            OnPropertyChanged(() => StatsData);
            UpdateView();
        }
Beispiel #3
0
		private void UpdateStatInfoFromGraphData(StatInfoItem statInfoItem)
		{
			foreach (var indexingPerformanceStats in IndexesGraphData[statInfoItem.Title].IndexData)
			{
				statInfoItem.IndexData.Add(indexingPerformanceStats.Started, indexingPerformanceStats);
			}

			foreach (var indexingPerformanceStats in IndexesGraphData[statInfoItem.Title].MapData)
			{
				statInfoItem.MapData.Add(indexingPerformanceStats.Started, indexingPerformanceStats);
			}

			foreach (var indexingPerformanceStats in IndexesGraphData[statInfoItem.Title].Level0Data)
			{
				statInfoItem.Level0Data.Add(indexingPerformanceStats.Started, indexingPerformanceStats);
			}

			foreach (var indexingPerformanceStats in IndexesGraphData[statInfoItem.Title].Level1Data)
			{
				statInfoItem.Level1Data.Add(indexingPerformanceStats.Started, indexingPerformanceStats);
			}

			foreach (var indexingPerformanceStats in IndexesGraphData[statInfoItem.Title].Level2Data)
			{
				statInfoItem.Level2Data.Add(indexingPerformanceStats.Started, indexingPerformanceStats);
			}
		}
Beispiel #4
0
		private void UpdateGraphDate(IEnumerable<IndexingPerformanceStats> performance, StatInfoItem statInfoItem)
		{
			if(IndexesGraphData.ContainsKey( statInfoItem.Title) == false)
				IndexesGraphData.Add(statInfoItem.Title, new PerformanceStats());

			foreach (var indexingPerformanceStat in performance)
			{
				switch (indexingPerformanceStat.Operation)
				{
					case "Index":
						if (IndexesGraphData[statInfoItem.Title].IndexData.Contains(indexingPerformanceStat) == false)
							IndexesGraphData[statInfoItem.Title].IndexData.Add(indexingPerformanceStat);
						break;
					case "Map":
						if (IndexesGraphData[statInfoItem.Title].MapData.Contains(indexingPerformanceStat) == false)
							IndexesGraphData[statInfoItem.Title].MapData.Add(indexingPerformanceStat);
						break;
					case "Reduce Level 0":
						if (IndexesGraphData[statInfoItem.Title].Level0Data.Contains(indexingPerformanceStat) == false)
							IndexesGraphData[statInfoItem.Title].Level0Data.Add(indexingPerformanceStat);
						break;
					case "Reduce Level 1":
						if (IndexesGraphData[statInfoItem.Title].Level1Data.Contains(indexingPerformanceStat) == false)
							IndexesGraphData[statInfoItem.Title].Level1Data.Add(indexingPerformanceStat);
						break;
					case "Reduce Level 2":
						if (IndexesGraphData[statInfoItem.Title].Level2Data.Contains(indexingPerformanceStat) == false)
							IndexesGraphData[statInfoItem.Title].Level2Data.Add(indexingPerformanceStat);
						break;
				}
			}

			UpdateStatInfoFromGraphData(statInfoItem);
		}
Beispiel #5
0
		private void AddIndexStat(StatInfoItem statInfoItem)
		{
			foreach (var propertyInfo in statInfoItem.Item.GetType().GetProperties(BindingFlags.Instance | BindingFlags.Public))
			{
				if (propertyInfo.Name == "Name")
				{
					statInfoItem.Title = propertyInfo.GetValue(statInfoItem.Item, null).ToString();
					ViewOptions.Add(statInfoItem.Title);
					continue;
				}

				if (propertyInfo.Name == "Performance")
				{
					var performance = propertyInfo.GetValue(statInfoItem.Item, null) as IndexingPerformanceStats[];
					if (performance == null || performance.Length == 0)
						continue;

					UpdateGraphDate(performance, statInfoItem);

					continue;
				}

				if (propertyInfo.GetValue(statInfoItem.Item, null) == null)
					continue;

				int isZero;
				var isInt = int.TryParse(propertyInfo.GetValue(statInfoItem.Item, null).ToString(), out isZero);
				if (isInt && isZero == 0)
					continue;

				statInfoItem.ItemData.Add(propertyInfo.Name, GetValueWithFormat(propertyInfo.GetValue(statInfoItem.Item, null)));
			}
		}
Beispiel #6
0
		private void UpdateStatistics()
		{
			StatsData = ApplicationModel.Database.Value.Statistics;
			Statistics.Clear();
			ViewOptions.Clear();
			ViewOptions.Add("All");
			ViewOptions.Add("Single Items");

			if (StatsData.Value == null)
			{
				Thread.Sleep(100);
				UpdateStatistics();
				return;
			}

			foreach (var propertyInfo in StatsData.Value.GetType().GetProperties(BindingFlags.Instance | BindingFlags.Public))
			{
				var enumerable = propertyInfo.GetValue(StatsData.Value, null) as IEnumerable<object>;

				if (enumerable != null)
				{
					var list = enumerable as List<object> ?? enumerable.ToList();
					if (list.Count == 0)
						continue;

					if ((list.First() is string == false) && (list.First() is IndexStats == false))
						continue;

					var statInfo = new StatInfo
					{
						IsList = true,
						ListItems = new List<StatInfoItem>(),
					};

					foreach (var item in list)
					{
						var statInfoItem = new StatInfoItem(item);

						if (statInfoItem.ItemType == typeof(IndexStats))
							AddIndexStat(statInfoItem);

						statInfo.ListItems.Add(statInfoItem);
					}

					Statistics.Add(propertyInfo.Name, statInfo);
					ViewOptions.Add(propertyInfo.Name);
				}
				else
				{
					if (string.IsNullOrEmpty(propertyInfo.GetValue(StatsData.Value, null).ToString()) || propertyInfo.GetValue(StatsData.Value, null).ToString() == "0")
						continue;

					Statistics.Add(propertyInfo.Name, new StatInfo
					{
						Message = GetValueWithFormat(propertyInfo.GetValue(StatsData.Value, null))
					});
				}
			}

			OnPropertyChanged(() => StatsData);
			UpdateView();
		}
Beispiel #7
0
		private void AddIndexStat(StatInfoItem statInfoItem)
		{
			foreach (var propertyInfo in statInfoItem.Item.GetType().GetProperties(BindingFlags.Instance | BindingFlags.Public))
			{
				if (propertyInfo.Name == "Name")
				{
					statInfoItem.Title = propertyInfo.GetValue(statInfoItem.Item, null).ToString();
					ViewOptions.Add(statInfoItem.Title);
					continue;
				}

				if (propertyInfo.Name == "Performance")
				{
					var performance = propertyInfo.GetValue(statInfoItem.Item, null) as IndexingPerformanceStats[];
					if (performance == null || performance.Length == 0)
						continue;

					var performanceMessage = "";

					foreach (var indexingPerformanceStats in performance)
					{
						performanceMessage += string.Format(@"
Operation:         {0}
Input:              {1:#,#}
Output:              {2:#,#}
Duration:          {3}
Duration in ms: {4:#,#}
", indexingPerformanceStats.Operation,
						                                    indexingPerformanceStats.InputCount,
						                                    indexingPerformanceStats.OutputCount,
						                                    indexingPerformanceStats.Duration,
						                                    indexingPerformanceStats.DurationMilliseconds);
					}

					statInfoItem.ItemData.Add("Performance", performanceMessage);

					continue;
				}

				if (propertyInfo.GetValue(statInfoItem.Item, null) == null)
					continue;

				int isZero;
				var isInt = int.TryParse(propertyInfo.GetValue(statInfoItem.Item, null).ToString(), out isZero);
				if (isInt && isZero == 0)
					continue;

				statInfoItem.ItemData.Add(propertyInfo.Name, GetValueWithFormat(propertyInfo.GetValue(statInfoItem.Item, null)));
			}
		}