gate.util
Class Benchmark

java.lang.Object
  extended by gate.util.Benchmark

public class Benchmark
extends Object

This class provides methods for making entries in the shared log maintained by the GATE system. User should use various methods provided by this class and as described in the following example.

TODO: Provide example here.

Author:
niraj

Field Summary
static String ANNOTS_TO_NLP_FEATURES
           
static String APPLICATION_NAME_FEATURE
          application name feature
protected static boolean benchmarkingEnabled
          variable that keeps track of if logging is ON or OFF.
static String CORPUS_NAME_FEATURE
          corpus name feature
static String DOCUMENT_LOADED
           
static String DOCUMENT_NAME_FEATURE
          document name feature
static String DOCUMENT_SAVED
           
static String EVALUATION
           
static String FILTERING
           
static org.apache.log4j.Logger logger
          Static shared logger used for logging.
static String MESSAGE_FEATURE
          message feature
static String MODEL_APPLICATION
           
static String MODEL_TRAINING
           
static String NLP_FEATURES_TO_FVS
           
static String NLP_LABELS_TO_DATA_LABELS
           
static String PAUM_MODEL_APPLICATION
           
static String PAUM_MODEL_TRAINING
           
static String POST_PROCESSING
           
static String PR_NAME_FEATURE
          processing resource name feature
static String PR_PREFIX
           
static String READING_CHUNK_LEARNING_DATA
           
static String READING_FVS
           
static String READING_LEARNING_INFO
           
static String READING_NLP_FEATURES
           
static String TERM_DOC_STATS
           
static String WEKA_MODEL_APPLICATION
           
static String WEKA_MODEL_TRAINING
           
static String WRITING_FVS_TO_DISK
           
static String WRITING_NGRAM_MODEL
           
 
Constructor Summary
Benchmark()
           
 
Method Summary
static void checkPoint(long startTime, String benchmarkID, Object objectInvokingThisCheckPoint, Map benchmarkingFeatures)
          This method is responsible for making entries into the log.
static void checkPoint(String benchmarkID, Object objectInvokingThisCheckPoint, Map benchmarkingFeatures)
          Logs the end of a process.
static void checkPointWithDuration(long totalTime, String benchmarkID, Object objectInvokingThisCheckPoint, Map benchmarkingFeatures)
          This method is responsible for making entries into the log.
static String createBenchmarkId(String resourceName, String parentBenchmarkID)
          Helper method to generate the benchmark ID.
static void executeWithBenchmarking(Executable executable, String benchmarkID, Object objectInvokingThisCheckPoint, Map benchmarkingFeatures)
          Executes the given Executable, logging its runtime under the given benchmark ID (which is propagated to the Executable if it is itself Benchmarkable).
static boolean isBenchmarkingEnabled()
          Returns if the logging is enabled.
static void setBenchmarkingEnabled(boolean benchmarkingEnabled)
          Enables or disables the logging.
static long startPoint()
          This returns the current system time.
static long startPoint(String benchmarkID)
          Like startPoint() but also logs a message with the starting time if benchmarking is enabled.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

benchmarkingEnabled

protected static boolean benchmarkingEnabled
variable that keeps track of if logging is ON or OFF.


CORPUS_NAME_FEATURE

public static final String CORPUS_NAME_FEATURE
corpus name feature

See Also:
Constant Field Values

APPLICATION_NAME_FEATURE

public static final String APPLICATION_NAME_FEATURE
application name feature

See Also:
Constant Field Values

DOCUMENT_NAME_FEATURE

public static final String DOCUMENT_NAME_FEATURE
document name feature

See Also:
Constant Field Values

PR_NAME_FEATURE

public static final String PR_NAME_FEATURE
processing resource name feature

See Also:
Constant Field Values

MESSAGE_FEATURE

public static final String MESSAGE_FEATURE
message feature

See Also:
Constant Field Values

PR_PREFIX

public static final String PR_PREFIX
See Also:
Constant Field Values

DOCUMENT_LOADED

public static final String DOCUMENT_LOADED
See Also:
Constant Field Values

DOCUMENT_SAVED

public static final String DOCUMENT_SAVED
See Also:
Constant Field Values

WRITING_FVS_TO_DISK

public static final String WRITING_FVS_TO_DISK
See Also:
Constant Field Values

ANNOTS_TO_NLP_FEATURES

public static final String ANNOTS_TO_NLP_FEATURES
See Also:
Constant Field Values

NLP_FEATURES_TO_FVS

public static final String NLP_FEATURES_TO_FVS
See Also:
Constant Field Values

READING_LEARNING_INFO

public static final String READING_LEARNING_INFO
See Also:
Constant Field Values

MODEL_APPLICATION

public static final String MODEL_APPLICATION
See Also:
Constant Field Values

