public long getPreparePlanDuration() {
    long dagSubmitStartTime = getStartTime(PerfLogger.TEZ_SUBMIT_DAG);
    long compileEndTime = getEndTime(PerfLogger.COMPILE);
    long getSessionDuration = getDuration(PerfLogger.TEZ_GET_SESSION);

    // no DAG was running with this query
    if (dagSubmitStartTime == 0){
      // so no plan preparation happened
      return 0;
    }

    return dagSubmitStartTime - compileEndTime - getSessionDuration;
  }
Helper method for getting the time spent with total DAG preparation.
common/src/java/org/apache/hadoop/hive/ql/log/PerfLogger.java