private void GetPerformanceMetrics(ref PropertyDescriptorCollection props,
                                           object item,
                                           ref CUTS.PerformanceTimes perf)
        {
            if (this.data_event_count_ == null)
            {
                throw new Exception("DataEventCount property not defined.");
            }
            perf.Count = long.Parse(this.GetDataValue(ref props, item, this.data_event_count_));

            if (this.data_best_time_ == null)
            {
                throw new Exception("DataBestTime property not defined.");
            }
            perf.Minimum = long.Parse(this.GetDataValue(ref props, item, this.data_best_time_));

            if (this.data_avg_time_ == null)
            {
                throw new Exception("DataAvgTime property not defined.");
            }
            perf.Average = double.Parse(this.GetDataValue(ref props, item, this.data_avg_time_));

            if (this.data_worst_time_ == null)
            {
                throw new Exception("DataWorstTime property not defined.");
            }
            perf.Maximum = long.Parse(this.GetDataValue(ref props, item, this.data_worst_time_));
        }
        private void CreateControlHeirarchy(bool useviewstate)
        {
            IEnumerable datasrc = this.GetDataSource();

            if (datasrc != null)
            {
                CUTS.ComponentPerformanceGrid     grid     = null;
                CUTS.ComponentPerformanceCategory category = null;
                CUTS.CumulativePortPerformance    inport   = null;

                foreach (object item in datasrc)
                {
                    PropertyDescriptorCollection props = TypeDescriptor.GetProperties(item);

                    if (this.data_component_name_ == null)
                    {
                        throw new Exception("DataComponentName property not defined.");
                    }

                    string value = this.GetDataValue(ref props, item, this.data_component_name_);
                    grid = this.FindComponentPerformanceGrid(value);

                    // Create the control for the category of the component. We do
                    // not have to check if the category is for the component since
                    // the grid will be correct.
                    if (this.data_category_name_ == null)
                    {
                        throw new Exception("DataCategoryName property not defined.");
                    }

                    value    = this.GetDataValue(ref props, item, this.data_category_name_);
                    category = grid.FindCategory(value);

                    // Before we can continue reading the metrics, we need to get
                    // the metric's type. This is either 'queue' or 'process'.
                    if (this.data_metric_type_ == null)
                    {
                        throw new Exception("DataMetricType property not defined.");
                    }

                    string metric_type = this.GetDataValue(ref props, item, this.data_metric_type_);

                    if (metric_type != "process" && metric_type != "queue")
                    {
                        throw new Exception("DataMetricType must have value 'queue' or 'process'");
                    }

                    // We have now moved onto the inputs for the component. This
                    // is determined by the source name.
                    if (this.data_src_name_ == null)
                    {
                        throw new Exception("DataSrcName property not defined.");
                    }

                    value  = this.GetDataValue(ref props, item, this.data_src_name_);
                    inport = category.FindCumulativePortPerformance(value);

                    // Ok, let's get the performance metrics for this item. We can
                    // do this because regardless of what metrics we are processing,
                    // they will all have the following performance metrics.
                    CUTS.PerformanceTimes perf = new CUTS.PerformanceTimes();
                    this.GetPerformanceMetrics(ref props, item, ref perf);

                    if (metric_type == "process")
                    {
                        // We have now moved onto the exit points for the input. This
                        // is determined by the destination name.
                        if (this.data_dst_name_ == null)
                        {
                            throw new Exception("DataDstName property not defined.");
                        }

                        value = this.GetDataValue(ref props, item, this.data_dst_name_);

                        if (value != String.Empty)
                        {
                            String url =
                                String.Format("t={0}&c={1}&m={2}&src={3}&dst={4}",
                                              this.GetDataValue(ref props, item, this.data_test_number_),
                                              this.GetDataValue(ref props, item, this.data_component_id_),
                                              metric_type,
                                              this.GetDataValue(ref props, item, this.data_src_id_),
                                              this.GetDataValue(ref props, item, this.data_dst_id_));

                            // Set the values of the exit point.
                            CUTS.CumulativeExitPoint ep = new CumulativeExitPoint();

                            ep.Name             = value;
                            ep.Performance      = perf;
                            ep.TimelineURLQuery = url;

                            // Insert the exit point in the exit times.
                            inport.InsertExitPoint(ep);
                        }
                        else
                        {
                            String url =
                                String.Format("t={0}&c={1}&m={2}&src={3}",
                                              this.GetDataValue(ref props, item, this.data_test_number_),
                                              this.GetDataValue(ref props, item, this.data_component_id_),
                                              metric_type,
                                              this.GetDataValue(ref props, item, this.data_src_id_));

                            // Save the performance metric in the service time.
                            inport.ServiceTime             = perf;
                            inport.ServiceTimelineURLQuery = url;
                        }
                    }
                    else
                    {
                        String url =
                            String.Format("t={0}&c={1}&m={2}&src={3}",
                                          this.GetDataValue(ref props, item, this.data_test_number_),
                                          this.GetDataValue(ref props, item, this.data_component_id_),
                                          metric_type,
                                          this.GetDataValue(ref props, item, this.data_src_id_));

                        // Save the performance metric in the queuing time.
                        inport.QueuingTime = perf;
                        inport.QueueingTimelineURLQuery = url;
                    }
                }
            }
        }
