0 Replies Latest reply on Aug 15, 2008 6:30 AM by (Paul_Reilly)

    [svn] 2849: Added new benchmarking for capturing the time spent before and after

    Level 1
      Revision: 2849
      Author: preilly@adobe.com
      Date: 2008-08-15 07:30:02 -0700 (Fri, 15 Aug 2008)

      Log Message:
      -----------
      Added new benchmarking for capturing the time spent before and after
      CompilerAPI.compile(). It's not perfect, because it has to wait until
      the configuration is processed to know whether benchmarking is
      enabled, but it should be good for tracking improvements to
      incremental compilation.

      Here is how it can be used from a OEM Compiler API client:

      Benchmark benchmark = ThreadLocalToolkit.getBenchmark();
      System.out.println("precompile: " + benchmark.getTime(Benchmark.PRECOMPILE));
      System.out.println("postcompile: " + benchmark.getTime(Benchmark.POSTCOMPILE));

      tests Passed: checkintests

      Needs QA: YES

      Needs DOC: NO

      API Change: NO

      Reviewer: dloverin

      Code-level description of changes:

      tools/oem/Application.java
      tools/oem/Library.java
      tools/Compc.java
      tools/Mxmlc.java
      tools/Fcsh.java

      At each entry point, Benchmark.startTime(Benchmark.PRECOMPILE) is
      called. Just before CompilerAPI.compile() is called,
      Benchmark.stopTime(Benchmark.PRECOMPILE) is called. Just after
      CompilerAPI.compile(), Benchmark.startTime(Benchmark.POSTCOMPILE)
      is called. Before finishing up,
      Benchmark.stopTime(Benchmark.POSTCOMPILE) is called.

      compiler/CompilerAPI.java

      Modified runBenchmark() to return the new Benchmark object.

      compiler/util/ThreadLocalToolkit.java

      Modified log(ILocalizableMessage) and log(ILocalizableMessage,
      String) to check for a null logger. OEMUtil.clean() nulls out the
      logger and Benchmark uses logging, so the last stopTime() call
      requires this check to avoid a NPE.

      compiler/util/Benchmark.java

      Added PRECOMPILE and POSTCOMPILE constants.

      Added getTime() and a new version of stopTime() that allows the
      duration reset to be skipped.

      Modified Paths:
      --------------
      flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/CompilerAPI.java
      flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/util/Benchmark.java
      flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/util/ThreadLocalToolkit.java
      flex/sdk/trunk/modules/compiler/src/java/flex2/tools/Compc.java
      flex/sdk/trunk/modules/compiler/src/java/flex2/tools/Fcsh.java
      flex/sdk/trunk/modules/compiler/src/java/flex2/tools/Mxmlc.java
      flex/sdk/trunk/modules/compiler/src/java/flex2/tools/oem/Application.java
      flex/sdk/trunk/modules/compiler/src/java/flex2/tools/oem/Configuration.java
      flex/sdk/trunk/modules/compiler/src/java/flex2/tools/oem/Library.java