| com.commsen.stopwatch.StopwatchStorage
All known Subclasses: com.commsen.stopwatch.storages.AbstractDatabaseStorage,
Method Summary | |
public void | close() Called when engine is about to be stopped or for some other reason will no more use this storage. | public boolean | completeRecord(long id, Object[] parameters) Instructs the storage to complete (at least remember the time) the record identified by given parameters.
Engines should know what parameters storage expects.
Most storages will assume that parameters passed uniquely identify only one record. | public void | freeze() Called when engine is about to be paused or for some other reason will temporary not use this storage. | public Report[] | getAllByGroupReports() Implementing methods should generate and return an array of reports. | public Report[] | getAllByLabelReports() Implementing methods should generate and return an array of reports. | public Report[] | getGroupReports(String group) Implementing methods should generate and return an array of reports. | public Report[] | getLabelReports(String label) Implementing methods should generate and return an array of reports. | public long[] | getLoad(String group, String label, int periodField, int numberOfPeriods) Implementing methods should generate and return information of how many instances of the code
specified by group and label ware running for the last numberOfPeriods periods. | public Report | getReport(String group, String label) | public Report[] | getReports() Implementing methods should generate and return an array of reports. | public long | newCompleteRecord(Object[] startParameters, Object[] endParameters) Instructs the storage to create new complete record and store passed parameters.
It is used in DELAYED mode. | public long | newRecord(Object[] parameters) Instructs the storage to create new record and store passed parameters. | public void | open() Called when engine is about to use the storage for the first time. | public boolean | removeRecord(long id) Instructs the storage to remove the record identified by given parameters.
Engines should know what parameters storage expects.
Most storages will assume that parameters passed uniquely identify only one record. | public void | setDebugEnabled(boolean debugEnabled) Instructs the storage to disable/enable debug information.
The reason for this exist is to be able to minimize the performance impact
Stopwatch may have on the measured application. | public void | unfreeze() Called when engine is about to be resumed. |
completeRecord | public boolean completeRecord(long id, Object[] parameters) throws StopwatchStorageException(Code) | | Instructs the storage to complete (at least remember the time) the record identified by given parameters.
Engines should know what parameters storage expects.
Most storages will assume that parameters passed uniquely identify only one record.
Parameters: id - of the database record to be updated Parameters: parameters - used to find the record true if record was completed successfuly, false otherwise throws: StopwatchStorageException - on error |
freeze | public void freeze() throws StopwatchStorageException(Code) | | Called when engine is about to be paused or for some other reason will temporary not use this storage.
Gives storage a chance to free resources.
throws: StopwatchStorageException - if there is a problem with freezing the storage. |
getAllByGroupReports | public Report[] getAllByGroupReports()(Code) | | Implementing methods should generate and return an array of reports.
Array should contain exectly 1 element for each group and all measurment should
represent summary for all labels in that group.
If there is no enough data to produce reports, method should return null
array of reports. |
getAllByLabelReports | public Report[] getAllByLabelReports()(Code) | | Implementing methods should generate and return an array of reports.
Array should contain exectly 1 element for each label and all measurment should
represent summary for all groups containing that label.
If there is no enough data to produce reports, method should return null
array of reports. |
getGroupReports | public Report[] getGroupReports(String group)(Code) | | Implementing methods should generate and return an array of reports.
Array shoud contain exectly 1 element for each group
If there is no enough data to produce the report, method should return null
Parameters: group - the name of group for which report should be generated array of reports. |
getLabelReports | public Report[] getLabelReports(String label)(Code) | | Implementing methods should generate and return an array of reports.
Array shoud contain exectly 1 element for each label
If there is no enough data to produce the report, method should return null
Parameters: label - the label for which report should be generated array of reports. |
getLoad | public long[] getLoad(String group, String label, int periodField, int numberOfPeriods)(Code) | | Implementing methods should generate and return information of how many instances of the code
specified by group and label ware running for the last numberOfPeriods periods.
Period length is defined by periodField which can be one of
java.util.Calendar.FIELD_NAME
For example to see how many instances of code labeled "l1" in group "g1" were running per minute
for the last 30 minutes, one could use:
long[] load = Stopwatch.getLoad("g1, "l1",
java.util.Calendar.MINUTE , 30);
which will forward the call to the appropriate storage implementation. In this case load[0] will contain the
number of code instances running 30 minutes ago and load[29] number of code instances running in the last minute.
If group is null - summary load of all masurments labeled label should be returned.
If label is null - summary load of all masurments in group gtroup should be returned.
If both group and label are null - summary load of all masurments should be returned.
Parameters: group - the group for which load report should be generated Parameters: label - the label for which load report should be generated Parameters: periodField - can be one of java.util.Calendar.FIELD_NAME Parameters: numberOfPeriods - number of periods array of length numberOfPeriods where every element represents the load for given pariod. |
getReport | public Report getReport(String group, String label)(Code) | | Implementing methods should generate and return a single report for
provided group and label
If there is no enough data to produce the report, method should return null
Parameters: group - the group for which report should be generated Parameters: label - the label for which report should be generated single report for provided group and label. |
getReports | public Report[] getReports()(Code) | | Implementing methods should generate and return an array of reports.
Array should contain exectly 1 element for each combination of group and label
If there is no enough data to produce reports, method should return null
array of reports. |
newCompleteRecord | public long newCompleteRecord(Object[] startParameters, Object[] endParameters) throws StopwatchStorageException(Code) | | Instructs the storage to create new complete record and store passed parameters.
It is used in DELAYED mode. Start parameters are kept in memory until the end
of given measurments and then passed here together with the end parameters.
Engines should know what parameters storage expects.
Parameters: startParameters - parameters describing start condition Parameters: endParameters - parameters describing end condition true if record was completed successfuly, false otherwise throws: StopwatchStorageException - on error |
removeRecord | public boolean removeRecord(long id) throws StopwatchStorageException(Code) | | Instructs the storage to remove the record identified by given parameters.
Engines should know what parameters storage expects.
Most storages will assume that parameters passed uniquely identify only one record.
Parameters: id - of the database record to be removed Parameters: parameters - used to find the record true if record was removed successfuly, false otherwise throws: StopwatchStorageException - on error |
setDebugEnabled | public void setDebugEnabled(boolean debugEnabled)(Code) | | Instructs the storage to disable/enable debug information.
The reason for this exist is to be able to minimize the performance impact
Stopwatch may have on the measured application. Generating debug info consumes additional
CPU units, which may become a problem if Stopwatch is heavily used.
Setting this to false (it is false by default) should cause no debug info being generated
even when log4j's level is set to DEBUG.
Parameters: debugEnabled - should debug information be generated |
unfreeze | public void unfreeze() throws StopwatchStorageException(Code) | | Called when engine is about to be resumed. Simply indicates that is about to use this storage again.
Gives storage a chance to re-connect, etc.
throws: StopwatchStorageException - if there is a problem with unfreezing the storage. |
|
|