Esempio n. 3
0
        private void CreateControlHeirarchy(bool useviewstate)
        {
            // Get an interface pointer to the execution times and baseline
            // tables provided via the datasource.
            IEnumerable execution = this.GetDataSource(this.data_member_);
            IEnumerable baseline  = null;

            if (this.data_member_baseline_ != null)
            {
                baseline = this.GetDataSource(this.data_member_baseline_);
            }

            if (execution != null)
            {
                CUTS.ComponentPerformanceGrid     grid     = null;
                CUTS.ComponentPerformanceCategory category = null;
                CUTS.PortPerformance inport = null;

                foreach (object item in execution)
                {
                    PropertyDescriptorCollection props = TypeDescriptor.GetProperties(item);

                    if (this.data_component_name_ == null)
                    {
                        throw new Exception("DataComponentName property not defined.");
                    }

                    string value = this.GetDataValue(ref props, item, this.data_component_name_);
                    grid = this.FindComponentPerformanceGrid(value);

                    // Create the control for the category of the component. We do
                    // not have to check if the category is for the component since
                    // the grid will be correct.
                    if (this.data_category_name_ == null)
                    {
                        throw new Exception("DataCategoryName property not defined.");
                    }

                    value    = this.GetDataValue(ref props, item, this.data_category_name_);
                    category = grid.FindCategory(value);

                    if (this.category_heading_ != null)
                    {
                        category.CategoryName = this.category_heading_;
                    }

                    // Before we can continue reading the metrics, we need to get
                    // the metric's type. This is either 'queue' or 'process'.
                    if (this.data_metric_type_ == null)
                    {
                        throw new Exception("DataMetricType property not defined.");
                    }

                    string metric_type = this.GetDataValue(ref props, item, this.data_metric_type_);

                    if (metric_type != "process" && metric_type != "queue")
                    {
                        throw new Exception("DataMetricType must have value 'queue' or 'process'");
                    }

                    string hostname = string.Empty;

                    if (this.data_member_baseline_ != null)
                    {
                        if (this.data_hostname_ == null)
                        {
                            throw new Exception("DataHostname property not defined");
                        }

                        hostname = this.GetDataValue(ref props, item, this.data_hostname_);
                    }

                    // We have now moved onto the inputs for the component. This
                    // is determined by the source name.
                    if (this.data_src_name_ == null)
                    {
                        throw new Exception("DataSrcName property not defined.");
                    }

                    value  = this.GetDataValue(ref props, item, this.data_src_name_);
                    inport = category.FindPortPerformance(value);

                    // Ok, let's get the performance metrics for this item. We can
                    // do this because regardless of what metrics we are processing,
                    // they will all have the following performance metrics.
                    CUTS.PerformanceTimes perf = new CUTS.PerformanceTimes();
                    this.GetPerformanceMetrics(ref props, item, ref perf);

                    if (metric_type == "process")
                    {
                        //// We have now moved onto the exit points for the input. This
                        //// is determined by the destination name.
                        //if (this.data_dst_name_ == null)
                        //  throw new Exception("DataDstName property not defined.");

                        //value = this.GetDataValue(ref props, item, this.data_dst_name_);

                        // Locate baseline metrics for the current performance metrics. This
                        // can be the overall queue/process time, or the exit point times.
                        CUTS.PerformanceTimes perf_baseline = null;

                        if (baseline != null)
                        {
                            this.GetBaselineMetrics(baseline,
                                                    hostname,
                                                    grid.Title,
                                                    metric_type,
                                                    inport.PortName,
                                                    value,
                                                    out perf_baseline);
                        }

                        //if (value != String.Empty)
                        //{
                        //  CUTS.ExitPoint ep = new ExitPoint();

                        //  // Set the values of the exit point. This includes the
                        //  // current observed time and the baseline time.
                        //  ep.Name = value;
                        //  ep.Performance = perf;

                        //  if (baseline != null)
                        //    ep.BaselinePerformance = perf_baseline;

                        //  // Insert the exit point in the exit times.
                        //  inport.InsertExitPoint(ep);
                        //}
                        //else
                        {
                            // Save the performance metric in the service time.
                            inport.ServiceTime = perf;

                            if (baseline != null)
                            {
                                inport.ServiceTimeBaseline = perf_baseline;
                            }
                        }
                    }
                    else
                    {
                        // Check to see if there are baseline metrics for the
                        // queueing time for this port.
                        CUTS.PerformanceTimes perf_baseline = null;

                        if (baseline == null)
                        {
                            this.GetBaselineMetrics(baseline,
                                                    hostname,
                                                    grid.Title,
                                                    metric_type,
                                                    inport.PortName,
                                                    null,
                                                    out perf_baseline);
                        }

                        // Save the performance metric in the queuing time.
                        inport.QueuingTime = perf;

                        if (baseline != null)
                        {
                            inport.QueuingTimeBaseline = perf_baseline;
                        }
                    }
                }
            }
        }
