Exemplo n.º 1
0
        public override void SelectIndicatorValues()
        {
            this.IndicatorValues.ClearOnUI();

            // Duration
            var durations = (from p in this.Indicators
                             where p.Name == "Duration"
                             from q in p.IndicatorValues
                             select q);

            this.Duration.BeginAddRange(DiagramHelper.filterDiagramValues(durations));
        }
        public override void SelectIndicatorValues()
        {
            this.Load.ClearOnUI();
            this.CapacityPerDrive.ClearOnUI();
            this.LoadPerDrive.ClearOnUI();

            try
            {
                // Capacity
                var capacity = (from p in this.Indicators
                                where p.Name == "Capacity"
                                from q in p.IndicatorValues
                                orderby q.Timestamp descending
                                select q).FirstOrDefault();
                if (capacity != null && !capacity.Value.ToString().Equals(""))
                {
                    this.Capacity = capacity.Value.ToString() + " MB";
                }
                else
                {
                    this.Capacity = " - ";
                }
            }
            catch (Exception)
            {
                Console.WriteLine("STORAGE VIS PLUGIN: Problem at getting Capacity");
                this.Capacity = " - ";
            }


            try
            {
                // Load
                var loads = (from p in this.Indicators
                             where p.Name == "Load"
                             from q in p.IndicatorValues
                             select q);

                ExtendedObservableCollection <IndicatorValue> filteredLoad = DiagramHelper.filterDiagramValues(loads);

                this.Load.BeginAddRange(filteredLoad);
            }
            catch (Exception)
            {
                Console.WriteLine("STORAGE VIS PLUGIN: Problem at getting Load");
            }


            try
            {
                // NumberOfDrives
                var numberOfDrives = (from p in this.Indicators
                                      where p.Name == "NumberOfDrives"
                                      from q in p.IndicatorValues
                                      orderby q.Timestamp descending
                                      select q).FirstOrDefault();
                if (numberOfDrives != null && !numberOfDrives.Value.ToString().Equals(""))
                {
                    this.NumberOfDrives = numberOfDrives.Value.ToString();
                }
                else
                {
                    this.NumberOfDrives = " - ";
                }
            }
            catch (Exception)
            {
                Console.WriteLine("STORAGE VIS PLUGIN: Problem at getting NumberOfDrives");
                this.NumberOfDrives = " - ";
            }

            try
            {
                // CapacityPerDrive
                var capacityPerDrive = (from p in this.Indicators
                                        where p.Name == "CapacityPerDrive"
                                        from q in p.IndicatorValues
                                        orderby q.Timestamp descending
                                        select q).FirstOrDefault();
                if (capacityPerDrive != null && !capacityPerDrive.Value.ToString().Equals(""))
                {
                    for (int i = 0; i < capacityPerDrive.Value.ToString().Split(';').Length; i++)
                    {
                        CapacityPerDrive.BeginAddOnUI(new IndicatorValue(Convert.ToInt32(capacityPerDrive.Value.ToString().Split(';')[i]), capacityPerDrive.DataType,
                                                                         capacityPerDrive.Timestamp, capacityPerDrive.MappingState));
                    }
                }
            }
            catch (Exception)
            {
                Console.WriteLine("STORAGE VIS PLUGIN: Problem at getting CapacityPerDrive");
            }

            try
            {
                // LoadPerDrive
                var loadPerDrive = (from p in this.Indicators
                                    where p.Name == "LoadPerDrive"
                                    from q in p.IndicatorValues
                                    orderby q.Timestamp descending
                                    select q).FirstOrDefault();
                if (loadPerDrive != null && !loadPerDrive.Value.ToString().Equals(""))
                {
                    for (int i = 0; i < loadPerDrive.Value.ToString().Split(';').Length; i++)
                    {
                        LoadPerDrive.BeginAddOnUI(new IndicatorValue(Convert.ToByte(loadPerDrive.Value.ToString().Split(';')[i]), loadPerDrive.DataType,
                                                                     DateTime.Now.AddDays(i), loadPerDrive.MappingState));
                    }
                }
            }
            catch (Exception)
            {
                Console.WriteLine("STORAGE VIS PLUGIN: Problem at getting LoadPerDrive");
            }
        }
