Skip to content

Commit

Permalink
Avoid 0 duration GC event times (#1170)
Browse files Browse the repository at this point in the history
We noticed `:dist-avg` under 1ms for ZGC and `getDuration` is in milliseconds, so
we must be regularly seeing events that start and end in the same millisecond.
  • Loading branch information
DanielThomas authored Nov 14, 2024
1 parent 1e44427 commit 20f60b4
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,8 @@ private void processGcEvent(GarbageCollectionNotificationInfo info) {
.withTag("action", info.getGcAction())
.withTag("cause", info.getGcCause());
Timer timer = Spectator.globalRegistry().timer(eventId);
timer.record(info.getGcInfo().getDuration(), TimeUnit.MILLISECONDS);
long duration = Math.max(1, info.getGcInfo().getDuration());
timer.record(duration, TimeUnit.MILLISECONDS);

// Update promotion and allocation counters
updateMetrics(info.getGcName(), info.getGcInfo());
Expand Down

0 comments on commit 20f60b4

Please sign in to comment.