public long getDuration(String method) {
    Long startTime = startTimes.get(method);
    Long endTime = endTimes.get(method);
    if (startTime != null && endTime != null) {
      return endTime - startTime;
    }
    return 0L;
  }
Call this function in correspondence of PerfLogBegin to mark the end of the measurement.
@param callerName
@param method
@return long duration  the difference between now and startTime, or -1 if startTime is null
common/src/java/org/apache/hadoop/hive/ql/log/PerfLogger.java