|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.threerings.media.util.PerformanceMonitor
public class PerformanceMonitor
Provides a simple mechanism for monitoring the number of times an action takes place within a certain time period.
The action being tracked should be registered with a suitable name via register(com.threerings.media.util.PerformanceObserver, java.lang.String, long),
and tick(com.threerings.media.util.PerformanceObserver, java.lang.String) should be called each time the action is performed.
Whenever tick(com.threerings.media.util.PerformanceObserver, java.lang.String) is called and the checkpoint time interval has elapsed since the last
checkpoint (if any), the observer will be notified to that effect by a call to PerformanceObserver.checkpoint(java.lang.String, int).
Note that this is not intended to be used as an industrial-strength profiling or
performance monitoring tool. The checkpoint time interval granularity is in milliseconds, not
microseconds, and the observer's checkpoint() method will never be called
until/unless a subsequent call to tick(com.threerings.media.util.PerformanceObserver, java.lang.String) is made after the requested number of
milliseconds have passed since the last checkpoint.
| Field Summary | |
|---|---|
protected static Map<PerformanceObserver,Map<String,com.threerings.media.util.PerformanceAction>> |
_observers
The observers monitoring some set of actions. |
protected static MediaTimer |
_timer
Used to obtain high resolution time stamps. |
| Constructor Summary | |
|---|---|
PerformanceMonitor()
|
|
| Method Summary | |
|---|---|
protected static long |
getTimeStamp()
Used by the performance actions. |
static void |
register(PerformanceObserver obs,
String name,
long delta)
Register a new action with an observer, the action name, and the milliseconds to wait between checkpointing the action's performance. |
static void |
setMediaTimer(MediaTimer timer)
Used to configure the performance monitor with a particular MediaTimer implementation. |
static void |
tick(PerformanceObserver obs,
String name)
Tick the named action associated with the given observer. |
static void |
unregister(PerformanceObserver obs,
String name)
Un-register the named action associated with the given observer. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static Map<PerformanceObserver,Map<String,com.threerings.media.util.PerformanceAction>> _observers
protected static MediaTimer _timer
| Constructor Detail |
|---|
public PerformanceMonitor()
| Method Detail |
|---|
public static void register(PerformanceObserver obs,
String name,
long delta)
obs - the action observer.name - the action name.delta - the milliseconds between checkpoints.
public static void unregister(PerformanceObserver obs,
String name)
obs - the action observer.name - the action name.
public static void tick(PerformanceObserver obs,
String name)
obs - the action observer.name - the action name.public static void setMediaTimer(MediaTimer timer)
MediaTimer implementation. By default it uses a pure-Java
implementation which isn't extremely accurate across platforms.
protected static long getTimeStamp()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||