Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: measurements/suites/CalibrationMeasurement.java


1   // $Id: CalibrationMeasurement.java,v 1.1.1.1 2003/07/02 15:30:45 apopovic Exp $
2   // =====================================================================
3   //
4   // (history at end)
5   //
6   
7   package measurements.suites;
8   
9   // used packages
10  import junit.framework.Test;
11  import ch.ethz.inf.util.junit.PerformanceTest;
12  import ch.ethz.inf.util.junit.PerformanceTestSuite;
13  
14  /**
15   * JUnit testcase for testing how fast is the framework itself
16   * if we let'it run without measuring anything (void calls in
17   * the <code>RUNS</code> loop).
18   *
19   * @version  $Revision: 1.1.1.1 $
20   * @author  Andrei Popovici
21   */
22  public class CalibrationMeasurement extends PerformanceTest {
23  
24    // fixture
25    { RANGE = new int[]{20000000}; }
26  
27    public void theMethodToCall()
28    {
29      int a;
30      a=1;
31    }
32  
33    /**
34     * Construct test with given name.
35     * @param name test name
36     */
37    public CalibrationMeasurement(String name)
38    {
39      super(name);
40    }
41  
42    /**
43     * Set up fixture.
44     */
45    protected void setUp()
46    {
47    }
48  
49    /**
50     *
51     */
52    protected void tearDown()
53    {
54    }
55  
56    public void testVoid()
57    {
58          startChronometer();
59      for (int i = 0; i < RUNS; i++)
60      {
61      }
62          stopChronometer();
63    }
64  
65    public void testLocalCalls()
66    {
67          startChronometer();
68      for (int i = 0; i < RUNS; i++)
69      {
70        theMethodToCall();
71      }
72          stopChronometer();
73    }
74  
75    /**
76     * Test suite.
77     * @return test instance
78     */
79    public static Test suite()
80    {
81      return new PerformanceTestSuite(CalibrationMeasurement.class);
82    }
83  
84  }
85  
86  
87  //======================================================================
88  //
89  // $Log: CalibrationMeasurement.java,v $
90  // Revision 1.1.1.1  2003/07/02 15:30:45  apopovic
91  // Imported from ETH Zurich
92  //
93  // Revision 1.3  2003/03/04 18:36:00  popovici
94  // Organization of imprts
95  //
96  // Revision 1.2  2002/02/15 12:31:09  smarkwal
97  // minor changes like spaces/tabs, setUp
98  //
99  // Revision 1.1.1.1  2001/11/29 18:13:34  popovici
100 // Sources from runes
101 //
102 // Revision 1.1.2.2  2001/02/07 12:07:41  popovici
103 // measurement 'testLocalCalls' added to the calibration Measurement.
104 //
105 // Revision 1.1.2.1  2000/11/30 19:27:22  popovici
106 // Initial Revision
107 //