Skip to content

Commit

Permalink
8263426: Reflow JfrNetworkUtilization::send_events
Browse files Browse the repository at this point in the history
Reviewed-by: mgronlun
  • Loading branch information
shipilev committed Mar 12, 2021
1 parent e25ad73 commit ff25939
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/hotspot/share/jfr/periodic/jfrNetworkUtilization.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,10 @@ void JfrNetworkUtilization::send_events() {
log_trace(jfr, event)("Reporting network utilization");
static JfrTicks last_sample_instant;
const JfrTicks cur_time = JfrTicks::now();
const JfrTickspan interval = last_sample_instant == 0 ? cur_time - cur_time : cur_time - last_sample_instant;
last_sample_instant = cur_time;
for (NetworkInterface *cur = network_interfaces; cur != NULL; cur = cur->next()) {
InterfaceEntry& entry = get_entry(cur);
if (interval.value() > 0) {
if (cur_time > last_sample_instant) {
const JfrTickspan interval = cur_time - last_sample_instant;
for (NetworkInterface *cur = network_interfaces; cur != NULL; cur = cur->next()) {
InterfaceEntry& entry = get_entry(cur);
const uint64_t current_bytes_in = cur->get_bytes_in();
const uint64_t current_bytes_out = cur->get_bytes_out();
const uint64_t read_rate = rate_per_second(current_bytes_in, entry.bytes_in, interval);
Expand All @@ -183,6 +182,7 @@ void JfrNetworkUtilization::send_events() {
entry.bytes_out = current_bytes_out;
}
}
last_sample_instant = cur_time;

static bool is_serializer_registered = false;
if (!is_serializer_registered) {
Expand Down

1 comment on commit ff25939

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.