at.dms.kjc.rstream
Class TimerCode

java.lang.Object
  extended by at.dms.kjc.rstream.TimerCode

public final class TimerCode
extends Object

Process timers (dumping user and system ticks) in SIR. This code is to allow process timers to be used in SIR code before it is time to generate strings from the SIR code. However, there are some hacks that should generate C or C++ code when put through our code generators, but which are not amenable to symbolic execution of the SIR code.
For compatibility with the rstream backend this class uses local variables (as opposed to fields) for the timers.

The constructor takes the name of the timer to be used.

timerCIncludes is C / C++ specific list of .h files that need to be included

timerDeclarations() returns declarations necessary to use timer.

timerStart() returns SIR statements to start timing with the timer.

timerEnd() returns SIR statments to end timing with the timer.

timerPrint() returns SIR statments to print the elapsed system and user ticks.

Author:
Allyn Dimock

Field Summary
static String[] timerCIncludes
          An array of strings for '#include's The caller is reponsible for prefixing with '#include " and for ignoring any strings that would be generated anyway
 
Constructor Summary
TimerCode(String timerName)
          Constructor for timer code.
 
Method Summary
 JVariableDeclarationStatement[] timerDeclarations()
          Declartions needed for using timer code.
 JStatement[] timerEnd()
          SIR code to get the end value of a proc timer.
 JStatement[] timerPrint()
          SIR code to print value of a proc timer.
 JStatement[] timerStart()
          SIR code to get the start value of a proc timer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

timerCIncludes

public static final String[] timerCIncludes
An array of strings for '#include's The caller is reponsible for prefixing with '#include " and for ignoring any strings that would be generated anyway

Constructor Detail

TimerCode

public TimerCode(String timerName)
Constructor for timer code.

Parameters:
timerName - is the name of the timer (will have some suffices appended to become names of some fields)
Method Detail

timerDeclarations

public JVariableDeclarationStatement[] timerDeclarations()
Declartions needed for using timer code.

Returns:
a list of variable declarations

timerStart

public JStatement[] timerStart()
SIR code to get the start value of a proc timer.

Returns:
a list of statements to be inserted into the calling program at a place where declarations from timerDeclaration are in scope.

timerEnd

public JStatement[] timerEnd()
SIR code to get the end value of a proc timer.

Returns:
a list of statements to be inserted into the calling program at a place where code from timerStart has been executed and where declarations from timerDeclaration are in scope.

timerPrint

public JStatement[] timerPrint()
SIR code to print value of a proc timer.

Returns:
a list of statements to be inserted into the calling program at a place where code from timerStart and TimerEnd has been executed and where declarations from timerDeclaration are in scope.