public abstract class PS_hwpc
extends java.lang.Object
Abstract base class for PerfSuite hardware performance counter API. This is the central class for Java-based performance measurement with PerfSuite.
The typical use of this API is for the caller to obtain a reference to a performance measurement object through one of two available subclasses of PS_hwpc (PS_hwpcSerial or PS_hwpcThreaded).
These references can then be used to control performance measurement from within the application through the methods described below.
For example,
PS_hwpcSerial hwpc = PS_hwpcSerial.getInstance(); hwpc.start(); // Starts performance measurement computeSomething(); // Sequence of code to be measured hwpc.stop("perf"); // Stops measurement and writes the performance // data to an XML document with the prefix "perf"
The resulting XML document(s) can be post-processed with PerfSuite or custom XML tools.
Configuration of the performance measurement is done through the environment variable PS_HWPC_CONFIG which names an XML document containing a list of hardware events to be measured. If this environment variable is not set then a default configuration will be used. Refer to the main PerfSuite documentation for further details.
Modifier | Constructor and Description |
---|---|
protected |
PS_hwpc(java.lang.String[] libraries)
Base class constructor that sets up the performance
libraries necessary for serial or threaded counting.
|
Modifier and Type | Method and Description |
---|---|
static java.lang.String[] |
eventNames()
Returns the names of the events in the event set.
|
protected void |
finalize()
Finalization routine that frees resources associated
with the object.
|
static int |
numEvents()
Returns the number of events in the event set.
|
static long[] |
read()
Returns the current values of the events.
|
static java.util.List |
readList()
Returns a list with the current values of
events in the event set along with their names.
|
static void |
start()
Starts performance measurement.
|
static void |
stop(java.lang.String name)
Stops performance measurement and
writes the results out to an XML document.
|
static void |
suspend()
Suspends performance measurement.
|
java.lang.String |
toString()
Display method.
|
protected PS_hwpc(java.lang.String[] libraries)
libraries
- Libraries to be loadedpublic static int numEvents()
public static java.lang.String[] eventNames()
public static long[] read()
public static java.util.List readList()
public static void start()
public static void suspend()
public static void stop(java.lang.String name)
name
- Prefix of generated XML documentpublic java.lang.String toString()
toString
in class java.lang.Object
protected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable