java.lang.Object
org.matwoess.jsourceprofiler.tool.instrument.Instrumenter

public class Instrumenter extends Object
This class is used to instrument the source files of a Java project.

It uses the Parser to parse the source files and find all code blocks.

It then inserts code to increment the counter for each code block.

Finally, it writes the instrumented source files to the instrumented directory.

  • Field Details

    • incRefAdd

      public String incRefAdd
  • Constructor Details

    • Instrumenter

      public Instrumenter(JavaFile[] javaFiles, Arguments toolArgs)
      Creates a new Instrumenter with the given source files.
      Parameters:
      javaFiles - the source files to instrument
      toolArgs - the tool command line arguments record
  • Method Details

    • analyzeFiles

      public void analyzeFiles()
      Parses all source files and find all code blocks.
    • instrumentFiles

      public void instrumentFiles()
      Instruments all source files.

      The instrumented copy of each source file is then written to the instrumented directory.

    • exportMetadata

      public void exportMetadata()
      Exports the metadata file.
    • copyAuxiliaryFiles

      public static void copyAuxiliaryFiles()
      Copies the auxiliary files into the auxiliary directory.

      Specifically, it copies the __Counter.class file to the auxiliary directory.