/// <summary>
        /// Generate DataResults containing various information like average response time, number of users... from testResults
        /// </summary>
        public void CreateDataResults()
        {
            _dataResults = new List<RequestDataResults>();
            var query = _testResults.httpSample.GroupBy(x => x.lb);
            query.ToList().ForEach(group =>
                                          {
                                              var first = group.First();
                                              int firstCount = 90*group.Count()/100;
                                              int secondCount = 80*group.Count()/100;
                                              var filteredList = group.OrderBy(x => x.t)
                                                                        .Take(firstCount)
                                                                        .OrderByDescending(x => x.t)
                                                                        .Take(secondCount);
                                              if (!filteredList.Any())
                                                  filteredList = group;
                                              var requestDataResults = new RequestDataResults
                                                                           {
                                                                               AverageResponseTime = Math.Round(group.Average(x => x.t), 0),
                                                                               MinResponseTime = Math.Round(group.Min(x => x.t), 0),
                                                                               MaxResponseTime = Math.Round(group.Max(x => x.t), 0),
                                                                               Request = first.lb,
                                                                               Date = first.ts.ToDateTime(),
                                                                               UserCount = first.ng,
                                                                               HostName = first.hn,
                                                                               MinResponseTimeExcludingTopDecile = Math.Round(filteredList.Min(x => x.t), 0),
                                                                               MaxResponseTimeExcludingBottomDecile = Math.Round(filteredList.Max(x => x.t), 0),
                                                                               AverageResponseTimeExcludingTopAndBottomDeciles = Math.Round(filteredList.Average(x => x.t), 0),
                                                                               ResponseTimeDistribution = CalculateDistribution(group.ToList())

                                                                           };
                                              _dataResults.Add(requestDataResults);
                                          });
        }
示例#2
0
 /// <summary>
 /// Render text at the bottom of a bar
 /// </summary>
 /// <param name="gp"></param>
 /// <param name="d"></param>
 /// <param name="x"></param>
 protected override void RenderBarLabel(GraphPane gp, RequestDataResults d, float x)
 {
     var requestText = new TextObj(d.Request + "   -", x, 0).Style(Color.Black, 7);
     requestText.FontSpec.Angle = 25;
     requestText.Location.AlignH = AlignH.Right;
     gp.GraphObjList.Add(requestText);
 }
示例#3
0
 protected override void RenderBarLabel(GraphPane gp, RequestDataResults d, float x)
 {
     var dateText = new TextObj(d.Date.ToShortDateString() + "   .", x, 0);
     dateText.FontSpec.Fill.IsVisible = false;
     dateText.FontSpec.Border.IsVisible = false;
     dateText.FontSpec.FontColor = Color.Black;
     dateText.FontSpec.Size = 7;
     dateText.FontSpec.Angle = 45;
     dateText.Location.AlignH = AlignH.Right;
     gp.GraphObjList.Add(dateText);
 }
示例#4
0
        /// <summary>
        /// Render curve representing the distribution of response time
        /// </summary>
        /// <param name="gp"></param>
        /// <param name="dataResults"></param>
        /// <param name="index"></param>
        /// <param name="max"></param>
        protected virtual void RenderResponseTimeDistributionCurve(GraphPane gp, RequestDataResults dataResults, int index, int max)
        {
            if (dataResults.ResponseTimeDistribution != null && dataResults.ResponseTimeDistribution.Count() > 0)
            {
                int pivot = dataResults.ResponseTimeDistribution.Count()/2;
                var points = new PointPairList();

                float x = index;
                points.Add(x, dataResults.MinResponseTime);
                for (int i = 0; i <dataResults.ResponseTimeDistribution.Count(); i++)
                {
                    float offset;
                    if (i < pivot)
                    {
                        offset = 0.1f;
                    }
                    else
                    {
                        offset = -0.1f;
                    }
                    x += offset;
                    points.Add(new PointPair(x, Math.Min(dataResults.ResponseTimeDistribution[i], max)));
                }
                int factor = 40;
                for (int i = 0; i < dataResults.ResponseTimeDistribution.Count(); i++)
                {
                    var line = new LineObj(Color.FromArgb(100, factor, factor, factor), points[i].X, points[i].Y,
                                           points[i + 1].X, points[i + 1].Y);
                    line.Line.Width = 1;
                    gp.GraphObjList.Add(line);
                }
            }
        }
示例#5
0
 /// <summary>
 /// Render min/max line
 /// </summary>
 /// <param name="gp"></param>
 /// <param name="d"></param>
 /// <param name="x"></param>
 /// <param name="maxY"></param>
 protected virtual void RenderMinMaxLine(GraphPane gp, RequestDataResults d, int x, int maxY)
 {
     double max = Math.Min(maxY, d.MaxResponseTime);
     int factor = 60;
     var line = new LineObj(Color.FromArgb(75, factor, factor, factor), x, max, x, d.MinResponseTime);
     gp.GraphObjList.Add(line);
 }
示例#6
0
 /// <summary>
 /// Render min/max response time excluding the 10% fastest and 10% slowest requests
 /// </summary>
 /// <param name="gp"></param>
 /// <param name="d"></param>
 /// <param name="x"></param>
 /// <param name="maxY"></param>
 protected virtual void RenderMinMaxExcludingExtremesLine(GraphPane gp, RequestDataResults d, int x, int maxY)
 {
     double max = Math.Min(maxY, d.MaxResponseTimeExcludingBottomDecile);
      int factor = 60;
     var line = new LineObj(Color.FromArgb(75, factor, factor, factor), x, max, x, d.MinResponseTimeExcludingTopDecile);
     line.Line.Width = 3;
     gp.GraphObjList.Add(line);
 }
示例#7
0
 /// <summary>
 /// Render text at the bottom of a bar
 /// </summary>
 /// <param name="gp"></param>
 /// <param name="d"></param>
 /// <param name="x"></param>
 protected virtual void RenderBarLabel(GraphPane gp, RequestDataResults d, float x)
 {
     // Do nothing
 }
示例#8
0
 /// <summary>
 /// Render text inside bar
 /// </summary>
 /// <param name="gp"></param>
 /// <param name="d"></param>
 /// <param name="x"></param>
 protected virtual void RenderBarContent(GraphPane gp, RequestDataResults d, float x)
 {
     var avgResponseTimeText = new TextObj(d.AverageResponseTime.ToString(), x, d.AverageResponseTime / 2).Style(Color.White, 7);
     gp.GraphObjList.Add(avgResponseTimeText);
 }
示例#9
0
 /// <summary>
 /// Render average response time excluding the 10% fastest and 10% slowest requests
 /// </summary>
 /// <param name="gp"></param>
 /// <param name="d"></param>
 /// <param name="x"></param>
 protected virtual void RenderAverageLine(GraphPane gp, RequestDataResults d, int x)
 {
     int factor = 60;
     var line = new LineObj(Color.FromArgb(100, factor, factor, factor), x-0.3, d.AverageResponseTimeExcludingTopAndBottomDeciles, x+0.3, d.AverageResponseTimeExcludingTopAndBottomDeciles);
     line.Line.Width = 3;
     gp.GraphObjList.Add(line);
 }