neth        01/09/13 07:46:52

  Modified:    src/org/apache/jmeter/visualizers GraphAccum.java
  Log:
  Remove some debugging code.
  
  Revision  Changes    Path
  1.3       +133 -132  jakarta-jmeter/src/org/apache/jmeter/visualizers/GraphAccum.java
  
  Index: GraphAccum.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jmeter/src/org/apache/jmeter/visualizers/GraphAccum.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- GraphAccum.java   2001/08/31 00:46:45     1.2
  +++ GraphAccum.java   2001/09/13 14:46:52     1.3
  @@ -86,7 +86,10 @@
        protected boolean noLegendYet = true;   // ensure that the legends are only
                                                                // drawn once
        protected Point[] previousPts;          // keep track of previous point
  -             protected boolean previousPtsAlloc = false;
  +                                                             // needed to draw a 
line joining 
  +                                                             // the previous point 
with the current
  +                                                             // one
  +      protected boolean previousPtsAlloc = false;            
                                                                // Ensure that 
previousPts is allocated
                                                                // once only.  It'll 
be reused at each
                                                                // drawSample.  It 
can't be allocated
  @@ -240,174 +243,172 @@
                        // components
         int compCount = 0;     // number of components
   
  -      ArrayList resultList =
  +     ArrayList resultList = 
                (ArrayList)oneSample.getValue(HTTPSamplerFull.RESULT_LIST);
  -      // allocate previousPts only the first time
  -      int resultListCount = 0;
  -      if(!previousPtsAlloc)
  -      {
  +     // allocate previousPts only the first time
  +     int resultListCount = 0;
  +     if(!previousPtsAlloc)
  +     {
                if(resultList != null)
                {
  -               resultListCount += resultList.size();
  +                     resultListCount += resultList.size();
                }
  -catClass.debug("resultListCount : " + resultListCount);
                previousPts = new Point[resultListCount+2];
  -      }
  +     }
   
  -      Color currColor = Color.black;
  -      JPanel lPanel = (JPanel)visualizer.getWhiteCanvas();
  -      JPanel legendPanel = new JPanel();
  -      GridBagLayout gridBag = new GridBagLayout();
  -      GridBagConstraints gbc = new GridBagConstraints();
  -      legendPanel.setLayout(gridBag);
  -      lPanel.add(legendPanel);
  -      Dimension d = this.getSize();
  -      // set the total time to load the sample
  -      long totalTime = oneSample.getTime();
  -      // if the page has other components then set the total time to be that 
