public class Benchmark extends Object
TODO: Provide example here.
Constructor and Description |
---|
Benchmark() |
Modifier and Type | Method and Description |
---|---|
static void |
checkPoint(long startTime,
String benchmarkID,
Object objectInvokingThisCheckPoint,
Map<Object,Object> benchmarkingFeatures)
This method is responsible for making entries into the log.
|
static void |
checkPoint(String benchmarkID,
Object objectInvokingThisCheckPoint,
Map<Object,Object> benchmarkingFeatures)
Logs the end of a process.
|
static void |
checkPointWithDuration(long totalTime,
String benchmarkID,
Object objectInvokingThisCheckPoint,
Map<Object,Object> 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<Object,Object> 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. |
protected static boolean benchmarkingEnabled
public static final String CORPUS_NAME_FEATURE
public static final String APPLICATION_NAME_FEATURE
public static final String DOCUMENT_NAME_FEATURE
public static final String PR_NAME_FEATURE
public static final String MESSAGE_FEATURE
public static final String PR_PREFIX
public static final String DOCUMENT_LOADED
public static final String DOCUMENT_SAVED
public static final String WRITING_FVS_TO_DISK
public static final String ANNOTS_TO_NLP_FEATURES
public static final String NLP_FEATURES_TO_FVS
public static final String READING_LEARNING_INFO
public static final String MODEL_APPLICATION
public static final String WRITING_NGRAM_MODEL
public static final String TERM_DOC_STATS
public static final String FILTERING
public static final String MODEL_TRAINING
public static final String EVALUATION
public static final String NLP_LABELS_TO_DATA_LABELS
public static final String READING_NLP_FEATURES
public static final String READING_FVS
public static final String WEKA_MODEL_TRAINING
public static final String PAUM_MODEL_TRAINING
public static final String READING_CHUNK_LEARNING_DATA
public static final String WEKA_MODEL_APPLICATION
public static final String PAUM_MODEL_APPLICATION
public static final String POST_PROCESSING
public static final org.slf4j.Logger logger
public static long startPoint()
public static long startPoint(String benchmarkID)
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.benchmarkID
- the identifier of the process that is just
starting.public static void checkPoint(long startTime, String benchmarkID, Object objectInvokingThisCheckPoint, Map<Object,Object> benchmarkingFeatures)
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.public static void checkPointWithDuration(long totalTime, String benchmarkID, Object objectInvokingThisCheckPoint, Map<Object,Object> benchmarkingFeatures)
totalTime
- - Total time consumed by the processbenchmarkID
- - 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.public static void checkPoint(String benchmarkID, Object objectInvokingThisCheckPoint, Map<Object,Object> benchmarkingFeatures)
startPoint(String)
with the same benchmark ID.checkPoint(long, String, Object, Map)
public static String createBenchmarkId(String resourceName, String parentBenchmarkID)
public static boolean isBenchmarkingEnabled()
public static void setBenchmarkingEnabled(boolean benchmarkingEnabled)
benchmarkingEnabled
- public static void executeWithBenchmarking(Executable executable, String benchmarkID, Object objectInvokingThisCheckPoint, Map<Object,Object> benchmarkingFeatures) throws ExecutionException
Executable
, logging its runtime under
the given benchmark ID (which is propagated to the Executable if it
is itself Benchmarkable
).executable
- the object to executebenchmarkID
- 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
logExecutionException
- any exceptions thrown by the underlying
Executable are propagated.Copyright © 2024 GATE. All rights reserved.