Package measurements.suites

Source Code of measurements.suites.CalibrationMeasurement

// $Id: CalibrationMeasurement.java,v 1.2 2008/11/18 10:41:01 anicoara Exp $
// =====================================================================

package measurements.suites;

// used packages
import junit.framework.Test;
import ch.ethz.inf.util.junit.PerformanceTest;
import ch.ethz.inf.util.junit.PerformanceTestSuite;

/**
* JUnit testcase for testing how fast is the framework itself
* if we let'it run without measuring anything (void calls in
* the <code>RUNS</code> loop).
*
* @version  $Revision: 1.2 $
* @author  Andrei Popovici
*/
public class CalibrationMeasurement extends PerformanceTest {

  // fixture
  { RANGE = new int[]{20000000}; }

  public void theMethodToCall() {
    int a;
    a=1;
  }

  /**
   * Construct test with given name.
   * @param name test name
   */
  public CalibrationMeasurement(String name) {
    super(name);
  }

  /**
   * Set up fixture.
   */
  protected void setUp() { }

  protected void tearDown() { }

  public void testVoid() {
    startChronometer();
    for (int i = 0; i < RUNS; i++) { }
    stopChronometer();
  }

  public void testLocalCalls() {
    startChronometer();
    for (int i = 0; i < RUNS; i++) {
      theMethodToCall();
    }
    stopChronometer();
  }

  /**
   * Test suite.
   * @return test instance
   */
  public static Test suite() {
    return new PerformanceTestSuite(CalibrationMeasurement.class);
  }

}
TOP

Related Classes of measurements.suites.CalibrationMeasurement

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.