#1586 - ENH: Add TimedMetric.addSinceNanos() ... as a helper when using start nanos

This commit is contained in:
rob bygrave
2018-12-21 02:28:23 +13:00
parent 81f42f8e95
commit baa3909c63
6 changed files with 37 additions and 0 deletions
@@ -24,6 +24,11 @@ class DTimedMetricMap implements TimedMetricMap {
add(key, (System.nanoTime() - startNanos)/1000L);
}
@Override
public void addSinceNanos(String key, long startNanos, int beans) {
add(key, (System.nanoTime() - startNanos)/1000L, beans);
}
@Override
public void add(String key, long exeMicros) {
map.computeIfAbsent(key, (k) -> new DTimedMetric(metricType, name + key)).add(exeMicros);