public long perfLogEnd(String callerName, String method, String additionalInfo) {
    Long startTime = startTimes.get(method);
    long endTime = System.currentTimeMillis();
    endTimes.put(method, Long.valueOf(endTime));
    long duration = startTime == null ? -1 : endTime - startTime.longValue();

    if (LOG.isDebugEnabled()) {
      StringBuilder sb = new StringBuilder("</PERFLOG method=").append(method);
      if (startTime != null) {
        sb.append(" start=").append(startTime);
      }
      sb.append(" end=").append(endTime);
      if (startTime != null) {
        sb.append(" duration=").append(duration);
      }
      sb.append(" from=").append(callerName);
      if (additionalInfo != null) {
        sb.append(" ").append(additionalInfo);
      }
      sb.append(">");
      LOG.debug(sb.toString());
    }
    endMetrics(method);
    return duration;
  }
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
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/metrics/PerfLogger.java