APITimer: sum should return a value and values are in ns
When removing the pull based timers in the API the sum method in the APITimer was left stubed by mistake. This patch take the sum from the histogram as it should be. Another missed changes are the units, in the yammer library the Timer does unit conversion before returning the values. This patch takes the unit conversion from the yammer library to be compatible. Signed-off-by: Amnon Heiman <amnon@scylladb.com> Message-Id: <1464173726-7482-1-git-send-email-amnon@scylladb.com>
This commit is contained in:
parent
12daaf546d
commit
9e97cb530a
@ -25,6 +25,10 @@ public class APITimer extends Timer {
|
||||
final APIHistogram histogram;
|
||||
APIClient c = new APIClient();
|
||||
|
||||
private double convertFromNS(double ns) {
|
||||
return ns / TimeUnit.NANOSECONDS.convert(1, durationUnit);
|
||||
}
|
||||
|
||||
String url;
|
||||
|
||||
public APITimer(String url, ScheduledExecutorService tickThread,
|
||||
@ -52,31 +56,31 @@ public class APITimer extends Timer {
|
||||
@Override
|
||||
public double max() {
|
||||
update_fields();
|
||||
return histogram.max();
|
||||
return convertFromNS(histogram.max());
|
||||
}
|
||||
|
||||
@Override
|
||||
public double min() {
|
||||
update_fields();
|
||||
return histogram.min();
|
||||
return convertFromNS(histogram.min());
|
||||
}
|
||||
|
||||
@Override
|
||||
public double mean() {
|
||||
update_fields();
|
||||
return histogram.mean();
|
||||
return convertFromNS(histogram.mean());
|
||||
}
|
||||
|
||||
@Override
|
||||
public double stdDev() {
|
||||
update_fields();
|
||||
return histogram.stdDev();
|
||||
return convertFromNS(histogram.stdDev());
|
||||
}
|
||||
|
||||
@Override
|
||||
public double sum() {
|
||||
update_fields();
|
||||
return 0;
|
||||
return convertFromNS(histogram.sum());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user