net.sf.jperfprobe
Class StaticProbeManager

java.lang.Object
  extended by net.sf.jperfprobe.StaticProbeManager

public final class StaticProbeManager
extends Object

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


Method Summary
static void addSampleFromProbe(Probe p)
          Add a sample from a probe.
static void clear()
          Clear all probes, all results and probes will be removed.
static void disableAll()
          Disable all probes.
static void enableAll()
          Enable all probes.
static int getFirstSamplesToSkip()
           
static String[] getNames()
          Get all probe names in the ProbeManager
static ProbeManagerImpl.Presentation getPresentation()
          Get the current presentation for the manager
static Probe getProbeInstance(String probeName)
          Get instance of a named probe, if it is non existent, a default probe will be created.
static Result getResult(String probeName)
          Get a result for a given probe
static Collection<Result> getResults()
          Get all the results
static long[] getSamples(String probe)
          Get all samples from a probe, as a string newline delimited
static void put(String probeName, Probe probe)
          Put a probe into the manager, if the probe exist it will be overwritten.
static void setFirstSamplesToSkip(int _firstSamplesToSkip)
          Set how many samples to skip in the calculation of statistics.
static void setPresentation(ProbeManagerImpl.Presentation p)
          Set the presentation unit for presentation.
static void setTime(Time tim)
          Set the Time implementation.
static Probe start(String probeName)
          Start probe, identified by probeName, if the probe does not exist, it will be created.
static Probe startSingle(String probeName)
           
static void stop(String probeName)
          Stop timing.
static 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
 

Method Detail

put

public static 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.

Parameters:
probeName -
probe -

getResult

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

Parameters:
probeName -
Returns:
Result

getResults

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

Returns:

getProbeInstance

public static 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.

Parameters:
probeName - identifying name of probe
Returns:
probe, null if it cant look it up

start

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

Parameters:
probeName - name of existing or new probe.

startSingle

public static Probe startSingle(String probeName)

stop

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

Parameters:
probeName - name of probe to stop

addSampleFromProbe

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

Parameters:
p -

clear

public static void clear()
Clear all probes, all results and probes will be removed.


disableAll

public static void disableAll()
Disable all probes.


enableAll

public static void enableAll()
Enable all probes.


setPresentation

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

Parameters:
p - presentation to set

getFirstSamplesToSkip

public static int getFirstSamplesToSkip()

setFirstSamplesToSkip

public static 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.

Parameters:
_firstSamplesToSkip -

getPresentation

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

Returns:
presentation

setTime

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

Parameters:
tim -

toString

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

Parameters:
probe -
Returns:
result

getSamples

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

Parameters:
probe -
Returns:
samples

getNames

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

Returns:
probename


Copyright © 2004-2011. All Rights Reserved.