You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jmeter-dev@jakarta.apache.org by wo...@apache.org on 2004/09/18 07:04:55 UTC

cvs commit: jakarta-jmeter/src/core/org/apache/jmeter/visualizers SamplingStatCalculator.java

woolfel     2004/09/17 22:04:55

  Modified:    src/core/org/apache/jmeter/resources messages.properties
               src/core/org/apache/jmeter/visualizers
                        SamplingStatCalculator.java
  Log:
  the aggregate listener now has kb/sec as the last column. It's not
  exactly what the original user wanted, but I think it's more useful.
  
  peter
  
  Revision  Changes    Path
  1.123     +1 -0      jakarta-jmeter/src/core/org/apache/jmeter/resources/messages.properties
  
  Index: messages.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-jmeter/src/core/org/apache/jmeter/resources/messages.properties,v
  retrieving revision 1.122
  retrieving revision 1.123
  diff -u -r1.122 -r1.123
  --- messages.properties	20 Aug 2004 06:33:13 -0000	1.122
  +++ messages.properties	18 Sep 2004 05:04:55 -0000	1.123
  @@ -15,6 +15,7 @@
   aggregate_report_max=Max
   aggregate_report_error%=Error %
   aggregate_report_rate=Throughput
  +aggregate_report_bandwidth=KB/sec
   als_message=Note\: The Access Log Parser is generic in design and allows you to plugin
   als_message2=your own parser. To do so, implement the LogParser, add the jar to the
   als_message3=/lib directory and enter the class in the sampler.
  
  
  
  1.2       +31 -2     jakarta-jmeter/src/core/org/apache/jmeter/visualizers/SamplingStatCalculator.java
  
  Index: SamplingStatCalculator.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jmeter/src/core/org/apache/jmeter/visualizers/SamplingStatCalculator.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SamplingStatCalculator.java	28 May 2004 21:09:13 -0000	1.1
  +++ SamplingStatCalculator.java	18 Sep 2004 05:04:55 -0000	1.2
  @@ -44,6 +44,7 @@
      static Logger log = LoggingManager.getLoggerForClass();
       private static DecimalFormat rateFormatter = new DecimalFormat("#.0");
       private static DecimalFormat errorFormatter = new DecimalFormat("#0.00%");
  +	private static DecimalFormat kbFormatter = new DecimalFormat("#0.00");
       
       private StatCalculator calculator = new StatCalculator();
       private ArrayList storedValues = new ArrayList();
  @@ -174,6 +175,33 @@
           return (rval);
       }
   
  +	/**
  +	 * calculates the average page size, which means
  +	 * divide the bytes by number of samples.
  +	 * @return
  +	 */
  +	public double getPageSize()
  +	{
  +		double rate = 0;
  +		if (this.getElapsed() > 0 && calculator.getTotalBytes() > 0){
  +			rate = (double)calculator.getTotalBytes()/
  +				((double)this.getElapsed()/1000);
  +		}
  +		if (rate < 0){
  +			rate = 0;
  +		}
  +		return rate;
  +	}
  +	
  +	/**
  +	 * formats the rate
  +	 * @return
  +	 */
  +	public String getPageSizeString(){
  +		double rate = getPageSize()/1024;
  +		return kbFormatter.format(rate);
  +	}
  +	
       public String getLabel()
       {
           return label;
  @@ -189,6 +217,7 @@
          synchronized(calculator)
          {
             calculator.addValue(res.getTime());
  +          calculator.addBytes((long)res.getResponseData().length);
           setStartTime(res);         
           long eCount = getCurrentSample().errorCount;
           if (!res.isSuccessful())
  
  
  

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