You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@Override
public long currentTimeNanos() {
Instant now = Clock.systemUTC().instant();
return TimeUnit.SECONDS.toNanos(now.getEpochSecond()) + now.getNano();
}
/** Returns the number of nanoseconds since the epoch (00:00:00, 01-Jan-1970, GMT). */
public long currentTimeNanos() {
return TimeUnit.MILLISECONDS.toNanos(System.currentTimeMillis());
}
As discussed here, this is a factor in reduced performance when exemplars are enabled. Its particularly impactful for explicit bucket histograms, which always take the last value for each cell, and are therefore calling currentTimeNanos() for each and every measurement.
We should consider optimizing the java 9+ or using the simpler (but likely less accurate) java 8 version for java 9+. Perhaps we only use the simpler / less accurate implementation for exemplars, which are less important.
When we offer a measurement to an exemplar reservoir cell, we call
Clock.now()
, which is resolved inefficiently for java 9+:For java 8, the implementation is simpler and more efficient:
As discussed here, this is a factor in reduced performance when exemplars are enabled. Its particularly impactful for explicit bucket histograms, which always take the last value for each cell, and are therefore calling
currentTimeNanos()
for each and every measurement.We should consider optimizing the java 9+ or using the simpler (but likely less accurate) java 8 version for java 9+. Perhaps we only use the simpler / less accurate implementation for exemplars, which are less important.
cc @jsuereth
The text was updated successfully, but these errors were encountered: