public static long getLatency(int Xn, int Xn1, long XNTime, long XN1Time) {
    if ((Xn1 - Xn) != 0) {
      return (XN1Time - XNTime) / (Xn1 - Xn);
    }
    return 0;

  }
This is a utility class to calculate various type of Metrics out of raw stats
geode-core/src/main/java/org/apache/geode/management/internal/beans/MetricsCalculator.java