Beispiel #1
0
        public CUTS.ComponentPerformanceCategory FindCategory(string name)
        {
            foreach (CUTS.ComponentPerformanceCategory item in this.categories_.Controls)
            {
                if (item.Title == name)
                {
                    return(item);
                }
            }

            Control control = this.LoadControl("~/controls/ComponentPerformanceCategory.ascx");

            this.categories_.Controls.Add(control);

            CUTS.ComponentPerformanceCategory category = (CUTS.ComponentPerformanceCategory)control;
            category.Title = name;

            return(category);
        }
        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;
                    }
                }
            }
        }
Beispiel #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;
                        }
                    }
                }
            }
        }