Esempio n. 4
0
        /**
         * Locates the baseline metrics for the component in the collection
         * of provided items.
         */
        private void GetBaselineMetrics(IEnumerable baseline,
                                        string hostname,
                                        string instance,
                                        string metric_type,
                                        string srcname,
                                        string dstname,
                                        out CUTS.PerformanceTimes perf)
        {
            if (baseline != null)
            {
                foreach (object item in baseline)
                {
                    // Get the properties for this item.
                    PropertyDescriptorCollection props = TypeDescriptor.GetProperties(item);

                    // Check the hostname of the item.
                    string value = this.GetDataValue(ref props, item, this.data_hostname_baseline_);
                    if (value != hostname)
                    {
                        continue;
                    }

                    // Check the instance name of the item.
                    value = this.GetDataValue(ref props, item, this.data_component_name_baseline_);
                    if (value != instance)
                    {
                        continue;
                    }

                    // Check the metric type of the item.
                    value = this.GetDataValue(ref props, item, this.data_metric_type_baseline_);
                    if (value != metric_type)
                    {
                        continue;
                    }

                    // Check the source name of the item.
                    value = this.GetDataValue(ref props, item, this.data_src_name_baseline_);
                    if (value != srcname)
                    {
                        continue;
                    }

                    // Check the destination name of the item.
                    value = this.GetDataValue(ref props, item, this.data_dst_name_baseline_);
                    if (value != dstname)
                    {
                        continue;
                    }

                    // Yes, we actually found the baseline metric for this instance.
                    // We can now get the baseline performance metrics.
                    perf = new CUTS.PerformanceTimes();
                    this.GetPerformanceMetricsBaseline(ref props, item, ref perf);
                    return;
                }
            }

            // By default, if we reach this point then we didn't find
            // baseline metrics for the specified component.
            perf = null;
        }
Esempio n. 5
0
        public void InsertExitPoint(CUTS.ExitPoint ep)
        {
            if (!this.exittime_row_.Visible)
            {
                this.exittime_row_.Visible = true;
            }

            // Create a new row for the exit point.
            this.exittimes_.Add(ep);
            TableRow row = new TableRow();

            CUTS.PerformanceTimes percentage_error = ep.PercentageError();

            // Create the cell that contains the name.
            TableCell cell = new TableCell();

            cell.Text     = ep.Name + ":";
            cell.CssClass = "performance-name";
            row.Cells.Add(cell);

            // Create cells for each of the performance metrics.
            cell          = new TableCell();
            cell.Text     = ep.Performance.Count.ToString();
            cell.CssClass = "performance-data-count";
            row.Cells.Add(cell);

            // Create new cell to contain the min performance metric.
            cell          = new TableCell();
            cell.CssClass = "performance-data";
            cell.Text     = ep.Performance.Minimum.ToString();

            if (percentage_error != null)
            {
                cell.Text += " [" + Math.Round(percentage_error.Minimum, 2) + "%]";
            }

            row.Cells.Add(cell);

            // Create new cell to contain the average performance metric.
            cell          = new TableCell();
            cell.CssClass = "performance-data";
            cell.Text     = Math.Round(ep.Performance.Average, 2).ToString();

            if (percentage_error != null)
            {
                cell.Text += " [" + Math.Round(percentage_error.Average, 2) + "%]";
            }

            row.Cells.Add(cell);

            // Create new cell to contain the maximum performance metric.
            cell          = new TableCell();
            cell.CssClass = "performance-data";
            cell.Text     = ep.Performance.Maximum.ToString();

            if (percentage_error != null)
            {
                cell.Text += " [" + Math.Round(percentage_error.Maximum, 2) + "%]";
            }

            row.Cells.Add(cell);

            // Add the new row to the table.
            this.portperf_table_.Rows.Add(row);
        }