jakarta-jmeter-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mstov...@apache.org
Subject cvs commit: jakarta-jmeter/src/org/apache/jmeter/visualizers FileVisualizer.java GraphModel.java SplineModel.java
Date Sun, 10 Jun 2001 02:15:50 GMT
mstover1    01/06/09 19:15:50

  Modified:    src/org/apache/jmeter/reporters Filer.java
                        ResultCollector.java
               src/org/apache/jmeter/save/handlers
                        AbstractConfigElementHandler.java
               src/org/apache/jmeter/timers ConstantTimer.java
                        RandomTimer.java Timer.java
               src/org/apache/jmeter/visualizers FileVisualizer.java
                        GraphModel.java SplineModel.java
  Log:
  Can save timers and listeners
  
  Revision  Changes    Path
  1.3       +6 -1      jakarta-jmeter/src/org/apache/jmeter/reporters/Filer.java
  
  Index: Filer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jmeter/src/org/apache/jmeter/reporters/Filer.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Filer.java	2001/03/17 22:25:54	1.2
  +++ Filer.java	2001/06/10 02:15:49	1.3
  @@ -142,7 +142,7 @@
   
   	public Class getTagHandlerClass()
   	{
  -		return null;
  +		return org.apache.jmeter.save.handlers.FilerHandler.class;
   	}
   
   	public void sampleStarted(SampleEvent e)
  @@ -214,6 +214,11 @@
   	}
   
   
  +	 }
  +
  +	 public String getFile()
  +	 {
  +		return file;
   	 }
   
   		  public void setFile(String file) {
  
  
  
  1.4       +7 -1      jakarta-jmeter/src/org/apache/jmeter/reporters/ResultCollector.java
  
  Index: ResultCollector.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jmeter/src/org/apache/jmeter/reporters/ResultCollector.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ResultCollector.java	2001/03/17 22:25:54	1.3
  +++ ResultCollector.java	2001/06/10 02:15:49	1.4
  @@ -58,6 +58,7 @@
   import java.util.*;
   import org.apache.jmeter.samplers.*;
   import org.apache.jmeter.visualizers.ViewResultsVisualizer;
  +import org.apache.jmeter.save.Saveable;
   /**
    * Title:
    * Description:
  @@ -67,7 +68,7 @@
    * @version 1.0
    */
   
  -public class ResultCollector implements JMeterComponentModel,SampleListener
  +public class ResultCollector implements JMeterComponentModel,SampleListener,Saveable
   {
   
   	private ArrayList results = new ArrayList();
  @@ -78,6 +79,11 @@
   	public ResultCollector()
   	{
   		current = 0;
  +	}
  +
  +	public Class getTagHandlerClass()
  +	{
  +		return org.apache.jmeter.save.handlers.JMeterComponentHandler.class;
   	}
   
   	public void setListener(ViewResultsVisualizer listener)
  
  
  
  1.7       +266 -179  jakarta-jmeter/src/org/apache/jmeter/save/handlers/AbstractConfigElementHandler.java
  
  Index: AbstractConfigElementHandler.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jmeter/src/org/apache/jmeter/save/handlers/AbstractConfigElementHandler.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- AbstractConfigElementHandler.java	2001/06/08 17:01:19	1.6
  +++ AbstractConfigElementHandler.java	2001/06/10 02:15:49	1.7
  @@ -1,179 +1,266 @@
  -/*
  - * ====================================================================
  - * The Apache Software License, Version 1.1
  - *
  - * Copyright (c) 2001 The Apache Software Foundation.  All rights
  - * reserved.
  - *
  - * Redistribution and use in source and binary forms, with or without
  - * modification, are permitted provided that the following conditions
  - * are met:
  - *
  - * 1. Redistributions of source code must retain the above copyright
  - * notice, this list of conditions and the following disclaimer.
  - *
  - * 2. Redistributions in binary form must reproduce the above copyright
  - * notice, this list of conditions and the following disclaimer in
  - * the documentation and/or other materials provided with the
  - * distribution.
  - *
  - * 3. The end-user documentation included with the redistribution,
  - * if any, must include the following acknowledgment:
  - * "This product includes software developed by the
  - * Apache Software Foundation (http://www.apache.org/)."
  - * Alternately, this acknowledgment may appear in the software itself,
  - * if and wherever such third-party acknowledgments normally appear.
  - *
  - * 4. The names "Apache" and "Apache Software Foundation" and
  - * "Apache JMeter" must not be used to endorse or promote products
  - * derived from this software without prior written permission. For
  - * written permission, please contact apache@apache.org.
  - *
  - * 5. Products derived from this software may not be called "Apache",
  - * "Apache JMeter", nor may "Apache" appear in their name, without
  - * prior written permission of the Apache Software Foundation.
  - *
  - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  - * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
  - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  - * SUCH DAMAGE.
  - * ====================================================================
  - *
  - * This software consists of voluntary contributions made by many
  - * individuals on behalf of the Apache Software Foundation.  For more
  - * information on the Apache Software Foundation, please see
  - * <http://www.apache.org/>.
  - */
  - package org.apache.jmeter.save.handlers;
  -
  -import java.io.*;
  -import java.util.*;
  -
  -import org.apache.jmeter.save.xml.*;
  -import org.xml.sax.Attributes;
  -import org.apache.jmeter.config.AbstractConfigElement;
  -import org.apache.jmeter.save.*;
  -
  -
  -/**
  - * Title:        JMeter
  - * Description:
  - * Copyright:    Copyright (c) 2000
  - * Company:      Apache
  - * @author Michael Stover
  - * @version 1.0
  - */
  -
  -public class AbstractConfigElementHandler extends TagHandler
  -{
  -	private AbstractConfigElement config;
  -	private String currentProperty;
  -
  -	public AbstractConfigElementHandler()
  -	{
  -	}
  -
  -	/**
  -	 * Returns the AbstractConfigElement object parsed from the XML.  This method
  -	 * is required to fulfill the SaveHandler interface.  It is used by the XML
  -	 * routines to gather all the saved objects.
  -	 */
  -	public Object getModel()
  -	{
  -		return config;
  -	}
  -
  -	/**
  -	 * This is called when a tag is first encountered for this handler class to handle.
  -	 * The attributes of the tag are passed, and the SaveHandler object is expected
  -	 * to instantiate a new object.
  -	 */
  -	public void setAtts(Attributes atts) throws Exception
  -	{
  -		String className = atts.getValue("type");
  -		config = (AbstractConfigElement)Class.forName(className).newInstance();
  -	}
  -
  -	/**
  -	 * Called by reflection when a &lt;property&gt; tag is encountered.  Again, the
  -	 * attributes are passed.
  -	 */
  -	public void property(Attributes atts)
  -	{
  -		currentProperty = atts.getValue("name");
  -	}
  -
  -	/**
  -	 * Called by reflection when text between the begin and end &lt;property&gt;
  -	 * tag is encountered.
  -	 */
  -	public void property(String data)
  -	{
  -
  -		if(data != null && data.trim().length() > 0)
  -		{
  -			config.putProperty(currentProperty,data.trim());
  -			currentProperty = null;
  -		}
  -	}
  -
  -	/**
  -	 * Called by reflection when the &lt;property&gt; tag is ended.
  -	 */
  -	public void propertyTagEnd()
  -	{
  -		List children = xmlParent.takeChildObjects(this);
  -		if(children.size() == 1)
  -		{
  -			config.putProperty(currentProperty,((TagHandler)children.get(0)).getModel());
  -		}
  -	}
  -
  -
  -	  /**
  -	* Gets the tag name that will trigger the use of this object's TagHandler.
  -	*/
  -	public String getPrimaryTagName()
  -	{
  -		return "ConfigElement";
  -	}
  -
  -  /**
  -	* Tells the object to save itself to the given output stream.
  -	*/
  -	public void save(Saveable obj,Writer out) throws IOException
  -	{
  -		AbstractConfigElement saved = (AbstractConfigElement)obj;
  -		out.write("<ConfigElement type=\"");
  -		out.write(JMeterHandler.convertToXML(saved.getClass().getName()));
  -		out.write("\">\n");
  -		Iterator iter = saved.getPropertyNames().iterator();
  -		while (iter.hasNext())
  -		{
  -			String key = (String)iter.next();
  -			Object value = saved.getProperty(key);
  -			writeProperty(out,key,value);
  -		}
  -		out.write("</ConfigElement>");
  -	}
  -
  -	/**
  -	 * Routine to write each property to xml.
  -	 */
  -	private void writeProperty(Writer out,String key,Object value) throws IOException
  -	{
  -		out.write("<property name=\"");
  -		out.write(JMeterHandler.convertToXML(key));
  -		out.write("\">");
  -		JMeterHandler.writeObject(value,out);
  -		out.write("</property>\n");
  -	}
  -}
  \ No newline at end of file
  +/*
  + * ====================================================================
  + * The Apache Software License, Version 1.1
  + *
  + * Copyright (c) 2001 The Apache Software Foundation.  All rights
  + * reserved.
  + *
  + * Redistribution and use in source and binary forms, with or without
  + * modification, are permitted provided that the following conditions
  + * are met:
  + *
  + * 1. Redistributions of source code must retain the above copyright
  + * notice, this list of conditions and the following disclaimer.
  + *
  + * 2. Redistributions in binary form must reproduce the above copyright
  + * notice, this list of conditions and the following disclaimer in
  + * the documentation and/or other materials provided with the
  + * distribution.
  + *
  + * 3. The end-user documentation included with the redistribution,
  + * if any, must include the following acknowledgment:
  + * "This product includes software developed by the
  + * Apache Software Foundation (http://www.apache.org/)."
  + * Alternately, this acknowledgment may appear in the software itself,
  + * if and wherever such third-party acknowledgments normally appear.
  + *
  + * 4. The names "Apache" and "Apache Software Foundation" and
  + * "Apache JMeter" must not be used to endorse or promote products
  + * derived from this software without prior written permission. For
  + * written permission, please contact apache@apache.org.
  + *
  + * 5. Products derived from this software may not be called "Apache",
  + * "Apache JMeter", nor may "Apache" appear in their name, without
  + * prior written permission of the Apache Software Foundation.
  + *
  + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  + * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
  + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  + * SUCH DAMAGE.
  + * ====================================================================
  + *
  + * This software consists of voluntary contributions made by many
  + * individuals on behalf of the Apache Software Foundation.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
  +
  +package org.apache.jmeter.save.handlers;
  +
  +
  +import java.io.*;
  +
  +import java.util.*;
  +
  +import org.apache.jmeter.config.AbstractConfigElement;
  +
  +import org.apache.jmeter.save.*;
  +
  +
  +import org.apache.jmeter.save.xml.*;
  +
  +import org.xml.sax.Attributes;
  +
  +
  +
  +/************************************************************
  + *  Title: JMeter Description: Copyright: Copyright (c) 2000 Company: Apache
  + *
  + *@author     Michael Stover
  + *@created    June 9, 2001
  + *@version    1.0
  + ***********************************************************/
  +
  +
  +public class AbstractConfigElementHandler extends TagHandler
  +{
  +
  +	private AbstractConfigElement config;
  +
  +	private String currentProperty;
  +
  +
  +	/************************************************************
  +	 *  Constructor for the AbstractConfigElementHandler object
  +	 ***********************************************************/
  +	public AbstractConfigElementHandler()
  +	{
  +
  +	}
  +
  +
  +	/************************************************************
  +	 *  This is called when a tag is first encountered for this handler class to
  +	 *  handle. The attributes of the tag are passed, and the SaveHandler object is
  +	 *  expected to instantiate a new object.
  +	 *
  +	 *@param  atts           The new Atts value
  +	 *@exception  Exception  Description of Exception
  +	 ***********************************************************/
  +
  +	public void setAtts(Attributes atts) throws Exception
  +	{
  +
  +		String className = atts.getValue("type");
  +
  +		config = (AbstractConfigElement)Class.forName(className).newInstance();
  +
  +	}
  +
  +
  +	/************************************************************
  +	 *  Returns the AbstractConfigElement object parsed from the XML. This method
  +	 *  is required to fulfill the SaveHandler interface. It is used by the XML
  +	 *  routines to gather all the saved objects.
  +	 *
  +	 *@return    The Model value
  +	 ***********************************************************/
  +
  +	public Object getModel()
  +	{
  +
  +		return config;
  +	}
  +
  +
  +
  +	/************************************************************
  +	 *  Gets the tag name that will trigger the use of this object's TagHandler.
  +	 *
  +	 *@return    The PrimaryTagName value
  +	 ***********************************************************/
  +
  +	public String getPrimaryTagName()
  +	{
  +
  +		return "ConfigElement";
  +	}
  +
  +
  +	/************************************************************
  +	 *  Called by reflection when a &lt;property&gt; tag is encountered. Again, the
  +	 *  attributes are passed.
  +	 *
  +	 *@param  atts  Description of Parameter
  +	 ***********************************************************/
  +
  +	public void property(Attributes atts)
  +	{
  +
  +		currentProperty = atts.getValue("name");
  +
  +	}
  +
  +
  +	/************************************************************
  +	 *  Called by reflection when text between the begin and end &lt;property&gt;
  +	 *  tag is encountered.
  +	 *
  +	 *@param  data  Description of Parameter
  +	 ***********************************************************/
  +
  +	public void property(String data)
  +	{
  +
  +
  +		if(data != null && data.trim().length() > 0)
  +		{
  +
  +			config.putProperty(currentProperty, data.trim());
  +
  +			currentProperty = null;
  +
  +		}
  +
  +	}
  +
  +
  +	/************************************************************
  +	 *  Called by reflection when the &lt;property&gt; tag is ended.
  +	 ***********************************************************/
  +
  +	public void propertyTagEnd()
  +	{
  +
  +		List children = xmlParent.takeChildObjects(this);
  +
  +		if(children.size() == 1)
  +		{
  +
  +			config.putProperty(currentProperty, ((TagHandler)children.get(0)).getModel());
  +
  +		}
  +
  +	}
  +
  +
  +	/************************************************************
  +	 *  Tells the object to save itself to the given output stream.
  +	 *
  +	 *@param  obj              Description of Parameter
  +	 *@param  out              Description of Parameter
  +	 *@exception  IOException  Description of Exception
  +	 ***********************************************************/
  +
  +	public void save(Saveable obj, Writer out) throws IOException
  +	{
  +
  +		AbstractConfigElement saved = (AbstractConfigElement)obj;
  +
  +		out.write("<ConfigElement type=\"");
  +
  +		out.write(JMeterHandler.convertToXML(saved.getClass().getName()));
  +
  +		out.write("\">\n");
  +
  +		Iterator iter = saved.getPropertyNames().iterator();
  +
  +		while(iter.hasNext())
  +		{
  +
  +			String key = (String)iter.next();
  +
  +			Object value = saved.getProperty(key);
  +
  +			writeProperty(out, key, value);
  +
  +		}
  +
  +		out.write("</ConfigElement>");
  +
  +	}
  +
  +
  +	/************************************************************
  +	 *  Routine to write each property to xml.
  +	 *
  +	 *@param  out              Description of Parameter
  +	 *@param  key              Description of Parameter
  +	 *@param  value            Description of Parameter
  +	 *@exception  IOException  Description of Exception
  +	 ***********************************************************/
  +
  +	private void writeProperty(Writer out, String key, Object value) throws IOException
  +	{
  +
  +		out.write("<property name=\"");
  +
  +		out.write(JMeterHandler.convertToXML(key));
  +
  +		out.write("\">");
  +
  +		JMeterHandler.writeObject(value, out);
  +
  +		out.write("</property>\n");
  +
  +	}
  +
  +}
  
  
  
  1.10      +272 -127  jakarta-jmeter/src/org/apache/jmeter/timers/ConstantTimer.java
  
  Index: ConstantTimer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jmeter/src/org/apache/jmeter/timers/ConstantTimer.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- ConstantTimer.java	2001/03/17 22:25:57	1.9
  +++ ConstantTimer.java	2001/06/10 02:15:49	1.10
  @@ -1,127 +1,272 @@
  -/*
  - * ====================================================================
  - * The Apache Software License, Version 1.1
  - *
  - * Copyright (c) 2001 The Apache Software Foundation.  All rights
  - * reserved.
  - *
  - * Redistribution and use in source and binary forms, with or without
  - * modification, are permitted provided that the following conditions
  - * are met:
  - *
  - * 1. Redistributions of source code must retain the above copyright
  - * notice, this list of conditions and the following disclaimer.
  - *
  - * 2. Redistributions in binary form must reproduce the above copyright
  - * notice, this list of conditions and the following disclaimer in
  - * the documentation and/or other materials provided with the
  - * distribution.
  - *
  - * 3. The end-user documentation included with the redistribution,
  - * if any, must include the following acknowledgment:
  - * "This product includes software developed by the
  - * Apache Software Foundation (http://www.apache.org/)."
  - * Alternately, this acknowledgment may appear in the software itself,
  - * if and wherever such third-party acknowledgments normally appear.
  - *
  - * 4. The names "Apache" and "Apache Software Foundation" and
  - * "Apache JMeter" must not be used to endorse or promote products
  - * derived from this software without prior written permission. For
  - * written permission, please contact apache@apache.org.
  - *
  - * 5. Products derived from this software may not be called "Apache",
  - * "Apache JMeter", nor may "Apache" appear in their name, without
  - * prior written permission of the Apache Software Foundation.
  - *
  - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  - * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
  - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  - * SUCH DAMAGE.
  - * ====================================================================
  - *
  - * This software consists of voluntary contributions made by many
  - * individuals on behalf of the Apache Software Foundation.  For more
  - * information on the Apache Software Foundation, please see
  - * <http://www.apache.org/>.
  - */
  -
  -package org.apache.jmeter.timers;
  -
  -import java.util.*;
  -
  -import org.apache.jmeter.gui.popup.*;
  -import org.apache.jmeter.gui.JMeterComponentModel;
  -
  -/**
  - * This class implements a constant timer with its own panel
  - * and fields for value update and user interaction.
  - *
  - * @author  <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
  - * @version $Revision: 1.9 $ $Date: 2001/03/17 22:25:57 $
  - */
  -public class ConstantTimer implements Timer,JMeterComponentModel {
  -
  -	 private long delay = 300;
  -	 private static List addableList = new LinkedList();
  -	 private String name;
  -
  -	 public ConstantTimer() {
  -
  -	 }
  -
  -	 public long delay() {
  -		  return this.delay;
  -	 }
  -
  -	 public void uncompile()
  -	 {
  -	 }
  -
  -	public void setName(String name)
  -	{
  -		this.name = name;
  -	}
  -
  -	public String getName()
  -	{
  -		return name;
  -	}
  -
  -	public Collection getAddList()
  -	{
  -		return addableList;
  -	}
  -
  -	public boolean isEditable()
  -	{
  -		return true;
  -	}
  -
  -	public Class getGuiClass()
  -	{
  -		return org.apache.jmeter.timers.gui.ConstantTimerGui.class;
  -	}
  -
  -	 public void setDelay(long delay) {
  -				this.delay = delay;
  -	 }
  -
  -	 public String toString() {
  -		  return "Add a constant delay between sampling";
  -	 }
  -
  -
  -
  -	 public String getClassLabel()
  -	 {
  -		return "Constant Timer";
  -	 }
  -}
  +/*
  +
  + * ====================================================================
  +
  + * The Apache Software License, Version 1.1
  +
  + *
  +
  + * Copyright (c) 2001 The Apache Software Foundation.  All rights
  +
  + * reserved.
  +
  + *
  +
  + * Redistribution and use in source and binary forms, with or without
  +
  + * modification, are permitted provided that the following conditions
  +
  + * are met:
  +
  + *
  +
  + * 1. Redistributions of source code must retain the above copyright
  +
  + * notice, this list of conditions and the following disclaimer.
  +
  + *
  +
  + * 2. Redistributions in binary form must reproduce the above copyright
  +
  + * notice, this list of conditions and the following disclaimer in
  +
  + * the documentation and/or other materials provided with the
  +
  + * distribution.
  +
  + *
  +
  + * 3. The end-user documentation included with the redistribution,
  +
  + * if any, must include the following acknowledgment:
  +
  + * "This product includes software developed by the
  +
  + * Apache Software Foundation (http://www.apache.org/)."
  +
  + * Alternately, this acknowledgment may appear in the software itself,
  +
  + * if and wherever such third-party acknowledgments normally appear.
  +
  + *
  +
  + * 4. The names "Apache" and "Apache Software Foundation" and
  +
  + * "Apache JMeter" must not be used to endorse or promote products
  +
  + * derived from this software without prior written permission. For
  +
  + * written permission, please contact apache@apache.org.
  +
  + *
  +
  + * 5. Products derived from this software may not be called "Apache",
  +
  + * "Apache JMeter", nor may "Apache" appear in their name, without
  +
  + * prior written permission of the Apache Software Foundation.
  +
  + *
  +
  + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  +
  + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  +
  + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  +
  + * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
  +
  + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  +
  + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  +
  + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  +
  + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  +
  + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  +
  + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  +
  + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  +
  + * SUCH DAMAGE.
  +
  + * ====================================================================
  +
  + *
  +
  + * This software consists of voluntary contributions made by many
  +
  + * individuals on behalf of the Apache Software Foundation.  For more
  +
  + * information on the Apache Software Foundation, please see
  +
  + * <http://www.apache.org/>.
  +
  + */
  +
  +
  +
  +package org.apache.jmeter.timers;
  +
  +
  +
  +import java.util.*;
  +
  +
  +
  +import org.apache.jmeter.gui.popup.*;
  +
  +import org.apache.jmeter.gui.JMeterComponentModel;
  +import org.apache.jmeter.save.Saveable;
  +
  +
  +
  +/**
  +
  + * This class implements a constant timer with its own panel
  +
  + * and fields for value update and user interaction.
  +
  + *
  +
  + * @author  <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
  +
  + * @version $Revision: 1.10 $ $Date: 2001/06/10 02:15:49 $
  +
  + */
  +
  +public class ConstantTimer implements Timer,JMeterComponentModel,Saveable {
  +
  +
  +
  +	 private long delay = 300;
  +
  +	 private static List addableList = new LinkedList();
  +
  +	 private String name;
  +
  +
  +
  +	 public ConstantTimer() {
  +
  +
  +
  +	 }
  +
  +
  +
  +	 public long delay() {
  +
  +		  return this.delay;
  +
  +	 }
  +
  +	 public long getDelay()
  +	 {
  +		return delay;
  +	 }
  +
  +
  +
  +	 public void uncompile()
  +
  +	 {
  +
  +	 }
  +
  +	public Class getTagHandlerClass()
  +	{
  +		return org.apache.jmeter.save.handlers.TimerHandler.class;
  +	}
  +
  +
  +
  +	public void setName(String name)
  +
  +	{
  +
  +		this.name = name;
  +
  +	}
  +
  +
  +
  +	public String getName()
  +
  +	{
  +
  +		return name;
  +
  +	}
  +
  +
  +
  +	public Collection getAddList()
  +
  +	{
  +
  +		return addableList;
  +
  +	}
  +
  +
  +
  +	public boolean isEditable()
  +
  +	{
  +
  +		return true;
  +
  +	}
  +
  +
  +
  +	public Class getGuiClass()
  +
  +	{
  +
  +		return org.apache.jmeter.timers.gui.ConstantTimerGui.class;
  +
  +	}
  +
  +
  +
  +	 public void setDelay(long delay) {
  +
  +				this.delay = delay;
  +
  +	 }
  +
  +
  +
  +	 public String toString() {
  +
  +		  return "Add a constant delay between sampling";
  +
  +	 }
  +
  +
  +	 public void setRange(double range)
  +	 {
  +	 }
  +
  +	 public double getRange()
  +	 {
  +		return (double)0;
  +	 }
  +
  +
  +
  +
  +	 public String getClassLabel()
  +
  +	 {
  +
  +		return "Constant Timer";
  +
  +	 }
  +
  +}
  +
  
  
  
  1.9       +263 -129  jakarta-jmeter/src/org/apache/jmeter/timers/RandomTimer.java
  
  Index: RandomTimer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jmeter/src/org/apache/jmeter/timers/RandomTimer.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- RandomTimer.java	2001/03/17 22:25:57	1.8
  +++ RandomTimer.java	2001/06/10 02:15:49	1.9
  @@ -1,129 +1,263 @@
  -/*
  - * ====================================================================
  - * The Apache Software License, Version 1.1
  - *
  - * Copyright (c) 2001 The Apache Software Foundation.  All rights
  - * reserved.
  - *
  - * Redistribution and use in source and binary forms, with or without
  - * modification, are permitted provided that the following conditions
  - * are met:
  - *
  - * 1. Redistributions of source code must retain the above copyright
  - * notice, this list of conditions and the following disclaimer.
  - *
  - * 2. Redistributions in binary form must reproduce the above copyright
  - * notice, this list of conditions and the following disclaimer in
  - * the documentation and/or other materials provided with the
  - * distribution.
  - *
  - * 3. The end-user documentation included with the redistribution,
  - * if any, must include the following acknowledgment:
  - * "This product includes software developed by the
  - * Apache Software Foundation (http://www.apache.org/)."
  - * Alternately, this acknowledgment may appear in the software itself,
  - * if and wherever such third-party acknowledgments normally appear.
  - *
  - * 4. The names "Apache" and "Apache Software Foundation" and
  - * "Apache JMeter" must not be used to endorse or promote products
  - * derived from this software without prior written permission. For
  - * written permission, please contact apache@apache.org.
  - *
  - * 5. Products derived from this software may not be called "Apache",
  - * "Apache JMeter", nor may "Apache" appear in their name, without
  - * prior written permission of the Apache Software Foundation.
  - *
  - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  - * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
  - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  - * SUCH DAMAGE.
  - * ====================================================================
  - *
  - * This software consists of voluntary contributions made by many
  - * individuals on behalf of the Apache Software Foundation.  For more
  - * information on the Apache Software Foundation, please see
  - * <http://www.apache.org/>.
  - */
  -
  -package org.apache.jmeter.timers;
  -
  -import java.util.*;
  -
  -import org.apache.jmeter.gui.JMeterComponentModel;
  -
  -/**
  - * This class implements a random timer with its own panel
  - * and fields for value update and user interaction.
  - *
  - * Since this class does not define the delay() method, is
  - * abstract and must be extended to provide full functionality.
  - *
  - * @author  <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
  - * @version $Revision: 1.8 $ $Date: 2001/03/17 22:25:57 $
  - */
  -public abstract class RandomTimer implements Timer,
  -		JMeterComponentModel {
  -
  -	 protected Random random;
  -	 protected long delay = 300;
  -	 protected double range = 100.0;
  -
  -
  -
  -	 private static List addableList = new LinkedList();
  -
  -	 private String name;
  -
  -	 public RandomTimer() {
  -		  this.random = new Random();
  -
  -
  -	 }
  -
  -	 public void setDelay(long delay) {
  -				this.delay = delay;
  -	 }
  -
  -	 public void setRange(double range)
  -	 {
  -		this.range = range;
  -	 }
  -
  -	 public double getRange()
  -	 {
  -		return range;
  -	 }
  -
  -	 public long getDelay()
  -	 {
  -		return delay;
  -	 }
  -
  -	 public void setName(String name)
  -	 {
  -		this.name = name;
  -	 }
  -
  -	 public String getName()
  -	 {
  -		return name;
  -	 }
  -
  -	 public Collection getAddList()
  -	 {
  -		return addableList;
  -	 }
  -
  -	 public boolean isEditable()
  -	 {
  -		return true;
  -	 }
  -}
  +/*
  +
  + * ====================================================================
  +
  + * The Apache Software License, Version 1.1
  +
  + *
  +
  + * Copyright (c) 2001 The Apache Software Foundation.  All rights
  +
  + * reserved.
  +
  + *
  +
  + * Redistribution and use in source and binary forms, with or without
  +
  + * modification, are permitted provided that the following conditions
  +
  + * are met:
  +
  + *
  +
  + * 1. Redistributions of source code must retain the above copyright
  +
  + * notice, this list of conditions and the following disclaimer.
  +
  + *
  +
  + * 2. Redistributions in binary form must reproduce the above copyright
  +
  + * notice, this list of conditions and the following disclaimer in
  +
  + * the documentation and/or other materials provided with the
  +
  + * distribution.
  +
  + *
  +
  + * 3. The end-user documentation included with the redistribution,
  +
  + * if any, must include the following acknowledgment:
  +
  + * "This product includes software developed by the
  +
  + * Apache Software Foundation (http://www.apache.org/)."
  +
  + * Alternately, this acknowledgment may appear in the software itself,
  +
  + * if and wherever such third-party acknowledgments normally appear.
  +
  + *
  +
  + * 4. The names "Apache" and "Apache Software Foundation" and
  +
  + * "Apache JMeter" must not be used to endorse or promote products
  +
  + * derived from this software without prior written permission. For
  +
  + * written permission, please contact apache@apache.org.
  +
  + *
  +
  + * 5. Products derived from this software may not be called "Apache",
  +
  + * "Apache JMeter", nor may "Apache" appear in their name, without
  +
  + * prior written permission of the Apache Software Foundation.
  +
  + *
  +
  + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  +
  + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  +
  + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  +
  + * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
  +
  + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  +
  + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  +
  + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  +
  + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  +
  + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  +
  + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  +
  + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  +
  + * SUCH DAMAGE.
  +
  + * ====================================================================
  +
  + *
  +
  + * This software consists of voluntary contributions made by many
  +
  + * individuals on behalf of the Apache Software Foundation.  For more
  +
  + * information on the Apache Software Foundation, please see
  +
  + * <http://www.apache.org/>.
  +
  + */
  +
  +
  +
  +package org.apache.jmeter.timers;
  +
  +
  +
  +import java.util.*;
  +
  +
  +import org.apache.jmeter.save.Saveable;
  +import org.apache.jmeter.gui.JMeterComponentModel;
  +
  +
  +
  +/**
  +
  + * This class implements a random timer with its own panel
  +
  + * and fields for value update and user interaction.
  +
  + *
  +
  + * Since this class does not define the delay() method, is
  +
  + * abstract and must be extended to provide full functionality.
  +
  + *
  +
  + * @author  <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
  +
  + * @version $Revision: 1.9 $ $Date: 2001/06/10 02:15:49 $
  +
  + */
  +
  +public abstract class RandomTimer implements Timer,
  +
  +		JMeterComponentModel,Saveable {
  +
  +
  +
  +	 protected Random random;
  +
  +	 protected long delay = 300;
  +
  +	 protected double range = 100.0;
  +
  +
  +
  +
  +
  +
  +
  +	 private static List addableList = new LinkedList();
  +
  +
  +
  +	 private String name;
  +
  +
  +
  +	 public RandomTimer() {
  +
  +		  this.random = new Random();
  +
  +
  +
  +
  +
  +	 }
  +
  +
  +
  +	 public void setDelay(long delay) {
  +
  +				this.delay = delay;
  +
  +	 }
  +
  +
  +
  +	 public void setRange(double range)
  +
  +	 {
  +
  +		this.range = range;
  +
  +	 }
  +
  +
  +
  +	 public double getRange()
  +
  +	 {
  +
  +		return range;
  +
  +	 }
  +
  +	 public Class getTagHandlerClass()
  +	{
  +		return org.apache.jmeter.save.handlers.TimerHandler.class;
  +	}
  +
  +
  +
  +	 public long getDelay()
  +
  +	 {
  +
  +		return delay;
  +
  +	 }
  +
  +
  +
  +	 public void setName(String name)
  +
  +	 {
  +
  +		this.name = name;
  +
  +	 }
  +
  +
  +
  +	 public String getName()
  +
  +	 {
  +
  +		return name;
  +
  +	 }
  +
  +
  +
  +	 public Collection getAddList()
  +
  +	 {
  +
  +		return addableList;
  +
  +	 }
  +
  +
  +
  +	 public boolean isEditable()
  +
  +	 {
  +
  +		return true;
  +
  +	 }
  +
  +}
  +
  
  
  
  1.9       +155 -75   jakarta-jmeter/src/org/apache/jmeter/timers/Timer.java
  
  Index: Timer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jmeter/src/org/apache/jmeter/timers/Timer.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- Timer.java	2001/03/17 22:25:57	1.8
  +++ Timer.java	2001/06/10 02:15:49	1.9
  @@ -1,75 +1,155 @@
  -/*
  - * ====================================================================
  - * The Apache Software License, Version 1.1
  - *
  - * Copyright (c) 2001 The Apache Software Foundation.  All rights
  - * reserved.
  - *
  - * Redistribution and use in source and binary forms, with or without
  - * modification, are permitted provided that the following conditions
  - * are met:
  - *
  - * 1. Redistributions of source code must retain the above copyright
  - * notice, this list of conditions and the following disclaimer.
  - *
  - * 2. Redistributions in binary form must reproduce the above copyright
  - * notice, this list of conditions and the following disclaimer in
  - * the documentation and/or other materials provided with the
  - * distribution.
  - *
  - * 3. The end-user documentation included with the redistribution,
  - * if any, must include the following acknowledgment:
  - * "This product includes software developed by the
  - * Apache Software Foundation (http://www.apache.org/)."
  - * Alternately, this acknowledgment may appear in the software itself,
  - * if and wherever such third-party acknowledgments normally appear.
  - *
  - * 4. The names "Apache" and "Apache Software Foundation" and
  - * "Apache JMeter" must not be used to endorse or promote products
  - * derived from this software without prior written permission. For
  - * written permission, please contact apache@apache.org.
  - *
  - * 5. Products derived from this software may not be called "Apache",
  - * "Apache JMeter", nor may "Apache" appear in their name, without
  - * prior written permission of the Apache Software Foundation.
  - *
  - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  - * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
  - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  - * SUCH DAMAGE.
  - * ====================================================================
  - *
  - * This software consists of voluntary contributions made by many
  - * individuals on behalf of the Apache Software Foundation.  For more
  - * information on the Apache Software Foundation, please see
  - * <http://www.apache.org/>.
  - */
  -
  -package org.apache.jmeter.timers;
  -
  -
  -
  -/**
  - * This interface defines those methods that must be implemented
  - * by timer plugins.
  - *
  - * @author  <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
  - * @version $Revision: 1.8 $ $Date: 2001/03/17 22:25:57 $
  - */
  -public interface Timer extends java.io.Serializable {
  -
  -	 /**
  -	  * This method is called after a sampling process is done
  -	  * to know how much time the sampling thread has to wait
  -	  * until sampling again.
  -	  */
  -	 public long delay();
  -}
  +/*
  +
  + * ====================================================================
  +
  + * The Apache Software License, Version 1.1
  +
  + *
  +
  + * Copyright (c) 2001 The Apache Software Foundation.  All rights
  +
  + * reserved.
  +
  + *
  +
  + * Redistribution and use in source and binary forms, with or without
  +
  + * modification, are permitted provided that the following conditions
  +
  + * are met:
  +
  + *
  +
  + * 1. Redistributions of source code must retain the above copyright
  +
  + * notice, this list of conditions and the following disclaimer.
  +
  + *
  +
  + * 2. Redistributions in binary form must reproduce the above copyright
  +
  + * notice, this list of conditions and the following disclaimer in
  +
  + * the documentation and/or other materials provided with the
  +
  + * distribution.
  +
  + *
  +
  + * 3. The end-user documentation included with the redistribution,
  +
  + * if any, must include the following acknowledgment:
  +
  + * "This product includes software developed by the
  +
  + * Apache Software Foundation (http://www.apache.org/)."
  +
  + * Alternately, this acknowledgment may appear in the software itself,
  +
  + * if and wherever such third-party acknowledgments normally appear.
  +
  + *
  +
  + * 4. The names "Apache" and "Apache Software Foundation" and
  +
  + * "Apache JMeter" must not be used to endorse or promote products
  +
  + * derived from this software without prior written permission. For
  +
  + * written permission, please contact apache@apache.org.
  +
  + *
  +
  + * 5. Products derived from this software may not be called "Apache",
  +
  + * "Apache JMeter", nor may "Apache" appear in their name, without
  +
  + * prior written permission of the Apache Software Foundation.
  +
  + *
  +
  + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  +
  + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  +
  + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  +
  + * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
  +
  + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  +
  + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  +
  + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  +
  + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  +
  + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  +
  + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  +
  + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  +
  + * SUCH DAMAGE.
  +
  + * ====================================================================
  +
  + *
  +
  + * This software consists of voluntary contributions made by many
  +
  + * individuals on behalf of the Apache Software Foundation.  For more
  +
  + * information on the Apache Software Foundation, please see
  +
  + * <http://www.apache.org/>.
  +
  + */
  +
  +
  +
  +package org.apache.jmeter.timers;
  +
  +
  +
  +
  +
  +
  +
  +/**
  +
  + * This interface defines those methods that must be implemented
  +
  + * by timer plugins.
  +
  + *
  +
  + * @author  <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
  +
  + * @version $Revision: 1.9 $ $Date: 2001/06/10 02:15:49 $
  +
  + */
  +
  +public interface Timer extends java.io.Serializable {
  +
  +
  +
  +	 /**
  +
  +	  * This method is called after a sampling process is done
  +
  +	  * to know how much time the sampling thread has to wait
  +
  +	  * until sampling again.
  +
  +	  */
  +
  +	 public long delay();
  +
  +	 public void setRange(double range);
  +	 public double getRange();
  +
  +	 public void setDelay(long delay);
  +	 public long getDelay();
  +}
  +
  
  
  
  1.16      +461 -228  jakarta-jmeter/src/org/apache/jmeter/visualizers/FileVisualizer.java
  
  Index: FileVisualizer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jmeter/src/org/apache/jmeter/visualizers/FileVisualizer.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- FileVisualizer.java	2001/03/17 22:25:59	1.15
  +++ FileVisualizer.java	2001/06/10 02:15:50	1.16
  @@ -1,228 +1,461 @@
  -/*
  - * ====================================================================
  - * The Apache Software License, Version 1.1
  - *
  - * Copyright (c) 2001 The Apache Software Foundation.  All rights
  - * reserved.
  - *
  - * Redistribution and use in source and binary forms, with or without
  - * modification, are permitted provided that the following conditions
  - * are met:
  - *
  - * 1. Redistributions of source code must retain the above copyright
  - * notice, this list of conditions and the following disclaimer.
  - *
  - * 2. Redistributions in binary form must reproduce the above copyright
  - * notice, this list of conditions and the following disclaimer in
  - * the documentation and/or other materials provided with the
  - * distribution.
  - *
  - * 3. The end-user documentation included with the redistribution,
  - * if any, must include the following acknowledgment:
  - * "This product includes software developed by the
  - * Apache Software Foundation (http://www.apache.org/)."
  - * Alternately, this acknowledgment may appear in the software itself,
  - * if and wherever such third-party acknowledgments normally appear.
  - *
  - * 4. The names "Apache" and "Apache Software Foundation" and
  - * "Apache JMeter" must not be used to endorse or promote products
  - * derived from this software without prior written permission. For
  - * written permission, please contact apache@apache.org.
  - *
  - * 5. Products derived from this software may not be called "Apache",
  - * "Apache JMeter", nor may "Apache" appear in their name, without
  - * prior written permission of the Apache Software Foundation.
  - *
  - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  - * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
  - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  - * SUCH DAMAGE.
  - * ====================================================================
  - *
  - * This software consists of voluntary contributions made by many
  - * individuals on behalf of the Apache Software Foundation.  For more
  - * information on the Apache Software Foundation, please see
  - * <http://www.apache.org/>.
  - */
  -
  -
  -package org.apache.jmeter.visualizers;
  -
  -import java.io.*;
  -import java.awt.*;
  -import java.awt.event.*;
  -import javax.swing.*;
  -import org.apache.jmeter.util.JMeterUtils;
  -import org.apache.jmeter.samplers.SampleResult;
  -import org.apache.jmeter.samplers.Sampler;
  -import org.apache.jmeter.gui.*;
  -import org.apache.jmeter.reporters.Filer;
  -/**
  - * This class implements a visualizer that writes the samples to a file.
  - *
  - * @author  <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
  - * @version $Revision: 1.15 $ $Date: 2001/03/17 22:25:59 $
  - */
  -public class FileVisualizer extends JPanel implements ActionListener,ModelSupported {
  -
  -		 Filer  model;
  -
  -	 JButton browseButton, openButton, flushButton, closeButton;
  -	 JFileChooser fileChooser;
  -	 JCheckBox appendCheck, verboseCheck;
  -	 JComboBox fileList;
  -
  -	 public FileVisualizer() {
  -		  super();
  -
  -
  -	 }
  -
  -	 private void init()
  -	 {
  -		// File panel
  -		  JPanel filePanel = new JPanel();
  -		  filePanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Output File"));
  -		  GridBagLayout g = new GridBagLayout();
  -		  filePanel.setLayout(g);
  -		  GridBagConstraints c = new GridBagConstraints();
  -		  c.fill = c.BOTH;
  -
  -		  fileList = new JComboBox();
  -		  fileList.setEditable(true);
  -		  fileList.addActionListener(this);
  -		  c.gridx = 0;
  -		  c.gridy = 0;
  -		  c.gridwidth = 4;
  -		  c.gridheight = 1;
  -		  c.weightx = 1.0;
  -		  c.weighty = 0.0;
  -		  c.insets = new Insets(3, 3, 3, 3);
  -		  g.setConstraints(fileList, c);
  -		  filePanel.add(fileList);
  -
  -		  browseButton = new JButton("Browse");
  -		  browseButton.addActionListener(this);
  -		  browseButton.setEnabled(true);
  -		  c.gridwidth = 1;
  -		  c.gridx = 4;
  -		  g.setConstraints(browseButton, c);
  -		  filePanel.add(browseButton);
  -
  -		  appendCheck = new JCheckBox("Append", model.getAppend());
  -		  appendCheck.addActionListener(this);
  -		  c.gridx = 0;
  -		  c.gridy = 1;
  -		  g.setConstraints(appendCheck, c);
  -		  filePanel.add(appendCheck);
  -
  -		  verboseCheck = new JCheckBox("Verbose Output", model.getVerbose());
  -		  verboseCheck.addActionListener(this);
  -		  c.gridx = 1;
  -		  g.setConstraints(verboseCheck, c);
  -		  filePanel.add(verboseCheck);
  -
  -		  openButton = new JButton("Open");
  -		  openButton.addActionListener(this);
  -		  openButton.setEnabled(true);
  -		  c.gridx = 2;
  -		  g.setConstraints(openButton, c);
  -		  filePanel.add(openButton);
  -
  -		  flushButton = new JButton("Flush");
  -		  flushButton.addActionListener(this);
  -		  flushButton.setEnabled(false);
  -		  c.gridx = 3;
  -		  g.setConstraints(flushButton, c);
  -		  filePanel.add(flushButton);
  -
  -		  closeButton = new JButton("Close");
  -		  closeButton.addActionListener(this);
  -		  closeButton.setEnabled(false);
  -		  c.gridx = 4;
  -		  g.setConstraints(closeButton, c);
  -		  filePanel.add(closeButton);
  -
  -		  fileChooser = new JFileChooser();
  -
  -		  this.add(filePanel);
  -	 }
  -
  -	 public void setModel(Object model)
  -	 {
  -		this.model = (Filer)model;
  -		this.model.setListener(this);
  -		init();
  -	 }
  -
  -	 public void open()
  -	 {
  -		browseButton.setEnabled(false);
  -		openButton.setEnabled(false);
  -		flushButton.setEnabled(true);
  -		closeButton.setEnabled(true);
  -		model.open();
  -	 }
  -
  -	 public void close()
  -	 {
  -		browseButton.setEnabled(true);
  -		openButton.setEnabled(true);
  -		flushButton.setEnabled(false);
  -		closeButton.setEnabled(false);
  -		model.close();
  -	 }
  -
  -	 public void setFile(String file)
  -	 {
  -		fileList.removeItem(file);
  -		fileList.addItem(file);
  -		fileList.getEditor().setItem(file);
  -		model.setFile(file);
  -	 }
  -
  -	 public void updateGui()
  -	 {
  -	 }
  -
  -	 public void actionPerformed(ActionEvent e) {
  -		  try {
  -			 JComponent c = (JComponent) e.getSource();
  -			 if(c == fileList) {
  -					 setFile((String) fileList.getSelectedItem());
  -				} else if (c == appendCheck) {
  -					 model.setAppend(appendCheck.isSelected());
  -				} else if (c == browseButton) {
  -		/*
  -					 int retval = fileChooser.showOpenDialog(this);
  -					 if (retval == JFileChooser.APPROVE_OPTION) {
  -						  this.file = fileChooser.getSelectedFile().toString();
  -		*/
  -		File tmp = FileDialoger.promptToOpenFile().getSelectedFile();
  -		if( tmp != null ) {
  -			 setFile(tmp.toString());
  -					 }
  -				} else if (c == openButton) {
  -					 open();
  -				} else if (c == flushButton) {
  -					 model.flush();
  -				} else if (c == closeButton) {
  -		close();
  -				} else if (c == verboseCheck) {
  -					 model.setVerbose(verboseCheck.isSelected());
  -				} else {
  -					 // do nothing!
  -				}
  -		  } catch (Exception ex) {
  -				JOptionPane.showMessageDialog(this, ex, "Error", JOptionPane.ERROR_MESSAGE);
  -		  }
  -	 }
  -}
  +/*
  +
  + * ====================================================================
  +
  + * The Apache Software License, Version 1.1
  +
  + *
  +
  + * Copyright (c) 2001 The Apache Software Foundation.  All rights
  +
  + * reserved.
  +
  + *
  +
  + * Redistribution and use in source and binary forms, with or without
  +
  + * modification, are permitted provided that the following conditions
  +
  + * are met:
  +
  + *
  +
  + * 1. Redistributions of source code must retain the above copyright
  +
  + * notice, this list of conditions and the following disclaimer.
  +
  + *
  +
  + * 2. Redistributions in binary form must reproduce the above copyright
  +
  + * notice, this list of conditions and the following disclaimer in
  +
  + * the documentation and/or other materials provided with the
  +
  + * distribution.
  +
  + *
  +
  + * 3. The end-user documentation included with the redistribution,
  +
  + * if any, must include the following acknowledgment:
  +
  + * "This product includes software developed by the
  +
  + * Apache Software Foundation (http://www.apache.org/)."
  +
  + * Alternately, this acknowledgment may appear in the software itself,
  +
  + * if and wherever such third-party acknowledgments normally appear.
  +
  + *
  +
  + * 4. The names "Apache" and "Apache Software Foundation" and
  +
  + * "Apache JMeter" must not be used to endorse or promote products
  +
  + * derived from this software without prior written permission. For
  +
  + * written permission, please contact apache@apache.org.
  +
  + *
  +
  + * 5. Products derived from this software may not be called "Apache",
  +
  + * "Apache JMeter", nor may "Apache" appear in their name, without
  +
  + * prior written permission of the Apache Software Foundation.
  +
  + *
  +
  + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  +
  + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  +
  + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  +
  + * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
  +
  + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  +
  + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  +
  + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  +
  + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  +
  + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  +
  + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  +
  + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  +
  + * SUCH DAMAGE.
  +
  + * ====================================================================
  +
  + *
  +
  + * This software consists of voluntary contributions made by many
  +
  + * individuals on behalf of the Apache Software Foundation.  For more
  +
  + * information on the Apache Software Foundation, please see
  +
  + * <http://www.apache.org/>.
  +
  + */
  +
  +
  +
  +
  +
  +package org.apache.jmeter.visualizers;
  +
  +
  +
  +import java.io.*;
  +
  +import java.awt.*;
  +
  +import java.awt.event.*;
  +
  +import javax.swing.*;
  +
  +import org.apache.jmeter.util.JMeterUtils;
  +
  +import org.apache.jmeter.samplers.SampleResult;
  +
  +import org.apache.jmeter.samplers.Sampler;
  +
  +import org.apache.jmeter.gui.*;
  +
  +import org.apache.jmeter.reporters.Filer;
  +
  +/**
  +
  + * This class implements a visualizer that writes the samples to a file.
  +
  + *
  +
  + * @author  <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
  +
  + * @version $Revision: 1.16 $ $Date: 2001/06/10 02:15:50 $
  +
  + */
  +
  +public class FileVisualizer extends JPanel implements ActionListener,ModelSupported {
  +
  +
  +
  +		 Filer  model;
  +
  +
  +
  +	 JButton browseButton, openButton, flushButton, closeButton;
  +
  +	 JFileChooser fileChooser;
  +
  +	 JCheckBox appendCheck, verboseCheck;
  +
  +	 JComboBox fileList;
  +
  +
  +
  +	 public FileVisualizer() {
  +
  +		  super();
  +
  +
  +
  +
  +
  +	 }
  +
  +
  +
  +	 private void init()
  +
  +	 {
  +
  +		// File panel
  +
  +		  JPanel filePanel = new JPanel();
  +
  +		  filePanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Output File"));
  +
  +		  GridBagLayout g = new GridBagLayout();
  +
  +		  filePanel.setLayout(g);
  +
  +		  GridBagConstraints c = new GridBagConstraints();
  +
  +		  c.fill = c.BOTH;
  +
  +
  +
  +		  fileList = new JComboBox();
  +
  +		  fileList.setEditable(true);
  +		  if(model.getFile() != null)
  +		  {
  +			fileList.addItem(model.getFile());
  +			fileList.setSelectedItem(model.getFile());
  +		  }
  +
  +		  fileList.addActionListener(this);
  +
  +		  c.gridx = 0;
  +
  +		  c.gridy = 0;
  +
  +		  c.gridwidth = 4;
  +
  +		  c.gridheight = 1;
  +
  +		  c.weightx = 1.0;
  +
  +		  c.weighty = 0.0;
  +
  +		  c.insets = new Insets(3, 3, 3, 3);
  +
  +		  g.setConstraints(fileList, c);
  +
  +		  filePanel.add(fileList);
  +
  +
  +
  +		  browseButton = new JButton("Browse");
  +
  +		  browseButton.addActionListener(this);
  +
  +		  browseButton.setEnabled(true);
  +
  +		  c.gridwidth = 1;
  +
  +		  c.gridx = 4;
  +
  +		  g.setConstraints(browseButton, c);
  +
  +		  filePanel.add(browseButton);
  +
  +
  +
  +		  appendCheck = new JCheckBox("Append", model.getAppend());
  +
  +		  appendCheck.addActionListener(this);
  +
  +		  c.gridx = 0;
  +
  +		  c.gridy = 1;
  +
  +		  g.setConstraints(appendCheck, c);
  +
  +		  filePanel.add(appendCheck);
  +
  +
  +
  +		  verboseCheck = new JCheckBox("Verbose Output", model.getVerbose());
  +
  +		  verboseCheck.addActionListener(this);
  +
  +		  c.gridx = 1;
  +
  +		  g.setConstraints(verboseCheck, c);
  +
  +		  filePanel.add(verboseCheck);
  +
  +
  +
  +		  openButton = new JButton("Open");
  +
  +		  openButton.addActionListener(this);
  +
  +		  openButton.setEnabled(true);
  +
  +		  c.gridx = 2;
  +
  +		  g.setConstraints(openButton, c);
  +
  +		  filePanel.add(openButton);
  +
  +
  +
  +		  flushButton = new JButton("Flush");
  +
  +		  flushButton.addActionListener(this);
  +
  +		  flushButton.setEnabled(false);
  +
  +		  c.gridx = 3;
  +
  +		  g.setConstraints(flushButton, c);
  +
  +		  filePanel.add(flushButton);
  +
  +
  +
  +		  closeButton = new JButton("Close");
  +
  +		  closeButton.addActionListener(this);
  +
  +		  closeButton.setEnabled(false);
  +
  +		  c.gridx = 4;
  +
  +		  g.setConstraints(closeButton, c);
  +
  +		  filePanel.add(closeButton);
  +
  +
  +
  +		  fileChooser = new JFileChooser();
  +
  +
  +
  +		  this.add(filePanel);
  +
  +	 }
  +
  +
  +
  +	 public void setModel(Object model)
  +
  +	 {
  +
  +		this.model = (Filer)model;
  +
  +		this.model.setListener(this);
  +
  +		init();
  +
  +	 }
  +
  +
  +
  +	 public void open()
  +
  +	 {
  +
  +		browseButton.setEnabled(false);
  +
  +		openButton.setEnabled(false);
  +
  +		flushButton.setEnabled(true);
  +
  +		closeButton.setEnabled(true);
  +
  +		model.open();
  +
  +	 }
  +
  +
  +
  +	 public void close()
  +
  +	 {
  +
  +		browseButton.setEnabled(true);
  +
  +		openButton.setEnabled(true);
  +
  +		flushButton.setEnabled(false);
  +
  +		closeButton.setEnabled(false);
  +
  +		model.close();
  +
  +	 }
  +
  +
  +
  +	 public void setFile(String file)
  +
  +	 {
  +
  +		fileList.removeItem(file);
  +
  +		fileList.addItem(file);
  +
  +		fileList.getEditor().setItem(file);
  +
  +		model.setFile(file);
  +
  +	 }
  +
  +
  +
  +	 public void updateGui()
  +
  +	 {
  +
  +	 }
  +
  +
  +
  +	 public void actionPerformed(ActionEvent e) {
  +
  +		  try {
  +
  +			 JComponent c = (JComponent) e.getSource();
  +
  +			 if(c == fileList) {
  +
  +					 setFile((String) fileList.getSelectedItem());
  +
  +				} else if (c == appendCheck) {
  +
  +					 model.setAppend(appendCheck.isSelected());
  +
  +				} else if (c == browseButton) {
  +
  +		/*
  +
  +					 int retval = fileChooser.showOpenDialog(this);
  +
  +					 if (retval == JFileChooser.APPROVE_OPTION) {
  +
  +						  this.file = fileChooser.getSelectedFile().toString();
  +
  +		*/
  +
  +		File tmp = FileDialoger.promptToOpenFile().getSelectedFile();
  +
  +		if( tmp != null ) {
  +
  +			 setFile(tmp.toString());
  +
  +					 }
  +
  +				} else if (c == openButton) {
  +
  +					 open();
  +
  +				} else if (c == flushButton) {
  +
  +					 model.flush();
  +
  +				} else if (c == closeButton) {
  +
  +		close();
  +
  +				} else if (c == verboseCheck) {
  +
  +					 model.setVerbose(verboseCheck.isSelected());
  +
  +				} else {
  +
  +					 // do nothing!
  +
  +				}
  +
  +		  } catch (Exception ex) {
  +
  +				JOptionPane.showMessageDialog(this, ex, "Error", JOptionPane.ERROR_MESSAGE);
  +
  +		  }
  +
  +	 }
  +
  +}
  +
  
  
  
  1.4       +534 -264  jakarta-jmeter/src/org/apache/jmeter/visualizers/GraphModel.java
  
  Index: GraphModel.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jmeter/src/org/apache/jmeter/visualizers/GraphModel.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- GraphModel.java	2001/03/17 22:25:59	1.3
  +++ GraphModel.java	2001/06/10 02:15:50	1.4
  @@ -1,264 +1,534 @@
  -/*
  - * ====================================================================
  - * The Apache Software License, Version 1.1
  - *
  - * Copyright (c) 2001 The Apache Software Foundation.  All rights
  - * reserved.
  - *
  - * Redistribution and use in source and binary forms, with or without
  - * modification, are permitted provided that the following conditions
  - * are met:
  - *
  - * 1. Redistributions of source code must retain the above copyright
  - * notice, this list of conditions and the following disclaimer.
  - *
  - * 2. Redistributions in binary form must reproduce the above copyright
  - * notice, this list of conditions and the following disclaimer in
  - * the documentation and/or other materials provided with the
  - * distribution.
  - *
  - * 3. The end-user documentation included with the redistribution,
  - * if any, must include the following acknowledgment:
  - * "This product includes software developed by the
  - * Apache Software Foundation (http://www.apache.org/)."
  - * Alternately, this acknowledgment may appear in the software itself,
  - * if and wherever such third-party acknowledgments normally appear.
  - *
  - * 4. The names "Apache" and "Apache Software Foundation" and
  - * "Apache JMeter" must not be used to endorse or promote products
  - * derived from this software without prior written permission. For
  - * written permission, please contact apache@apache.org.
  - *
  - * 5. Products derived from this software may not be called "Apache",
  - * "Apache JMeter", nor may "Apache" appear in their name, without
  - * prior written permission of the Apache Software Foundation.
  - *
  - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  - * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
  - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  - * SUCH DAMAGE.
  - * ====================================================================
  - *
  - * This software consists of voluntary contributions made by many
  - * individuals on behalf of the Apache Software Foundation.  For more
  - * information on the Apache Software Foundation, please see
  - * <http://www.apache.org/>.
  - */
  - package org.apache.jmeter.visualizers;
  -
  -import org.apache.jmeter.gui.*;
  -import java.util.*;
  -
  -import org.apache.jmeter.samplers.*;
  -
  -/**
  - *  Title: Apache JMeter Description: Copyright: Copyright (c) 2000 Company:
  - *  Apache Foundation
  - *
  - *@author     Michael Stover
  - *@created    February 8, 2001
  - *@version    1.0
  - */
  -
  -public class GraphModel implements JMeterComponentModel,SampleListener
  -{
  -	private String name;
  -	private List samples;
  -	private List listeners;
  -
  -	private long averageSum = 0;
  -	private long variationSum = 0;
  -	private long counter = 0;
  -	private long previous = 0;
  -	private long max = 1;
  -	private boolean bigChange = false;
  -	private Sample current = new Sample(0,0,0);
  -
  -	/**
  -	 *  Constructor for the GraphModel object
  -	 */
  -	public GraphModel()
  -	{
  -		listeners = new LinkedList();
  -		samples = Collections.synchronizedList(new LinkedList());
  -	}
  -
  -	public void uncompile()
  -	{
  -	}
  -
  -	protected void fireDataChanged()
  -	{
  -		Iterator iter = listeners.iterator();
  -		if(bigChange)
  -		{
  -			while (iter.hasNext())
  -			{
  -				((ModelSupported)iter.next()).updateGui();
  -			}
  -			bigChange = false;
  -		}
  -		else
  -		{
  -			quickUpdate(current);
  -		}
  -	}
  -
  -	protected void quickUpdate(Sample s)
  -	{
  -		Iterator iter = listeners.iterator();
  -		{
  -			while (iter.hasNext())
  -			{
  -				((GraphListener)iter.next()).updateGui(s);
  -			}
  -		}
  -	}
  -
  -	public long getCurrentData()
  -	{
  -		return current.data;
  -	}
  -
  -	public long getCurrentAverage()
  -	{
  -		return current.average;
  -	}
  -
  -	public long getCurrentDeviation()
  -	{
  -		return current.deviation;
  -	}
  -
  -	public int getSampleCount()
  -	{
  -		return samples.size();
  -	}
  -
  -	public void addModelListener(java.awt.Component modelListener)
  -	{
  -		listeners.add(modelListener);
  -	}
  -
  -	public List getSamples()
  -	{
  -		return samples;
  -	}
  -
  -	/**
  -	 *  Sets the Name attribute of the GraphModel object
  -	 *
  -	 *@param  name  The new Name value
  -	 */
  -	public void setName(String name)
  -	{
  -		this.name = name;
  -	}
  -
  -	/**
  -	 *  Gets the GuiClass attribute of the GraphModel object
  -	 *
  -	 *@return    The GuiClass value
  -	 */
  -	public Class getGuiClass()
  -	{
  -		return GraphVisualizer.class;
  -	}
  -
  -	/**
  -	 *  Gets the Name attribute of the GraphModel object
  -	 *
  -	 *@return    The Name value
  -	 */
  -	public String getName()
  -	{
  -		return name;
  -	}
  -
  -	/**
  -	 *  Gets the Editable attribute of the GraphModel object
  -	 *
  -	 *@return    The Editable value
  -	 */
  -	public boolean isEditable()
  -	{
  -		return false;
  -	}
  -
  -	/**
  -	 *  Gets the AddList attribute of the GraphModel object
  -	 *
  -	 *@return    The AddList value
  -	 */
  -	public Collection getAddList()
  -	{
  -		return null;
  -	}
  -
  -	/**
  -	 *  Gets the ClassLabel attribute of the GraphModel object
  -	 *
  -	 *@return    The ClassLabel value
  -	 */
  -	public String getClassLabel()
  -	{
  -		return "Graph Results";
  -	}
  -
  -	public void sampleOccurred(SampleEvent e)
  -	{
  -		addNewSample(e.getResult().getTime());
  -		this.fireDataChanged();
  -	}
  -
  -	public void sampleStarted(SampleEvent e)
  -	{
  -	}
  -
  -	public long getMax()
  -	{
  -		return max;
  -	}
  -
  -	public void clear()
  -	{
  -			samples.clear();
  -			averageSum = 0;
  -			variationSum = 0;
  -			counter = 0;
  -			previous = 0;
  -			max = 1;
  -			bigChange = true;
  -			current = new Sample(0,0,0);
  -		this.fireDataChanged();
  -	}
  -
  -	private void addNewSample(long sample)
  -	{
  -			if (sample > max)
  -			{
  -			bigChange = true;
  -			max = sample;
  -			}
  -			averageSum += sample;
  -			long average = averageSum / ++counter;
  -			variationSum += Math.pow(sample - average, 2);
  -			long deviation = (long) Math.pow(variationSum / counter, 0.5);
  -			Sample s = new Sample(sample, average, deviation);
  -			previous = sample;
  -			current = s;
  -			samples.add(s);
  -	}
  -
  -	public void sampleStopped(SampleEvent e)
  -	{
  -	}
  -}
  +/*
  +
  + * ====================================================================
  +
  + * The Apache Software License, Version 1.1
  +
  + *
  +
  + * Copyright (c) 2001 The Apache Software Foundation.  All rights
  +
  + * reserved.
  +
  + *
  +
  + * Redistribution and use in source and binary forms, with or without
  +
  + * modification, are permitted provided that the following conditions
  +
  + * are met:
  +
  + *
  +
  + * 1. Redistributions of source code must retain the above copyright
  +
  + * notice, this list of conditions and the following disclaimer.
  +
  + *
  +
  + * 2. Redistributions in binary form must reproduce the above copyright
  +
  + * notice, this list of conditions and the following disclaimer in
  +
  + * the documentation and/or other materials provided with the
  +
  + * distribution.
  +
  + *
  +
  + * 3. The end-user documentation included with the redistribution,
  +
  + * if any, must include the following acknowledgment:
  +
  + * "This product includes software developed by the
  +
  + * Apache Software Foundation (http://www.apache.org/)."
  +
  + * Alternately, this acknowledgment may appear in the software itself,
  +
  + * if and wherever such third-party acknowledgments normally appear.
  +
  + *
  +
  + * 4. The names "Apache" and "Apache Software Foundation" and
  +
  + * "Apache JMeter" must not be used to endorse or promote products
  +
  + * derived from this software without prior written permission. For
  +
  + * written permission, please contact apache@apache.org.
  +
  + *
  +
  + * 5. Products derived from this software may not be called "Apache",
  +
  + * "Apache JMeter", nor may "Apache" appear in their name, without
  +
  + * prior written permission of the Apache Software Foundation.
  +
  + *
  +
  + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  +
  + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  +
  + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  +
  + * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
  +
  + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  +
  + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  +
  + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  +
  + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  +
  + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  +
  + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  +
  + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  +
  + * SUCH DAMAGE.
  +
  + * ====================================================================
  +
  + *
  +
  + * This software consists of voluntary contributions made by many
  +
  + * individuals on behalf of the Apache Software Foundation.  For more
  +
  + * information on the Apache Software Foundation, please see
  +
  + * <http://www.apache.org/>.
  +
  + */
  +
  + package org.apache.jmeter.visualizers;
  +
  +
  +
  +import org.apache.jmeter.gui.*;
  +
  +import java.util.*;
  +
  +
  +
  +import org.apache.jmeter.samplers.*;
  +import org.apache.jmeter.save.Saveable;
  +
  +
  +
  +/**
  +
  + *  Title: Apache JMeter Description: Copyright: Copyright (c) 2000 Company:
  +
  + *  Apache Foundation
  +
  + *
  +
  + *@author     Michael Stover
  +
  + *@created    February 8, 2001
  +
  + *@version    1.0
  +
  + */
  +
  +
  +
  +public class GraphModel implements JMeterComponentModel,SampleListener,Saveable
  +
  +{
  +
  +	private String name;
  +
  +	private List samples;
  +
  +	private List listeners;
  +
  +
  +
  +	private long averageSum = 0;
  +
  +	private long variationSum = 0;
  +
  +	private long counter = 0;
  +
  +	private long previous = 0;
  +
  +	private long max = 1;
  +
  +	private boolean bigChange = false;
  +
  +	private Sample current = new Sample(0,0,0);
  +
  +
  +
  +	/**
  +
  +	 *  Constructor for the GraphModel object
  +
  +	 */
  +
  +	public GraphModel()
  +
  +	{
  +
  +		listeners = new LinkedList();
  +
  +		samples = Collections.synchronizedList(new LinkedList());
  +
  +	}
  +
  +
  +
  +	public void uncompile()
  +
  +	{
  +
  +	}
  +
  +	public Class getTagHandlerClass()
  +	{
  +		return org.apache.jmeter.save.handlers.JMeterComponentHandler.class;
  +	}
  +
  +
  +
  +	protected void fireDataChanged()
  +
  +	{
  +
  +		Iterator iter = listeners.iterator();
  +
  +		if(bigChange)
  +
  +		{
  +
  +			while (iter.hasNext())
  +
  +			{
  +
  +				((ModelSupported)iter.next()).updateGui();
  +
  +			}
  +
  +			bigChange = false;
  +
  +		}
  +
  +		else
  +
  +		{
  +
  +			quickUpdate(current);
  +
  +		}
  +
  +	}
  +
  +
  +
  +	protected void quickUpdate(Sample s)
  +
  +	{
  +
  +		Iterator iter = listeners.iterator();
  +
  +		{
  +
  +			while (iter.hasNext())
  +
  +			{
  +
  +				((GraphListener)iter.next()).updateGui(s);
  +
  +			}
  +
  +		}
  +
  +	}
  +
  +
  +
  +	public long getCurrentData()
  +
  +	{
  +
  +		return current.data;
  +
  +	}
  +
  +
  +
  +	public long getCurrentAverage()
  +
  +	{
  +
  +		return current.average;
  +
  +	}
  +
  +
  +
  +	public long getCurrentDeviation()
  +
  +	{
  +
  +		return current.deviation;
  +
  +	}
  +
  +
  +
  +	public int getSampleCount()
  +
  +	{
  +
  +		return samples.size();
  +
  +	}
  +
  +
  +
  +	public void addModelListener(java.awt.Component modelListener)
  +
  +	{
  +
  +		listeners.add(modelListener);
  +
  +	}
  +
  +
  +
  +	public List getSamples()
  +
  +	{
  +
  +		return samples;
  +
  +	}
  +
  +
  +
  +	/**
  +
  +	 *  Sets the Name attribute of the GraphModel object
  +
  +	 *
  +
  +	 *@param  name  The new Name value
  +
  +	 */
  +
  +	public void setName(String name)
  +
  +	{
  +
  +		this.name = name;
  +
  +	}
  +
  +
  +
  +	/**
  +
  +	 *  Gets the GuiClass attribute of the GraphModel object
  +
  +	 *
  +
  +	 *@return    The GuiClass value
  +
  +	 */
  +
  +	public Class getGuiClass()
  +
  +	{
  +
  +		return GraphVisualizer.class;
  +
  +	}
  +
  +
  +
  +	/**
  +
  +	 *  Gets the Name attribute of the GraphModel object
  +
  +	 *
  +
  +	 *@return    The Name value
  +
  +	 */
  +
  +	public String getName()
  +
  +	{
  +
  +		return name;
  +
  +	}
  +
  +
  +
  +	/**
  +
  +	 *  Gets the Editable attribute of the GraphModel object
  +
  +	 *
  +
  +	 *@return    The Editable value
  +
  +	 */
  +
  +	public boolean isEditable()
  +
  +	{
  +
  +		return false;
  +
  +	}
  +
  +
  +
  +	/**
  +
  +	 *  Gets the AddList attribute of the GraphModel object
  +
  +	 *
  +
  +	 *@return    The AddList value
  +
  +	 */
  +
  +	public Collection getAddList()
  +
  +	{
  +
  +		return null;
  +
  +	}
  +
  +
  +
  +	/**
  +
  +	 *  Gets the ClassLabel attribute of the GraphModel object
  +
  +	 *
  +
  +	 *@return    The ClassLabel value
  +
  +	 */
  +
  +	public String getClassLabel()
  +
  +	{
  +
  +		return "Graph Results";
  +
  +	}
  +
  +
  +
  +	public void sampleOccurred(SampleEvent e)
  +
  +	{
  +
  +		addNewSample(e.getResult().getTime());
  +
  +		this.fireDataChanged();
  +
  +	}
  +
  +
  +
  +	public void sampleStarted(SampleEvent e)
  +
  +	{
  +
  +	}
  +
  +
  +
  +	public long getMax()
  +
  +	{
  +
  +		return max;
  +
  +	}
  +
  +
  +
  +	public void clear()
  +
  +	{
  +
  +			samples.clear();
  +
  +			averageSum = 0;
  +
  +			variationSum = 0;
  +
  +			counter = 0;
  +
  +			previous = 0;
  +
  +			max = 1;
  +
  +			bigChange = true;
  +
  +			current = new Sample(0,0,0);
  +
  +		this.fireDataChanged();
  +
  +	}
  +
  +
  +
  +	private void addNewSample(long sample)
  +
  +	{
  +
  +			if (sample > max)
  +
  +			{
  +
  +			bigChange = true;
  +
  +			max = sample;
  +
  +			}
  +
  +			averageSum += sample;
  +
  +			long average = averageSum / ++counter;
  +
  +			variationSum += Math.pow(sample - average, 2);
  +
  +			long deviation = (long) Math.pow(variationSum / counter, 0.5);
  +
  +			Sample s = new Sample(sample, average, deviation);
  +
  +			previous = sample;
  +
  +			current = s;
  +
  +			samples.add(s);
  +
  +	}
  +
  +
  +
  +	public void sampleStopped(SampleEvent e)
  +
  +	{
  +
  +	}
  +
  +}
  +
  
  
  
  1.6       +477 -236  jakarta-jmeter/src/org/apache/jmeter/visualizers/SplineModel.java
  
  Index: SplineModel.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jmeter/src/org/apache/jmeter/visualizers/SplineModel.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- SplineModel.java	2001/03/17 22:26:00	1.5
  +++ SplineModel.java	2001/06/10 02:15:50	1.6
  @@ -1,237 +1,478 @@
  -/*
  - * ====================================================================
  - * The Apache Software License, Version 1.1
  - *
  - * Copyright (c) 2001 The Apache Software Foundation.  All rights
  - * reserved.
  - *
  - * Redistribution and use in source and binary forms, with or without
  - * modification, are permitted provided that the following conditions
  - * are met:
  - *
  - * 1. Redistributions of source code must retain the above copyright
  - * notice, this list of conditions and the following disclaimer.
  - *
  - * 2. Redistributions in binary form must reproduce the above copyright
  - * notice, this list of conditions and the following disclaimer in
  - * the documentation and/or other materials provided with the
  - * distribution.
  - *
  - * 3. The end-user documentation included with the redistribution,
  - * if any, must include the following acknowledgment:
  - * "This product includes software developed by the
  - * Apache Software Foundation (http://www.apache.org/)."
  - * Alternately, this acknowledgment may appear in the software itself,
  - * if and wherever such third-party acknowledgments normally appear.
  - *
  - * 4. The names "Apache" and "Apache Software Foundation" and
  - * "Apache JMeter" must not be used to endorse or promote products
  - * derived from this software without prior written permission. For
  - * written permission, please contact apache@apache.org.
  - *
  - * 5. Products derived from this software may not be called "Apache",
  - * "Apache JMeter", nor may "Apache" appear in their name, without
  - * prior written permission of the Apache Software Foundation.
  - *
  - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  - * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
  - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  - * SUCH DAMAGE.
  - * ====================================================================
  - *
  - * This software consists of voluntary contributions made by many
  - * individuals on behalf of the Apache Software Foundation.  For more
  - * information on the Apache Software Foundation, please see
  - * <http://www.apache.org/>.
  - */
  - package org.apache.jmeter.visualizers;
  -
  -import java.util.*;
  -
  -import org.apache.jmeter.samplers.*;
  -import org.apache.jmeter.gui.*;
  -
  -/**
  - * Title:        JMeter
  - * Description:
  - * Copyright:    Copyright (c) 2000
  - * Company:      Apache
  - * @author Michael Stover
  - * @version 1.0
  - */
  -
  -public class SplineModel implements SampleListener,JMeterComponentModel
  -{
  -protected final boolean SHOW_INCOMING_SAMPLES = true;
  -		 public final int DEFAULT_NUMBER_OF_NODES = 10;
  -	 public final int DEFAULT_REFRESH_PERIOD = 1;
  -	 protected int numberOfNodes = DEFAULT_NUMBER_OF_NODES;
  -	 protected int refreshPeriod = DEFAULT_REFRESH_PERIOD;
  -
  -	protected Spline3 dataCurve = null; // current Spline curve
  -
  -	 protected long sum = 0; // sum of the samples
  -
  -	 protected long average = 0; // average of the samples
  -
  -	 protected long n = 0; // number of collected samples
  -
  -	 private ModelSupported listener;
  -
  -	 private long minimum = Integer.MAX_VALUE,maximum = Integer.MIN_VALUE,incoming;
  -	 ArrayList samples;
  -	private String name;
  -
  -	public SplineModel()
  -	{
  -		samples = new ArrayList();
  -	}
  -
  -	public void uncompile()
  -	{
  -	}
  -
  -	public boolean isEditable()
  -	{
  -		return true;
  -	}
  -
  -	public Spline3 getDataCurve()
  -	{
  -		return dataCurve;
  -	}
  -
  -	public Class getGuiClass()
  -	{
  -		return org.apache.jmeter.visualizers.SplineVisualizer.class;
  -	}
  -
  -
  -	public Collection getAddList()
  -	{
  -		return null;
  -	}
  -
  -	public String getClassLabel()
  -	{
  -		return "Spline Visualizer";
  -	}
  -
  -	public void setListener(ModelSupported vis)
  -	{
  -		listener = vis;
  -	}
  -
  -	public void sampleOccurred(SampleEvent e)
  -	{
  -		this.add(e.getResult());
  -	}
  -
  -	public void sampleStarted(SampleEvent e)
  -	{
  -	}
  -
  -	public void sampleStopped(SampleEvent e)
  -	{
  -	}
  -
  -	public synchronized void clear() {
  -		  //this.graph.clear();
  -		  samples.clear();
  -		  this.n = 0;
  -		  this.sum = 0;
  -		  this.average = 0;
  -		  minimum = Integer.MAX_VALUE;
  -		  maximum = Integer.MIN_VALUE;
  -		  this.dataCurve = null;
  -		  listener.updateGui();
  -	 }
  -
  -	 public long getMinimum()
  -	 {
  -		return minimum;
  -	 }
  -
  -	 public long getMaximum()
  -	 {
  -		return maximum;
  -	 }
  -
  -	 public long getAverage()
  -	 {
  -		return average;
  -	 }
  -
  -	 public long getCurrent()
  -	 {
  -		return incoming;
  -	 }
  -
  -	public synchronized void add(SampleResult sampleResult) {
  -		long sample = sampleResult.getTime();
  -		  this.n++;
  -		  this.sum += sample;
  -		  this.average = this.sum / this.n;
  -		  if (SHOW_INCOMING_SAMPLES) {
  -				incoming = sample;
  -		  }
  -		  if(sample > maximum)
  -						maximum = sample;
  -		  if(sample < minimum)
  -						minimum = sample;
  -		  samples.add(new Long(sample));
  -		  int n = getNumberOfCollectedSamples();
  -		  if ((n % (numberOfNodes * refreshPeriod)) == 0) {
  -				float[] floatNode = new float[numberOfNodes];
  -				long[] longSample = getSamples();
  -				// load each node
  -				int loadFactor = n / numberOfNodes;
  -				for (int i = 0; i < numberOfNodes; i++) {
  -					 for (int j = 0; j < loadFactor; j++) {
  -						  floatNode[i] += getSample((i * loadFactor) + j);
  -					 }
  -					 floatNode[i] = floatNode[i] / loadFactor;
  -				}
  -				// compute the new Spline curve
  -				dataCurve = new Spline3(floatNode);
  -				listener.updateGui();
  -		  }
  -		  else {
  -				// do nothing, wait for the next pile to complete
  -		  }
  -	 }
  -
  -		  public long[] getSamples() {
  -				int n = samples.size();
  -				long[] longSample = new long[n];
  -				for (int i = 0; i < n; i++) {
  -					 longSample[i] = ((Long)samples.get(i)).longValue();
  -				}
  -				return longSample;
  -		  }
  -
  -		  public long getSample(int i) {
  -				Long sample = (Long)this.samples.get(i);
  -				return sample.longValue();
  -		  }
  -
  -		  public int getNumberOfCollectedSamples() {
  -				return this.samples.size();
  -		  }
  -	public void setName(String newName)
  -	{
  -		name = newName;
  -	}
  -	public String getName()
  -	{
  -		return name;
  -	}
  +/*
  +
  + * ====================================================================
  +
  + * The Apache Software License, Version 1.1
  +
  + *
  +
  + * Copyright (c) 2001 The Apache Software Foundation.  All rights
  +
  + * reserved.
  +
  + *
  +
  + * Redistribution and use in source and binary forms, with or without
  +
  + * modification, are permitted provided that the following conditions
  +
  + * are met:
  +
  + *
  +
  + * 1. Redistributions of source code must retain the above copyright
  +
  + * notice, this list of conditions and the following disclaimer.
  +
  + *
  +
  + * 2. Redistributions in binary form must reproduce the above copyright
  +
  + * notice, this list of conditions and the following disclaimer in
  +
  + * the documentation and/or other materials provided with the
  +
  + * distribution.
  +
  + *
  +
  + * 3. The end-user documentation included with the redistribution,
  +
  + * if any, must include the following acknowledgment:
  +
  + * "This product includes software developed by the
  +
  + * Apache Software Foundation (http://www.apache.org/)."
  +
  + * Alternately, this acknowledgment may appear in the software itself,
  +
  + * if and wherever such third-party acknowledgments normally appear.
  +
  + *
  +
  + * 4. The names "Apache" and "Apache Software Foundation" and
  +
  + * "Apache JMeter" must not be used to endorse or promote products
  +
  + * derived from this software without prior written permission. For
  +
  + * written permission, please contact apache@apache.org.
  +
  + *
  +
  + * 5. Products derived from this software may not be called "Apache",
  +
  + * "Apache JMeter", nor may "Apache" appear in their name, without
  +
  + * prior written permission of the Apache Software Foundation.
  +
  + *
  +
  + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  +
  + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  +
  + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  +
  + * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
  +
  + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  +
  + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  +
  + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  +
  + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  +
  + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  +
  + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  +
  + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  +
  + * SUCH DAMAGE.
  +
  + * ====================================================================
  +
  + *
  +
  + * This software consists of voluntary contributions made by many
  +
  + * individuals on behalf of the Apache Software Foundation.  For more
  +
  + * information on the Apache Software Foundation, please see
  +
  + * <http://www.apache.org/>.
  +
  + */
  +
  + package org.apache.jmeter.visualizers;
  +
  +
  +
  +import java.util.*;
  +
  +
  +
  +import org.apache.jmeter.samplers.*;
  +
  +import org.apache.jmeter.gui.*;
  +import org.apache.jmeter.save.Saveable;
  +
  +
  +
  +/**
  +
  + * Title:        JMeter
  +
  + * Description:
  +
  + * Copyright:    Copyright (c) 2000
  +
  + * Company:      Apache
  +
  + * @author Michael Stover
  +
  + * @version 1.0
  +
  + */
  +
  +
  +
  +public class SplineModel implements SampleListener,JMeterComponentModel,Saveable
  +
  +{
  +
  +protected final boolean SHOW_INCOMING_SAMPLES = true;
  +
  +		 public final int DEFAULT_NUMBER_OF_NODES = 10;
  +
  +	 public final int DEFAULT_REFRESH_PERIOD = 1;
  +
  +	 protected int numberOfNodes = DEFAULT_NUMBER_OF_NODES;
  +
  +	 protected int refreshPeriod = DEFAULT_REFRESH_PERIOD;
  +
  +
  +
  +	protected Spline3 dataCurve = null; // current Spline curve
  +
  +
  +
  +	 protected long sum = 0; // sum of the samples
  +
  +
  +
  +	 protected long average = 0; // average of the samples
  +
  +
  +
  +	 protected long n = 0; // number of collected samples
  +
  +
  +
  +	 private ModelSupported listener;
  +
  +
  +
  +	 private long minimum = Integer.MAX_VALUE,maximum = Integer.MIN_VALUE,incoming;
  +
  +	 ArrayList samples;
  +
  +	private String name;
  +
  +
  +
  +	public SplineModel()
  +
  +	{
  +
  +		samples = new ArrayList();
  +
  +	}
  +
  +	public Class getTagHandlerClass()
  +	{
  +		return org.apache.jmeter.save.handlers.JMeterComponentHandler.class;
  +	}
  +
  +
  +	public void uncompile()
  +
  +	{
  +
  +	}
  +
  +
  +
  +	public boolean isEditable()
  +
  +	{
  +
  +		return true;
  +
  +	}
  +
  +
  +
  +	public Spline3 getDataCurve()
  +
  +	{
  +
  +		return dataCurve;
  +
  +	}
  +
  +
  +
  +	public Class getGuiClass()
  +
  +	{
  +
  +		return org.apache.jmeter.visualizers.SplineVisualizer.class;
  +
  +	}
  +
  +
  +
  +
  +
  +	public Collection getAddList()
  +
  +	{
  +
  +		return null;
  +
  +	}
  +
  +
  +
  +	public String getClassLabel()
  +
  +	{
  +
  +		return "Spline Visualizer";
  +
  +	}
  +
  +
  +
  +	public void setListener(ModelSupported vis)
  +
  +	{
  +
  +		listener = vis;
  +
  +	}
  +
  +
  +
  +	public void sampleOccurred(SampleEvent e)
  +
  +	{
  +
  +		this.add(e.getResult());
  +
  +	}
  +
  +
  +
  +	public void sampleStarted(SampleEvent e)
  +
  +	{
  +
  +	}
  +
  +
  +
  +	public void sampleStopped(SampleEvent e)
  +
  +	{
  +
  +	}
  +
  +
  +
  +	public synchronized void clear() {
  +
  +		  //this.graph.clear();
  +
  +		  samples.clear();
  +
  +		  this.n = 0;
  +
  +		  this.sum = 0;
  +
  +		  this.average = 0;
  +
  +		  minimum = Integer.MAX_VALUE;
  +
  +		  maximum = Integer.MIN_VALUE;
  +
  +		  this.dataCurve = null;
  +
  +		  listener.updateGui();
  +
  +	 }
  +
  +
  +
  +	 public long getMinimum()
  +
  +	 {
  +
  +		return minimum;
  +
  +	 }
  +
  +
  +
  +	 public long getMaximum()
  +
  +	 {
  +
  +		return maximum;
  +
  +	 }
  +
  +
  +
  +	 public long getAverage()
  +
  +	 {
  +
  +		return average;
  +
  +	 }
  +
  +
  +
  +	 public long getCurrent()
  +
  +	 {
  +
  +		return incoming;
  +
  +	 }
  +
  +
  +
  +	public synchronized void add(SampleResult sampleResult) {
  +
  +		long sample = sampleResult.getTime();
  +
  +		  this.n++;
  +
  +		  this.sum += sample;
  +
  +		  this.average = this.sum / this.n;
  +
  +		  if (SHOW_INCOMING_SAMPLES) {
  +
  +				incoming = sample;
  +
  +		  }
  +
  +		  if(sample > maximum)
  +
  +						maximum = sample;
  +
  +		  if(sample < minimum)
  +
  +						minimum = sample;
  +
  +		  samples.add(new Long(sample));
  +
  +		  int n = getNumberOfCollectedSamples();
  +
  +		  if ((n % (numberOfNodes * refreshPeriod)) == 0) {
  +
  +				float[] floatNode = new float[numberOfNodes];
  +
  +				long[] longSample = getSamples();
  +
  +				// load each node
  +
  +				int loadFactor = n / numberOfNodes;
  +
  +				for (int i = 0; i < numberOfNodes; i++) {
  +
  +					 for (int j = 0; j < loadFactor; j++) {
  +
  +						  floatNode[i] += getSample((i * loadFactor) + j);
  +
  +					 }
  +
  +					 floatNode[i] = floatNode[i] / loadFactor;
  +
  +				}
  +
  +				// compute the new Spline curve
  +
  +				dataCurve = new Spline3(floatNode);
  +
  +				listener.updateGui();
  +
  +		  }
  +
  +		  else {
  +
  +				// do nothing, wait for the next pile to complete
  +
  +		  }
  +
  +	 }
  +
  +
  +
  +		  public long[] getSamples() {
  +
  +				int n = samples.size();
  +
  +				long[] longSample = new long[n];
  +
  +				for (int i = 0; i < n; i++) {
  +
  +					 longSample[i] = ((Long)samples.get(i)).longValue();
  +
  +				}
  +
  +				return longSample;
  +
  +		  }
  +
  +
  +
  +		  public long getSample(int i) {
  +
  +				Long sample = (Long)this.samples.get(i);
  +
  +				return sample.longValue();
  +
  +		  }
  +
  +
  +
  +		  public int getNumberOfCollectedSamples() {
  +
  +				return this.samples.size();
  +
  +		  }
  +
  +	public void setName(String newName)
  +
  +	{
  +
  +		name = newName;
  +
  +	}
  +
  +	public String getName()
  +
  +	{
  +
  +		return name;
  +
  +	}
  +
   }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org


Mime
View raw message