JDK-8263426 : Reflow JfrNetworkUtilization::send_events
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: jfr
  • Affected Version: 11.0.1,15,16,17
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2021-03-11
  • Updated: 2021-03-18
  • Resolved: 2021-03-12
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 17
17 b14Fixed
Related Reports
Relates :  
Description
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()`.
Comments
Changeset: ff259393 Author: Aleksey Shipilev <shade@openjdk.org> Date: 2021-03-12 07:58:30 +0000 URL: https://git.openjdk.java.net/jdk/commit/ff259393
12-03-2021