Exemplo n.º 3
0
        public override void SelectIndicatorValues()
        {
            this.IndicatorValues.ClearOnUI();

            this.Temperature.ClearOnUI();
            this.TemperaturePerCore.ClearOnUI();

            this.Load.ClearOnUI();
            this.LoadPerCore.ClearOnUI();

            try
            {
                // Name
                var name = (from p in this.Indicators
                            where p.Name == "ProcessorName"
                            from q in p.IndicatorValues
                            orderby q.Timestamp descending
                            select q).FirstOrDefault();
                if (name != null)
                {
                    this.Name = name.Value as string;
                }
                else
                {
                    this.Name = " - ";
                }
            }
            catch (Exception)
            {
                Console.WriteLine("CPU VIS PLUGIN: Problem at getting ProcessorName");
                this.Name = " - ";
            }

            try
            {
                var temperatures = (from p in this.Indicators
                                    where p.Name == "Temperature"
                                    from q in p.IndicatorValues
                                    orderby q.Timestamp descending
                                    select new IndicatorValue(Convert.ToByte(q.Value), q.DataType, q.Timestamp, q.MappingState));
                ExtendedObservableCollection <IndicatorValue> filteredTemps = DiagramHelper.filterDiagramValues(temperatures);
                Temperature.BeginAddRange(filteredTemps);


                // this adds all values to the diagram, way too much for wpf toolkit diagrams
                // Temperature
                //this.Temperature.BeginAddRange(from p in this.Indicators
                //                               where p.Name == "Temperature"
                //                               from q in p.IndicatorValues
                //                               select new IndicatorValue(Convert.ToByte(q.Value), q.DataType, q.Timestamp, q.MappingState));
            }
            catch (Exception)
            {
                Console.WriteLine("CPU VIS PLUGIN: Problem at getting Temperature");
            }

            try
            {
                // Temperature Per Core
                var temperatures = from p in this.Indicators
                                   where p.Name == "TemperaturePerCore"
                                   from q in p.IndicatorValues
                                   select q;
                if (temperatures.Count() > 0)
                {
                    IndicatorValue first = null;
                    int            z     = 0;
                    while (first == null)
                    {
                        if (!temperatures.ElementAt(z).Value.ToString().Equals(""))
                        {
                            first = temperatures.ElementAt(z);
                        }
                        z++;
                    }

                    for (int i = 0; i < first.Value.ToString().Split(';').Length; i++)
                    {
                        ExtendedObservableCollection <IndicatorValue> rawValues = new ExtendedObservableCollection <IndicatorValue>();
                        ExtendedObservableCollection <IndicatorValue> filteredValues;

                        foreach (IndicatorValue tempValue in temperatures)
                        {
                            string[] temps = tempValue.Value.ToString().Split(';');
                            if (temps.Length > 0 && temps.Length == first.Value.ToString().Split(';').Length&& !temps[i].Equals(""))
                            {
                                rawValues.Add(new IndicatorValue(Convert.ToByte(temps[i]), tempValue.DataType, tempValue.Timestamp, tempValue.MappingState));
                            }
                        }
                        filteredValues = DiagramHelper.filterDiagramValues(rawValues);
                        this.TemperaturePerCore.BeginAddOnUI(filteredValues);
                    }
                }
            }
            catch (Exception)
            {
                Console.WriteLine("CPU VIS PLUGIN: Problem at getting TemperaturePerCore");
            }


            try
            {
                // Load
                var load = (from p in this.Indicators
                            where p.Name == "Load"
                            from q in p.IndicatorValues
                            select new IndicatorValue(Convert.ToByte(q.Value), q.DataType, q.Timestamp, q.MappingState));
                this.Load.BeginAddRange(DiagramHelper.filterDiagramValues(load));
            }
            catch (Exception)
            {
                Console.WriteLine("CPU VIS PLUGIN: Problem at getting Load");
            }

            try
            {
                // Load Per Core
                var loadValues = from p in this.Indicators
                                 where p.Name == "LoadPerCore"
                                 from q in p.IndicatorValues
                                 select q;

                if (loadValues.Count() > 0)
                {
                    IndicatorValue first = null;
                    int            z     = 0;
                    while (first == null)
                    {
                        if (!loadValues.ElementAt(z).Value.ToString().Equals(""))
                        {
                            first = loadValues.ElementAt(z);
                        }
                        z++;
                    }

                    for (int i = 0; i < first.Value.ToString().Split(';').Length; i++)
                    {
                        ExtendedObservableCollection <IndicatorValue> rawValues = new ExtendedObservableCollection <IndicatorValue>();
                        ExtendedObservableCollection <IndicatorValue> filteredValues;

                        foreach (IndicatorValue value in loadValues)
                        {
                            string[] loads = value.Value.ToString().Split(';');
                            if (loads.Length > 0 && loads.Length == (first.Value as string).Split(';').Length&& !loads[i].Equals(""))
                            {
                                rawValues.Add(new IndicatorValue(Convert.ToByte(loads[i]), value.DataType, value.Timestamp, value.MappingState));
                            }
                        }
                        filteredValues = DiagramHelper.filterDiagramValues(rawValues);
                        this.LoadPerCore.BeginAddOnUI(filteredValues);
                    }
                }
            }
            catch (Exception)
            {
                Console.WriteLine("CPU VIS PLUGIN: Problem at getting LoadPerCore");
            }
        }
