-
Enhancement
-
Resolution: Fixed
-
P4
-
11.0.1, 15, 16, 17
-
b14
SonarCloud instance reports a problem in JfrNetworkUtilization::send_events: "Identical sub-expressions on both sides of operator "-"." here:
const JfrTickspan interval = last_sample_instant == 0 ? cur_time - cur_time : cur_time - last_sample_instant;
Note "cur_time - cur_time". It would seem that `interval` is effectively zero when `last_sample_instant` is not yet initialized. And I see that the subsequent code checks for `interval.value() > 0` for every interface. That can be optimized a bit: when `last_sample_instant` is not available, do not enter the loop, and don't check `interval.value()`.
const JfrTickspan interval = last_sample_instant == 0 ? cur_time - cur_time : cur_time - last_sample_instant;
Note "cur_time - cur_time". It would seem that `interval` is effectively zero when `last_sample_instant` is not yet initialized. And I see that the subsequent code checks for `interval.value() > 0` for every interface. That can be optimized a bit: when `last_sample_instant` is not available, do not enter the loop, and don't check `interval.value()`.
- relates to
-
JDK-8003209 JFR events for network utilization
- Resolved