public class PerformanceMonitor extends Object
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.
| Constructor and Description |
|---|
PerformanceMonitor() |
| Modifier and Type | Method and Description |
|---|---|
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.
|
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.Copyright © 2015. All rights reserved.