public class SynchronizedTimeMetrics extends TimeMetrics
TimeMetrics with an external synchronization object.
Copyright (C) 2007 Marsette A. Vona, III
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
| Modifier and Type | Field and Description |
|---|---|
private static java.lang.String |
cvsid |
protected java.lang.Object |
monitor
an object on which to synchronize
|
count, highRes, lastStartTime, lastTime, maxTime, minTime, name, running, totalTime| Constructor and Description |
|---|
SynchronizedTimeMetrics(java.lang.String name)
Covers
SynchronizedTimeMetrics(String, boolean, Object), not
high res, no monitor. |
SynchronizedTimeMetrics(java.lang.String name,
boolean highRes)
Covers
SynchronizedTimeMetrics(String, boolean, Object), no
monitor. |
SynchronizedTimeMetrics(java.lang.String name,
boolean highRes,
java.lang.Object monitor)
calls
TimeMetrics.reset() |
SynchronizedTimeMetrics(java.lang.String name,
java.lang.Object monitor)
Covers
SynchronizedTimeMetrics(String, boolean, Object), not
high res. |
| Modifier and Type | Method and Description |
|---|---|
int |
averageTime()
compute avg execution time from
TimeMetrics.totalTime and TimeMetrics.count |
void |
dump(java.io.PrintStream s,
int nameWidth,
boolean annotated)
Dump human-readable metrics.
|
int |
getCurrentTime()
get the current time in us (ns if
TimeMetrics.highRes) |
boolean |
isRunning()
check if the start has been marked but not the end
|
void |
markEnd()
Mark the end of a task execution.
|
void |
markStart()
Mark the start of a task execution.
|
void |
reset()
Resets all metrics
|
float |
toMS()
get multiplicative conversion factor taking time values to ms
|
averageMS, dump, dump, dumpHeader, lastMSprivate static final java.lang.String cvsid
protected final java.lang.Object monitor
public SynchronizedTimeMetrics(java.lang.String name,
boolean highRes,
java.lang.Object monitor)
TimeMetrics.reset()public SynchronizedTimeMetrics(java.lang.String name,
boolean highRes)
Covers SynchronizedTimeMetrics(String, boolean, Object), no
monitor.
public SynchronizedTimeMetrics(java.lang.String name,
java.lang.Object monitor)
Covers SynchronizedTimeMetrics(String, boolean, Object), not
high res.
public SynchronizedTimeMetrics(java.lang.String name)
Covers SynchronizedTimeMetrics(String, boolean, Object), not
high res, no monitor.
public int averageTime()
TimeMetrics.totalTime and TimeMetrics.countaverageTime in class TimeMetricspublic float toMS()
toMS in class TimeMetricspublic void reset()
reset in class TimeMetricspublic int getCurrentTime()
TimeMetrics.highRes)getCurrentTime in class TimeMetricspublic void markStart()
Mark the start of a task execution.
The task will be considered running (see TimeMetrics.isRunning()) until the
next call to TimeMetrics.markEnd().
It is ok to call this even if the metrics are already running.
markStart in class TimeMetricspublic void markEnd()
Mark the end of a task execution.
It is ok to call this even if the metrics are not currently running.
markEnd in class TimeMetricspublic boolean isRunning()
isRunning in class TimeMetricspublic void dump(java.io.PrintStream s,
int nameWidth,
boolean annotated)
Dump human-readable metrics.
dump in class TimeMetricsnameWidth - min width of the TimeMetrics.name field, or non-positive for
no limitannotated - whether to show per-number annotations