< prev index next >
src/java.base/windows/native/libnio/ch/FileDispatcherImpl.c
Print this page
rev 53271 : 8216981: Per thread IO statistics in JFR
@@ -65,10 +65,16 @@
return IOS_UNAVAILABLE;
}
JNU_ThrowIOExceptionWithLastError(env, "Read failed");
return IOS_THROWN;
}
+
+ if (read > 0) {
+ JVM_callFileReadBytes(env, (jint) read);
+ }
+
+
return convertReturnVal(env, (jint)read, JNI_TRUE);
}
JNIEXPORT jlong JNICALL
Java_sun_nio_ch_FileDispatcherImpl_readv0(JNIEnv *env, jclass clazz, jobject fdo,
@@ -96,10 +102,11 @@
num, /* number of bytes to read */
&read, /* number of bytes read */
NULL); /* no overlapped struct */
if (read > 0) {
totalRead += read;
+ JVM_callFileReadBytes(env, (jint) read);
}
if (read < num) {
break;
}
}
@@ -149,10 +156,14 @@
(LPVOID)address, /* address to put data */
len, /* number of bytes to read */
&read, /* number of bytes read */
&ov); /* position to read from */
+ if (read > 0) {
+ JVM_callFileReadBytes(env, (jint) read);
+ }
+
if (result == 0) {
int error = GetLastError();
if (error == ERROR_BROKEN_PIPE) {
return IOS_EOF;
}
@@ -196,10 +207,12 @@
result = WriteFile(h, /* File handle to write */
(LPCVOID)address, /* pointer to the buffer */
len, /* number of bytes to write */
&written, /* receives number of bytes written */
lpOv); /* overlapped struct */
+ JVM_callFileWriteBytes(env, (jint) written);
+
}
if ((h == INVALID_HANDLE_VALUE) || (result == 0)) {
JNU_ThrowIOExceptionWithLastError(env, "Write failed");
return IOS_THROWN;
@@ -240,10 +253,11 @@
num, /* number of bytes to write */
&written,/* receives number of bytes written */
lpOv); /* overlapped struct */
if (written > 0) {
totalWritten += written;
+ JVM_callFileWriteBytes(env, (jint) written);
}
if (written < num) {
break;
}
}
@@ -282,10 +296,14 @@
(LPCVOID)address, /* pointer to the buffer */
len, /* number of bytes to write */
&written, /* receives number of bytes written */
&ov); /* position to write at */
+ if (written > 0) {
+ JVM_callFileWriteBytes(env, (jint) written);
+ }
+
if ((h == INVALID_HANDLE_VALUE) || (result == 0)) {
JNU_ThrowIOExceptionWithLastError(env, "Write failed");
return IOS_THROWN;
}
< prev index next >