/**
   * Times the execution of a closure, which can include a target. For example,
   *
   * <p>profile("compile", compile)
   *
   * <p>where 'compile' is the target.
   */
  public void profile(String name, Closure<?> callable) {
    if (enableProfile) {
      long now = System.currentTimeMillis();
      GrailsConsole console = GrailsConsole.getInstance();
      console.addStatus("Profiling [" + name + "] start");

      callable.call();
      long then = System.currentTimeMillis() - now;
      console.addStatus("Profiling [" + name + "] finish. Took " + then + " ms");
    } else {
      callable.call();
    }
  }