Exemplo n.º 4
0
        public override void SelectIndicatorValues()
        {
            this.Load.ClearOnUI();
            this.SwapLoad.ClearOnUI();
            try
            {
                // Size
                var size = (from p in this.Indicators
                            where p.Name == "Size"
                            from q in p.IndicatorValues
                            orderby q.Timestamp descending
                            select q).FirstOrDefault();
                if (size != null && !size.Value.ToString().Equals(""))
                {
                    this.Size = size.Value.ToString() + " MB";
                }
                else
                {
                    this.Size = " - ";
                }
            }
            catch (Exception)
            {
                Console.WriteLine("RAM VIS PLUGIN: Problem at getting Size");
                this.Size = " - ";
            }

            try
            {
                // Load
                var loads = (from p in this.Indicators
                             where p.Name == "Load"
                             from q in p.IndicatorValues
                             select q);
                this.Load.BeginAddRange(DiagramHelper.filterDiagramValues(loads));
            }
            catch (Exception)
            {
                Console.WriteLine("RAM VIS PLUGIN: Problem at getting Load");
            }

            try
            {
                // SwapSize
                var swapSize = (from p in this.Indicators
                                where p.Name == "SwapSize"
                                from q in p.IndicatorValues
                                orderby q.Timestamp descending
                                select q).FirstOrDefault();
                if (swapSize != null && !swapSize.Value.ToString().Equals(""))
                {
                    this.SwapSize = swapSize.Value.ToString() + " MB";
                }
                else
                {
                    this.SwapSize = " - ";
                }
            }
            catch (Exception)
            {
                Console.WriteLine("RAM VIS PLUGIN: Problem at getting SwapSize");
                this.SwapSize = " - ";
            }

            try
            {
                // SwapLoad
                var swapLoads = (from p in this.Indicators
                                 where p.Name == "SwapLoad"
                                 from q in p.IndicatorValues
                                 select q);
                this.SwapLoad.BeginAddRange(DiagramHelper.filterDiagramValues(swapLoads));
            }
            catch (Exception)
            {
                Console.WriteLine("RAM VIS PLUGIN: Problem at getting SwapLoad");
            }
        }