net.sf.jperfprobe
Class ProbeManagerImpl

java.lang.Object
  extended by net.sf.jperfprobe.ProbeManagerImpl
All Implemented Interfaces:
Serializable, ProbeManager

public final class ProbeManagerImpl
extends Object
implements Serializable, ProbeManager

The ProbeManager is the probe factory. It makes it possible start start and stop a probe. The probe can be started in different ways:

1. Start and stop from same scope, same thread, via probe name
2. Start probes multithreaded from same scope, via probe name
3. Start in one scope and stop in another scope singlethreaded via probe name
4. Start in one scope and stop in another scope multithreaded via probe instance

See Also:
Serialized Form

Nested Class Summary
static class ProbeManagerImpl.Presentation
          presentation unit enum
 
Constructor Summary
ProbeManagerImpl()
          Constructor of probe
ProbeManagerImpl(int firstSamplesToSkip, ProbeManagerImpl.Presentation presentation, Time time)
          Constr
 
Method Summary
 void addSampleFromProbe(Probe p)
          Add a sample from a probe.
 void clear()
          Clear the results for all probes
 void clear(String probeName)
          Clear the result for a named probe
 void disable()
          Disable all probes.
 void disable(String probeName)
          Disable a named probe
 void enable()
          Enable all probes.
 void enable(String probeName)
          Enable a named probe
 int getFirstSamplesToSkip()
          The the # of first samples to skip
 String[] getNames()
          Get all probe names in the ProbeManager
 ProbeManagerImpl.Presentation getPresentation()
          Get the current presentation for the manager
 Probe getProbeInstance(String probeName)
          Get instance of a named probe, if it is non existent, a default probe will be created.
 Result getResult(String probeName)
          Get a result for a given probe
 Collection<Result> getResults()
          Get all the results
 long[] getSamples(String probe)
          Get all samples from a probe, as a string newline delimited
 Time getTime()
          Get the time implementation
 void put(String probeName, Probe probe)
          Put a probe into the manager, if the probe exist it will be overwritten.
 void setFirstSamplesToSkip(int _firstSamplesToSkip)
          Set how many samples to skip in the calculation of statistics.
 void setPresentation(ProbeManagerImpl.Presentation p)
          Set the presentation unit for presentation.
 void setTime(Time tim)
          Set the Time implementation.
 Probe start(String probeName)
          Start probe, identified by probeName, if the probe does not exist, it will be created.
 Probe startSingle(String probeName)
          Start probe, this probe is global for all threads, no thread private
 void stop(String probeName)
          Stop timing.
 String toString(String probe)
          Get result as a string
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProbeManagerImpl

public ProbeManagerImpl()
Constructor of probe


ProbeManagerImpl

public ProbeManagerImpl(int firstSamplesToSkip,
                        ProbeManagerImpl.Presentation presentation,
                        Time time)
Constr

Parameters:
firstSamplesToSkip, - samples to skip before recording
presentation, - of measured values
time, - the time implementation to use
Method Detail

put

public void put(String probeName,
                Probe probe)
Put a probe into the manager, if the probe exist it will be overwritten. This makes it possible to create a Probe outside the ProbeManager and insert it later.

Specified by:
put in interface ProbeManager
Parameters:
probeName -
probe -

getResult

public Result getResult(String probeName)
Get a result for a given probe

Specified by:
getResult in interface ProbeManager
Parameters:
probeName -
Returns:
Result

getResults

public Collection<Result> getResults()
Get all the results

Specified by:
getResults in interface ProbeManager
Returns:

getProbeInstance

public Probe getProbeInstance(String probeName)
Get instance of a named probe, if it is non existent, a default probe will be created. And time will be set to null.

Specified by:
getProbeInstance in interface ProbeManager
Parameters:
probeName - identifying name of probe
Returns:
probe, null if it cant look it up

start

public Probe start(String probeName)
Start probe, identified by probeName, if the probe does not exist, it will be created.

Specified by:
start in interface ProbeManager
Parameters:
probeName - name of existing or new probe.

startSingle

public Probe startSingle(String probeName)
Description copied from interface: ProbeManager
Start probe, this probe is global for all threads, no thread private

Specified by:
startSingle in interface ProbeManager
Returns:

stop

public void stop(String probeName)
Stop timing. If its non existent, no time or sample will be registered.

Specified by:
stop in interface ProbeManager
Parameters:
probeName - name of probe to stop

addSampleFromProbe

public void addSampleFromProbe(Probe p)
Add a sample from a probe. The probe does not need to be managed by ProbeManager

Specified by:
addSampleFromProbe in interface ProbeManager
Parameters:
p -

clear

public void clear(String probeName)
Clear the result for a named probe

Specified by:
clear in interface ProbeManager
Parameters:
probeName -

clear

public void clear()
Clear the results for all probes

Specified by:
clear in interface ProbeManager

disable

public void disable(String probeName)
Disable a named probe

Specified by:
disable in interface ProbeManager
Parameters:
probeName -

disable

public void disable()
Disable all probes.

Specified by:
disable in interface ProbeManager

enable

public void enable(String probeName)
Description copied from interface: ProbeManager
Enable a named probe

Specified by:
enable in interface ProbeManager

enable

public void enable()
Enable all probes.

Specified by:
enable in interface ProbeManager

setPresentation

public void setPresentation(ProbeManagerImpl.Presentation p)
Set the presentation unit for presentation.

Specified by:
setPresentation in interface ProbeManager
Parameters:
p - presentation to set

getFirstSamplesToSkip

public int getFirstSamplesToSkip()
Description copied from interface: ProbeManager
The the # of first samples to skip

Specified by:
getFirstSamplesToSkip in interface ProbeManager
Returns:

setFirstSamplesToSkip

public void setFirstSamplesToSkip(int _firstSamplesToSkip)
Set how many samples to skip in the calculation of statistics. If set to ie. 5, the first 5 samples will not be taken into account when calculating max/min/n#samples and average.

Specified by:
setFirstSamplesToSkip in interface ProbeManager
Parameters:
_firstSamplesToSkip -

getPresentation

public ProbeManagerImpl.Presentation getPresentation()
Get the current presentation for the manager

Specified by:
getPresentation in interface ProbeManager
Returns:
presentation

setTime

public void setTime(Time tim)
Set the Time implementation.

Specified by:
setTime in interface ProbeManager
Parameters:
tim -

getTime

public Time getTime()
Description copied from interface: ProbeManager
Get the time implementation

Specified by:
getTime in interface ProbeManager
Returns:

toString

public String toString(String probe)
Get result as a string

Specified by:
toString in interface ProbeManager
Parameters:
probe -
Returns:
result

getSamples

public long[] getSamples(String probe)
Get all samples from a probe, as a string newline delimited

Specified by:
getSamples in interface ProbeManager
Parameters:
probe -
Returns:
samples

getNames

public String[] getNames()
Get all probe names in the ProbeManager

Specified by:
getNames in interface ProbeManager
Returns:
probename


Copyright © 2004-2011. All Rights Reserved.