public final class Prof extends Object implements Closeable
jstat
(see
http://docs.oracle.com/javase/1.5.0/docs/tooldocs/share/jstat.html) is a standard tool to do application
profiling. ThisModifier and Type | Method and Description |
---|---|
void |
addAdditionalData(String key,
Object value)
Add additional data to be included in the output.
|
void |
addExtProbe(String groupName,
Supplier<? extends Object> probe)
Add additional probe.
|
void |
close() |
void |
invokeSnapshot()
Take a snapshot.
|
static Prof |
launchProf(PrintStream ps,
int dt)
Launch profiling.
|
void |
removeExtProbe(Supplier<? extends Object> probe)
Remove additional probe.
|
public void addExtProbe(String groupName, Supplier<? extends Object> probe)
ext
with name as key.groupName
- Name of probe groupprobe
- Probe to add. Needs to be thread safe; will be invoked from inside an ExecutorService
.public void removeExtProbe(Supplier<? extends Object> probe)
probe
- Probe to remove.public void addAdditionalData(String key, Object value)
close()
.key
- Keyvalue
- Valuepublic static Prof launchProf(PrintStream ps, int dt)
ps
- PrintStream to write profiling results. Will be closed upon calling close()
.dt
- Delay between writes in msProf
instance representing the profile collectionpublic void invokeSnapshot()
public void close()
close
in interface Closeable
close
in interface AutoCloseable