Github user maoling commented on a diff in the pull request:
https://github.com/apache/zookeeper/pull/629#discussion_r217914812
--- Diff: src/java/main/org/apache/zookeeper/server/ServerStats.java ---
@@ -54,9 +57,10 @@ synchronized public long getMinLatency() {
return minLatency == Long.MAX_VALUE ? 0 : minLatency;
}
- synchronized public long getAvgLatency() {
+ synchronized public double getAvgLatency() {
if (count != 0) {
- return totalLatency / count;
+ String avgLatency = df.format((double)totalLatency / count);
+ return Double.parseDouble(avgLatency);
--- End diff --
@eolivelli totalLatency *1.0 / count will get e.g 0.7649024988323213 (too
long),but I want to that the results tally up to four decimal places e.g 0.7649
---