java.lang.Object
org.matwoess.jsourceprofiler.tool.profile.Profiler

public class Profiler extends Object
  • Constructor Details

    • Profiler

      public Profiler(JavaFile mainJavaFile, JavaFile... additionalJavaFiles)
      Creates a new Profiler object with the given main file and an array of additional files to profile.
      Parameters:
      mainJavaFile - the main file to profile
      additionalJavaFiles - the additional dependent project files to profile
  • Method Details

    • compileInstrumented

      public void compileInstrumented()
      Compiles the main instrumented file and output it to the classes directory. The javac tool will automatically compile all referenced instrumented java files. The working directory is not changed during this process.
    • profile

      public void profile(String[] programArgs)
      Runs the instrumented and compiled main file with the given program arguments.

      The name of the class file is determined by the relative path of the main file and removing the .java extension.

      Parameters:
      programArgs - the program arguments to pass to the main method
    • generateReport

      public void generateReport()
      Generates the report from the metadata and counts files.

      Before creation, the hit counts are added to the blocks from the counts file data.

      First the report directory is cleared. Then the following files are written:

      • the index file
      • the source files
      • the method index files for each class in the source files
      Finally, the highlighting JavaScript file is copied to the report directory using copyReportResources().
    • createLinkForReport

      public void createLinkForReport()
      Creates a symbolic link to the main report index file in the current directory. Should work on Linux and macOS but might not work on Windows, depending on group policy rules.