edu.vt.marian.common
Class PerformanceMeasurement

java.lang.Object
  |
  +--edu.vt.marian.common.PerformanceMeasurement

public class PerformanceMeasurement
extends java.lang.Object

Class name: PerformanceMeasurement

Class description: this class is used to do system performance measurement, it will record time for each measurement automatically, caculate the average, and dump all the results to a file in human readable format


Field Summary
static int FILE_WRITE_ERROR
           
static int INVALID_ID
           
static int OK
          possible return values of methods
 
Constructor Summary
PerformanceMeasurement()
          this constructor will create a PerformanceMeasurement object, there is no Measurement at this time
 
Method Summary
 int add_measurement(java.lang.String description)
          this will add a new measurement into this object, the return value is the id of this Measurement and can be used to do measure later
 int dump_to_file(java.lang.String file_name, boolean append)
          this method will dump all the result of this object so far into the file in human readable format, it will rewrite the file or append to the end of it depending on the parameter append
 int dump_to_file(java.lang.String file_name, int measurement_id, boolean append)
          this method will dump all the result of the specified measurement so far into the file in human readable format, it will rewrite the file or append to the end of it depending on the parameter append
 int end_measure(int measurement_id)
          this method will record a end time for the specified measurement_id
 int start_measure(int measurement_id)
          this method will record a start time for the Measurement specified by the parameter measurement_id
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

OK

public static final int OK
possible return values of methods

INVALID_ID

public static final int INVALID_ID

FILE_WRITE_ERROR

public static final int FILE_WRITE_ERROR
Constructor Detail

PerformanceMeasurement

public PerformanceMeasurement()
this constructor will create a PerformanceMeasurement object, there is no Measurement at this time
Method Detail

add_measurement

public int add_measurement(java.lang.String description)
this will add a new measurement into this object, the return value is the id of this Measurement and can be used to do measure later

start_measure

public int start_measure(int measurement_id)
this method will record a start time for the Measurement specified by the parameter measurement_id

end_measure

public int end_measure(int measurement_id)
this method will record a end time for the specified measurement_id

dump_to_file

public int dump_to_file(java.lang.String file_name,
                        boolean append)
this method will dump all the result of this object so far into the file in human readable format, it will rewrite the file or append to the end of it depending on the parameter append

dump_to_file

public int dump_to_file(java.lang.String file_name,
                        int measurement_id,
                        boolean append)
this method will dump all the result of the specified measurement so far into the file in human readable format, it will rewrite the file or append to the end of it depending on the parameter append