Synchronize access to time series.
@@ -725,10 +725,12 @@ public final class Profiler {
if (shouldRecordTask) {
if (actionCountTimeSeries != null && countAction(data.type, data)) {
+ synchronized (this) {
actionCountTimeSeries.addRange(
Duration.ofNanos(data.startTimeNanos).toMillis(),
Duration.ofNanos(endTime).toMillis());
}
+ }
SlowestTaskAggregator aggregator = slowestTasks[data.type.ordinal()];
if (aggregator != null) {
aggregator.add(data);
