Skip to content

Commit

Permalink
Favour inlining without metrics reporting
Browse files Browse the repository at this point in the history
  • Loading branch information
franz1981 authored and vietj committed Feb 27, 2023
1 parent 1f73ce8 commit b6d6aae
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions src/main/java/io/vertx/core/net/impl/ConnectionBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -416,16 +416,20 @@ protected boolean supportsFileRegion() {
public final void reportBytesRead(Object msg) {
NetworkMetrics metrics = metrics();
if (metrics != null) {
long bytes = remainingBytesRead;
long numberOfBytes = sizeof(msg);
bytes += numberOfBytes;
long val = bytes & METRICS_REPORTED_BYTES_HIGH_MASK;
if (val > 0) {
bytes &= METRICS_REPORTED_BYTES_LOW_MASK;
metrics.bytesRead(metric(), remoteAddress(), val);
}
remainingBytesRead = bytes;
doReportBytesRead(msg, metrics);
}
}

private void doReportBytesRead(Object msg, NetworkMetrics metrics) {
long bytes = remainingBytesRead;
long numberOfBytes = sizeof(msg);
bytes += numberOfBytes;
long val = bytes & METRICS_REPORTED_BYTES_HIGH_MASK;
if (val > 0) {
bytes &= METRICS_REPORTED_BYTES_LOW_MASK;
metrics.bytesRead(metric(), remoteAddress(), val);
}
remainingBytesRead = bytes;
}

protected long sizeof(Object msg) {
Expand Down

0 comments on commit b6d6aae

Please sign in to comment.