including
  -      // all its components' load time
  -      Long dataLong = (Long)oneSample.getValue(HTTPSamplerFull.TOTAL_TIME);
  -      if(dataLong != null)
  -      {
  +     Color currColor = Color.black;
  +     JPanel lPanel = (JPanel)visualizer.getWhiteCanvas();
  +     JPanel legendPanel = new JPanel();
  +     GridBagLayout gridBag = new GridBagLayout();
  +     GridBagConstraints gbc = new GridBagConstraints();
  +     legendPanel.setLayout(gridBag);
  +     lPanel.add(legendPanel);
  +     Dimension d = this.getSize();
  +     // set the total time to load the sample
  +     long totalTime = oneSample.getTime();
  +     // if the page has other components then set the total time to be that 
including
  +     // all its components' load time
  +     Long dataLong = (Long)oneSample.getValue(HTTPSamplerFull.TOTAL_TIME);
  +     if(dataLong != null)
  +     {
                totalTime = dataLong.longValue();
  -      }
  -      if(catClass.isDebugEnabled())
  -      {
  +     }
  +     if(catClass.isDebugEnabled())
  +     {
                catClass.debug("drawSample1 : total time - " + totalTime);
  -      }
  -      int data = (int)(totalTime * d.height / model.getMax());
  -      g.setColor(currColor);
  -catClass.debug("noLegendYet : " + noLegendYet);
  -catClass.debug("!!!! : " + previousPts[0]);
  -      if(!previousPtsAlloc)
  -      {
  -catClass.debug("In here!!!!!");
  +     }
  +     int data = (int)(totalTime * d.height / model.getMax());
  +     g.setColor(currColor);
  +     if(!previousPtsAlloc)
  +     {
                // if first dot, just draw the point
                g.drawLine(x%width, d.height - data, x%width, d.height-data-1);
  -      }
  -      else
  -      {
  -catClass.debug("Out here!!!!!");
  +     }
  +     else
  +     {
                // otherwise, draw from previous point
  -             g.drawLine((previousPts[0].x)%width, previousPts[0].y, x%width, 
d.height - data);
  -      }
  -      // store current total time point
  -      previousPts[0] = new Point(x%width, d.height - data);
  -      if(legendPanel != null && noLegendYet)
  -      {
  +             g.drawLine((previousPts[0].x)%width, previousPts[0].y, x%width, 
  +                     d.height - data);
  +     }
  +     // store current total time point
  +     previousPts[0] = new Point(x%width, d.height - data);
  +     if(legendPanel != null && noLegendYet)
  +     {
                gbc.gridx = 0;
                gbc.gridy = compCount++;
                gbc.anchor = GridBagConstraints.WEST;
                gbc.weightx = 1.0;
  -             gbc.insets = new Insets(0, 10, 0, 0);
  +             gbc.insets = new Insets(0, 10, 0, 0);  
                JLabel totalTimeLabel = new JLabel("Total time - " + 
oneSample.toString());
                totalTimeLabel.setForeground(currColor);
                gridBag.setConstraints(totalTimeLabel, gbc);
                legendPanel.add(totalTimeLabel);
  -      }
  -      // plot the time of the page itself without all its components
  -      if(catClass.isDebugEnabled())
  -      {
  +     }
  +     // plot the time of the page itself without all its components
  +     if(catClass.isDebugEnabled())
  +     {
                catClass.debug("drawSample1 : main page load time - "
  -               + oneSample.getTime());
  -      }
  -      data = (int)(oneSample.getTime()
  +                     + oneSample.getTime());
  +     }
  +     data = (int)(oneSample.getTime()
                * d.height / model.getMax());
  -      currColor = ColorHelper.changeColorCyclicIncrement(currColor, 40);
  -      g.setColor(currColor);
  -      if(!previousPtsAlloc)
  -      {
  +     currColor = ColorHelper.changeColorCyclicIncrement(currColor, 40);
  +     g.setColor(currColor);
  +     if(!previousPtsAlloc)
  +     {
                // if first dot, just draw the point
                g.drawLine(x%width, d.height - data, x%width, d.height-data-1);
  -      }
  -      else
  -      {
  +     }
  +     else
  +     {
                // otherwise, draw from previous point
  -             g.drawLine((previousPts[1].x)%width, previousPts[1].y, x%width, 
d.height - data);
  -      }
  -      // store load time without components
  -      previousPts[1] = new Point(x%width, d.height - data);
  -      if(legendPanel != null && noLegendYet)
  -      {
  +           g.drawLine((previousPts[1].x)%width, previousPts[1].y, x%width,
  +                     d.height - data);
  +     }
  +     // store load time without components
  +     previousPts[1] = new Point(x%width, d.height - data);
  +     if(legendPanel != null && noLegendYet)
  +     {
                gbc.gridx = 0;
                gbc.gridy = compCount++;
                gbc.anchor = GridBagConstraints.WEST;
                gbc.weightx = 1.0;
  -             gbc.insets = new Insets(0, 10, 0, 0);
  +             gbc.insets = new Insets(0, 10, 0, 0);  
                JLabel mainTimeLabel = new JLabel(oneSample.toString());
                mainTimeLabel.setForeground(currColor);
                gridBag.setConstraints(mainTimeLabel, gbc);
                legendPanel.add(mainTimeLabel);
  -      }
  -      lastLevel += data;
  -      // plot the times of the total times components
  -      int currPreviousPts = 2;
  -      if(resultList != null)
  -      {
  +     }
  +     lastLevel += data;
  +     // plot the times of the total times components
  +     int currPreviousPts = 2;
  +     if(resultList != null)
  +     {
                Iterator iter = resultList.iterator();
                while(iter.hasNext())
                {
  -               SampleResult componentRes = (SampleResult)iter.next();
  -               if(catClass.isDebugEnabled())
  -               {
  -                      catClass.debug("drawSample1 : componentRes - " +
  -                             componentRes.toString() + " loading time - " +
  -                             componentRes.getTime());
  -               }
  -               data = (int)(componentRes.getTime()
  -                      * d.height / model.getMax());
  -               data += lastLevel;
  -               currColor = ColorHelper.changeColorCyclicIncrement(currColor, 100);
  -               g.setColor(currColor);
  -               if(!previousPtsAlloc)
  -               {
  -                      // if first dot, just draw the point
  -                      g.drawLine(x%width, d.height - data, x%width, 
d.height-data-1);
  -               }
  -               else
  -               {
  -                      // otherwise, draw from previous point
  -                      g.drawLine((previousPts[currPreviousPts].x)%width, 
previousPts[currPreviousPts].y, x%width, d.height - data);
  -               }
  -               // store the current plot
  -               previousPts[currPreviousPts++] = new Point(x%width, d.height - data);
  -               if(legendPanel != null && noLegendYet)
  -               {
  -                      gbc.gridx = 0;
  -                      gbc.gridy = compCount++;
  -                      gbc.anchor = GridBagConstraints.WEST;
  -                      gbc.weightx = 1.0;
  -                      gbc.insets = new Insets(0, 10, 0, 0);
  -                      JLabel compTimeLabel = new JLabel(componentRes.toString());
  -                      compTimeLabel.setForeground(currColor);
  -                      gridBag.setConstraints(compTimeLabel, gbc);
  -                      legendPanel.add(compTimeLabel);
  -               }
  -               lastLevel = data;
  +                     SampleResult componentRes = (SampleResult)iter.next();
  +                     if(catClass.isDebugEnabled())
  +                     {
  +                             catClass.debug("drawSample1 : componentRes - " + 
  +                                     componentRes.toString() + " loading time - " +
  +                                     componentRes.getTime());
  +                     }
  +                     data = (int)(componentRes.getTime()
  +                             * d.height / model.getMax());
  +                     data += lastLevel;
  +                     currColor = ColorHelper.changeColorCyclicIncrement(currColor, 
100);
  +                     g.setColor(currColor);
  +                     if(!previousPtsAlloc)
  +                     {
  +                             // if first dot, just draw the point
  +                             g.drawLine(x%width, d.height - data, x%width, 
d.height-data-1);
  +                     }
  +                     else
  +                     {
  +                             // otherwise, draw from previous point
  +                             g.drawLine((previousPts[currPreviousPts].x)%width, 
  +                                     previousPts[currPreviousPts].y, x%width, 
d.height - data);
  +                     }
  +                     // store the current plot
  +                     previousPts[currPreviousPts++] = new Point(x%width, d.height - 
data);
  +                     if(legendPanel != null && noLegendYet)
  +                     {
  +                             gbc.gridx = 0;
  +                             gbc.gridy = compCount++;
  +                             gbc.anchor = GridBagConstraints.WEST;
  +                             gbc.weightx = 1.0;
  +                             gbc.insets = new Insets(0, 10, 0, 0);  
  +                             JLabel compTimeLabel = new 
JLabel(componentRes.toString());
  +                             compTimeLabel.setForeground(currColor);
  +                             gridBag.setConstraints(compTimeLabel, gbc);
  +                             legendPanel.add(compTimeLabel);
  +                     }
  +                     lastLevel = data;
  +                     }
                }
  -      }
  -      if(noLegendYet)
  -      {
  -             noLegendYet = false;
  -             lPanel.repaint();
  -             lPanel.revalidate();
  -      }
  -      // set the previousPtsAlloc to true here and not after
  -      // allocation because the rest of the codes also depend
  -      // on previousPtsAlloc to be false if first time plotting
  -      // the graph i.e. there are no previous points
  -      if(!previousPtsAlloc)
  -      {
  -             previousPtsAlloc = true;
  -      }
  -      catClass.debug("End : drawSample1");
  -  }
  +             if(noLegendYet)
  +             {
  +                     noLegendYet = false;
  +                     lPanel.repaint();
  +                     lPanel.revalidate();
  +             }
  +             // set the previousPtsAlloc to true here and not after
  +             // allocation because the rest of the codes also depend
  +             // on previousPtsAlloc to be false if first time plotting
  +             // the graph i.e. there are no previous points
  +             if(!previousPtsAlloc)
  +             {
  +                     previousPtsAlloc = true;
  +             }
  +             catClass.debug("End : drawSample1");
  +     }
   
  -  /**
  -     * Description of the Method
  -     *
  -     * @param  g  Description of Parameter
  -     */
  +     /**
  +      * Description of the Method
  +      *
  +      * @param  g  Description of Parameter
  +      */
     public void paintComponent(Graphics g)
     {
         super.paintComponent(g);
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to