private void endMetrics(String method) {
    Metrics metrics = MetricsFactory.getInstance();
    if (metrics != null) {
      final MetricsScope scope;
      synchronized(openScopes) {
        scope = openScopes.remove(method);
      }
      if (scope != null) {
        metrics.endScope(scope);
      }
    }
  }
Helper method for getting the time spent to actually run the DAG.
common/src/java/org/apache/hadoop/hive/ql/log/PerfLogger.java