< prev index next >
src/java.base/unix/native/libnio/ch/DatagramDispatcher.c
Print this page
rev 53271 : 8216981: Per thread IO statistics in JFR
*** 48,57 ****
--- 48,62 ----
int result = recv(fd, buf, len, 0);
if (result < 0 && errno == ECONNREFUSED) {
JNU_ThrowByName(env, JNU_JAVANETPKG "PortUnreachableException", 0);
return -2;
}
+
+ if (result > 0) {
+ JVM_callNetworkReadBytes(env, result);
+ }
+
return convertReturnVal(env, result, JNI_TRUE);
}
JNIEXPORT jlong JNICALL
*** 74,83 ****
--- 79,93 ----
result = recvmsg(fd, &m, 0);
if (result < 0 && errno == ECONNREFUSED) {
JNU_ThrowByName(env, JNU_JAVANETPKG "PortUnreachableException", 0);
return -2;
}
+
+ if (result > 0) {
+ JVM_callNetworkReadBytes(env, result);
+ }
+
return convertLongReturnVal(env, (jlong)result, JNI_TRUE);
}
JNIEXPORT jint JNICALL
Java_sun_nio_ch_DatagramDispatcher_write0(JNIEnv *env, jclass clazz,
*** 88,97 ****
--- 98,112 ----
int result = send(fd, buf, len, 0);
if (result < 0 && errno == ECONNREFUSED) {
JNU_ThrowByName(env, JNU_JAVANETPKG "PortUnreachableException", 0);
return -2;
}
+
+ if (result > 0) {
+ JVM_callNetworkWriteBytes(env, result);
+ }
+
return convertReturnVal(env, result, JNI_FALSE);
}
JNIEXPORT jlong JNICALL
Java_sun_nio_ch_DatagramDispatcher_writev0(JNIEnv *env, jclass clazz,
*** 113,119 ****
--- 128,139 ----
result = sendmsg(fd, &m, 0);
if (result < 0 && errno == ECONNREFUSED) {
JNU_ThrowByName(env, JNU_JAVANETPKG "PortUnreachableException", 0);
return -2;
}
+
+ if (result > 0) {
+ JVM_callNetworkWriteBytes(env, result);
+ }
+
return convertLongReturnVal(env, (jlong)result, JNI_FALSE);
}
< prev index next >