< 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,74 **** --- 65,80 ---- 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,105 **** --- 102,112 ---- 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,158 **** --- 156,169 ---- (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,205 **** --- 207,218 ---- 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,249 **** --- 253,263 ---- 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,291 **** --- 296,309 ---- (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 >