All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.lazerycode.jmeter.analyzer.parser.AggregatedResponses Maven / Gradle / Ivy

Go to download

Parses JMeter result files and computes performance indicators such as average request duration

The newest version!
package com.lazerycode.jmeter.analyzer.parser;

import com.lazerycode.jmeter.analyzer.statistics.Samples;

import java.util.Date;
import java.util.Map;
import java.util.Set;

/**
 * Holds aggregated data for several http responses.
 *
 * @author Arne Franken, Peter Kaul
 */
public class AggregatedResponses {

  /**
   * Timestamp when the test has started
   */
  private long start;

  /**
   * Timestamp when the test has ended
   */
  private long end;

  /**
   * size of the responses
   */
  private Samples size;

  /**
   * size of the responses splitted by uri
   */
  private Map sizeByUri;

  /**
   * duration of the responses
   */
  private Samples duration;

  /**
   * Number of thread
   */
  private Samples activeThreads;

  /**
   * duration of the responses splitted by uri
   */
  private Map durationByUri;

  /**
   * aggregated status codes of responses
   */
  private StatusCodes statusCodes;

  /**
   * uri of the response splitted by http status code
   */
  private Map> uriByStatusCode;



  /**
   * @return Timestamp when the test has started
   */
  public long getStart() {
    return start;
  }

  /**
   * @return Date when the test has started
   */
  public Date getStartDate() {
    return new Date(start);
  }

  protected void setStart(long start) {
    this.start = start;
  }

  /**
   * @return Timestamp when the test has ended
   */
  public long getEnd() {
    return end;
  }

  /**
   * @return Date when the test has ended
   */
  public Date getEndDate() {
    return new Date(end);
  }

  protected void setEnd(long end) {
    this.end = end;
  }

  /**
   * @return Aggregation for size of responses
   */
  public Samples getSize() {
    return size;
  }

  protected void setSize(Samples size) {
    this.size = size;
  }

  /**
   * @return Aggregation for response duration
   */
  public Samples getDuration() {
    return duration;
  }

  protected void setDuration(Samples duration) {
    this.duration = duration;
  }

  /**
   * @return
   */
  public Samples getActiveThreads() {
    return activeThreads;
  }

  /**
   * @param activeThreads
   */
  protected void setActiveThreads(Samples activeThreads) {
    this.activeThreads = activeThreads;
  }

  /**
   * @return aggregated status codes of responses
   */
  public StatusCodes getStatusCodes() {
    return statusCodes;
  }

  protected void setStatusCodes(StatusCodes statusCodes) {
    this.statusCodes = statusCodes;
  }

  /**
   * @return a mapping from uri to sample data
   */
  public Map getSizeByUri() {
    return sizeByUri;
  }

  protected void setSizeByUri(Map sizeByUri) {
    this.sizeByUri = sizeByUri;
  }

  /**
   * @return a mapping from uri to sample data
   */
  public Map getDurationByUri() {
    return durationByUri;
  }

  protected void setDurationByUri(Map durationByUri) {
    this.durationByUri = durationByUri;
  }

  /**
   *
   * @return a mapping from status code to uri
   */
  public Map> getUriByStatusCode() {
    return uriByStatusCode;
  }

  protected void setUriByStatusCode(Map> uriByStatusCode) {
    this.uriByStatusCode = uriByStatusCode;
  }

  //--------------------------------------------------------------------------------------------------------------------

  /**
   * Mark collecting of samples as "finished"
   */
  protected void finish() {

    if( size != null ) {
      size.finish();
    }
    if( duration != null ) {
      duration.finish();
    }
    if ( activeThreads != null ) {
        activeThreads.finish();
    }
    if( sizeByUri != null ) {
      for( Samples s : sizeByUri.values() ) {
        s.finish();
      }
    }

    if( durationByUri != null ) {
      for( Samples s : durationByUri.values() ) {
        s.finish();
      }
    }

  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy