DPJRuntime
Class Instrument

java.lang.Object
  extended by DPJRuntime.Instrument

public class Instrument
extends java.lang.Object

Instrument is the support class for DPJ instrumentation. When a DPJ program is compiled with the -instrument flag, the compiler generates calls to the methods of this class at appropriate points in the code.


Constructor Summary
Instrument()
           
 
Method Summary
static double amdahlBound()
          Returns the best speedup we could achieve under Amdahl's law, assuming perfect speedup of the parallel parts.
static double averageWidth()
          Returns the average width of the parallelism graph, i.e., the average number of tasks active at every point of the program.
static void cobeginSeparator()
          Called between statements in a cobegin statement.
static void end()
          Called at the end of the computation.
static void enterCobegin()
          Called upon entry to a cobegin statement.
static void enterFinish()
          Called upon entry to a finish statement.
static void enterForeach(int numIters)
          Called upon entry to a foreach statement.
static void enterForeachIter()
          Called upon entry to a foreach iteration
static void enterSpawn()
          Called upon entry to a spawn statement.
static void exitCobegin()
          Called upon exit from a cobegin statement.
static void exitFinish()
          Called upon exit from a finish statement.
static void exitForeach()
          Called upon exit from a foreach statement.
static void exitForeachIter()
          Called upon exit from a foreach iteration
static void exitSpawn()
          Called upon exit from a spawn statement.
static long getParallelTime()
          Returns the measured parallel time of the computation.
static long getSerialTime()
          Returns the measured serial time of the computation.
static java.util.Map<java.lang.Long,java.lang.Integer> getTasksMap()
          Returns a map representing the program task graph.
static double idealSpeedup()
          Returns the ideal speedup, computed as the serial time divided by the parallel time.
static void printTaskIntervals(java.lang.String filepath)
          Prints the start and end point of each task to the given file.
static void printTasksMap(java.lang.String filepath)
          Prints a string representation of the task map to the given file.
static void start()
          Starts the timing.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Instrument

public Instrument()
           [unknown]
Method Detail

start

public static void start()
                  writes Root : *
Starts the timing.


enterForeach

public static void enterForeach(int numIters)
                         writes Root : *
Called upon entry to a foreach statement.

Parameters:
numIters - The number of iterations in the foreach

enterForeachIter

public static void enterForeachIter()
                             writes Root : *
Called upon entry to a foreach iteration


exitForeachIter

public static void exitForeachIter()
                            writes Root : *
Called upon exit from a foreach iteration


exitForeach

public static void exitForeach()
                        writes Root : *
Called upon exit from a foreach statement.


enterCobegin

public static void enterCobegin()
                         writes Root : *
Called upon entry to a cobegin statement.


cobeginSeparator

public static void cobeginSeparator()
                             writes Root : *
Called between statements in a cobegin statement.


exitCobegin

public static void exitCobegin()
                        writes Root : *
Called upon exit from a cobegin statement.


enterFinish

public static void enterFinish()
                        writes Root : *
Called upon entry to a finish statement.


exitFinish

public static void exitFinish()
                       writes Root : *
Called upon exit from a finish statement.


enterSpawn

public static void enterSpawn()
                       writes Root : *
Called upon entry to a spawn statement.


exitSpawn

public static void exitSpawn()
                      writes Root : *
Called upon exit from a spawn statement.


end

public static void end()
                writes Root : *
Called at the end of the computation.


getTasksMap

public static java.util.Map<java.lang.Long,java.lang.Integer> getTasksMap()
                                                                   writes Root : *
Returns a map representing the program task graph. The map takes program points to number of tasks. There is one entry in the map for each point at which the number of tasks changed.

Returns:
Map representing program task graph

printTasksMap

public static void printTasksMap(java.lang.String filepath)
                          writes Root : *
                          throws java.io.IOException
Prints a string representation of the task map to the given file.

Parameters:
filepath - Pathname of file to print to
Throws:
java.io.IOException

printTaskIntervals

public static void printTaskIntervals(java.lang.String filepath)
                               writes Root : *
                               throws java.io.IOException
Prints the start and end point of each task to the given file.

Parameters:
filepath - Pathname of file to print to
Throws:
java.io.IOException

averageWidth

public static double averageWidth()
                           writes Root : *
Returns the average width of the parallelism graph, i.e., the average number of tasks active at every point of the program. Computed as the quotient of (1) the area under the curve of number of tasks vs. time and (2) the total time.

Returns:
Average width of the parallelism graph

idealSpeedup

public static double idealSpeedup()
                           writes Root : *
Returns the ideal speedup, computed as the serial time divided by the parallel time.

Returns:
Ideal speedup

getSerialTime

public static long getSerialTime()
                          writes Root : *
Returns the measured serial time of the computation. Within a cobegin or foreach construct, the serial time is the sum of the times of the individual tasks.

Returns:
Serial time

getParallelTime

public static long getParallelTime()
                            writes Root : *
Returns the measured parallel time of the computation. Within a cobegin or foreach construct, the parallel time is the maximum of the times of the indiviudal tasks.

Returns:
Parallel time

amdahlBound

public static double amdahlBound()
                          writes Root : *
Returns the best speedup we could achieve under Amdahl's law, assuming perfect speedup of the parallel parts. This is accurate for programs that create all parallelism with cobegin and foreach. It is not accurate for programs that use spawn and finish.

Returns:
Bound given by Amdahl's law