WRITING_NGRAM_MODEL

public static final String WRITING_NGRAM_MODEL
See Also:
Constant Field Values

TERM_DOC_STATS

public static final String TERM_DOC_STATS
See Also:
Constant Field Values

FILTERING

public static final String FILTERING
See Also:
Constant Field Values

MODEL_TRAINING

public static final String MODEL_TRAINING
See Also:
Constant Field Values

EVALUATION

public static final String EVALUATION
See Also:
Constant Field Values

NLP_LABELS_TO_DATA_LABELS

public static final String NLP_LABELS_TO_DATA_LABELS
See Also:
Constant Field Values

READING_NLP_FEATURES

public static final String READING_NLP_FEATURES
See Also:
Constant Field Values

READING_FVS

public static final String READING_FVS
See Also:
Constant Field Values

WEKA_MODEL_TRAINING

public static final String WEKA_MODEL_TRAINING
See Also:
Constant Field Values

PAUM_MODEL_TRAINING

public static final String PAUM_MODEL_TRAINING
See Also:
Constant Field Values

READING_CHUNK_LEARNING_DATA

public static final String READING_CHUNK_LEARNING_DATA
See Also:
Constant Field Values

WEKA_MODEL_APPLICATION

public static final String WEKA_MODEL_APPLICATION
See Also:
Constant Field Values

PAUM_MODEL_APPLICATION

public static final String PAUM_MODEL_APPLICATION
See Also:
Constant Field Values

POST_PROCESSING

public static final String POST_PROCESSING
See Also:
Constant Field Values

logger

public static final org.apache.log4j.Logger logger
Static shared logger used for logging.

Constructor Detail

Benchmark

public Benchmark()
Method Detail

startPoint

public static long startPoint()
This returns the current system time.


startPoint

public static long startPoint(String benchmarkID)
Like startPoint() but also logs a message with the starting time if benchmarking is enabled. This is intended to be used in conjuntion with the three-argument version of checkPoint.

Parameters:
benchmarkID - the identifier of the process that is just starting.
Returns:
the current time, as logged.

checkPoint

public static void checkPoint(long startTime,
                              String benchmarkID,
                              Object objectInvokingThisCheckPoint,
                              Map benchmarkingFeatures)
This method is responsible for making entries into the log.

Parameters:
startTime - - when did the actual process started. This value should be the value obtained by Benchmark.startPoint() method invoked at the begining of the process.
benchmarkID - - a unique ID of the resource that should be logged with this message.
objectInvokingThisCheckPoint - - The benchmarkable object that invokes this method.
benchmarkingFeatures - - any features (key-value pairs) that should be reported in the log message. toString() method will be invoked on the objects.

checkPointWithDuration

public static void checkPointWithDuration(long totalTime,
                                          String benchmarkID,
                                          Object objectInvokingThisCheckPoint,
                                          Map benchmarkingFeatures)
This method is responsible for making entries into the log.

Parameters:
totalTime - - Total time consumed by the process
benchmarkID - - a unique ID of the resource that should be logged with this message.
objectInvokingThisCheckPoint - - The benchmarkable object that invokes this method.
benchmarkingFeatures - - any features (key-value pairs) that should be reported in the log message. toString() method will be invoked on the objects.

checkPoint

public static void checkPoint(String benchmarkID,
                              Object objectInvokingThisCheckPoint,
                              Map benchmarkingFeatures)
Logs the end of a process. There must previously have been a call to startPoint(String) with the same benchmark ID.

See Also:
checkPoint(long, String, Object, Map)

createBenchmarkId

public static String createBenchmarkId(String resourceName,
                                       String parentBenchmarkID)
Helper method to generate the benchmark ID.


isBenchmarkingEnabled

public static boolean isBenchmarkingEnabled()
Returns if the logging is enabled.


setBenchmarkingEnabled

public static void setBenchmarkingEnabled(boolean benchmarkingEnabled)
Enables or disables the logging.

Parameters:
benchmarkingEnabled -

executeWithBenchmarking

public static void executeWithBenchmarking(Executable executable,
                                           String benchmarkID,
                                           Object objectInvokingThisCheckPoint,
                                           Map benchmarkingFeatures)
                                    throws ExecutionException
Executes the given Executable, logging its runtime under the given benchmark ID (which is propagated to the Executable if it is itself Benchmarkable).

Parameters:
executable - the object to execute
benchmarkID - the benchmark ID, which must not contain spaces as it is already used as a separator in the log, you can use createBenchmarkId(String, String) for it.
objectInvokingThisCheckPoint - the object invoking this method (typically the caller would pass this here)
benchmarkingFeatures - features to include in the check point log
Throws:
ExecutionException - any exceptions thrown by the underlying Executable are propagated.