org.jikesrvm.compilers.baseline
Class EdgeCounts

java.lang.Object
  extended by org.jikesrvm.compilers.baseline.EdgeCounts
All Implemented Interfaces:
Callbacks.ExitMonitor

public final class EdgeCounts
extends Object
implements Callbacks.ExitMonitor

A repository of edge counters for bytecode-level edge conditional branches.


Field Summary
private static int[][] data
          Array of edge count data.
static int NOT_TAKEN
          Adjustment to offset in data from the bytecode index for not taken branch counts
private static boolean registered
          For a non-adaptive system, have we registered the exit call back yet?
static int TAKEN
          Adjustment to offset in data from the bytecode index for taken branch counts
 
Constructor Summary
EdgeCounts()
           
 
Method Summary
private static void allocateCounters(int id, int numEntries)
           
static void allocateCounters(NormalMethod m, int numEntries)
           
static void dumpCounts()
          Dump all the profile data to the file BaselineCompiler.options.PROFILE_EDGE_COUNTER_FILE
static void dumpCounts(String fn)
          Dump all profile data to the given file
static BranchProfiles getBranchProfiles(NormalMethod m)
           
static void loadCountsFromFileIfAvailable(String inputFileName)
          Attempt to use edge counts from an input file.
 void notifyExit(int value)
          Notify the monitor that the VM is about to exit.
static void readCounts(String fn)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TAKEN

public static final int TAKEN
Adjustment to offset in data from the bytecode index for taken branch counts

See Also:
Constant Field Values

NOT_TAKEN

public static final int NOT_TAKEN
Adjustment to offset in data from the bytecode index for not taken branch counts

See Also:
Constant Field Values

registered

private static boolean registered
For a non-adaptive system, have we registered the exit call back yet?


data

private static int[][] data
Array of edge count data. The first index is the ID of the method, the second index is the bytecode index within the method plus either TAKEN or NOT_TAKEN. The value is the count of the number of times a particular branch event occurs.

Constructor Detail

EdgeCounts

public EdgeCounts()
Method Detail

notifyExit

public void notifyExit(int value)
Description copied from interface: Callbacks.ExitMonitor
Notify the monitor that the VM is about to exit.

Specified by:
notifyExit in interface Callbacks.ExitMonitor
Parameters:
value - the exit value

loadCountsFromFileIfAvailable

public static void loadCountsFromFileIfAvailable(String inputFileName)
Attempt to use edge counts from an input file. If the source file is not null, then clear any existing counts and read in new counts from the file provided.

Parameters:
inputFileName - The name of the edge count file (possibly null)

allocateCounters

public static void allocateCounters(NormalMethod m,
                                    int numEntries)

allocateCounters

private static void allocateCounters(int id,
                                     int numEntries)

getBranchProfiles

public static BranchProfiles getBranchProfiles(NormalMethod m)

dumpCounts

public static void dumpCounts()
Dump all the profile data to the file BaselineCompiler.options.PROFILE_EDGE_COUNTER_FILE


dumpCounts

public static void dumpCounts(String fn)
Dump all profile data to the given file

Parameters:
fn - output file name

readCounts

public static void readCounts(String fn)