< prev index next >
src/java.base/unix/native/libnio/fs/UnixNativeDispatcher.c
Print this page
rev 53271 : 8216981: Per thread IO statistics in JFR
@@ -76,10 +76,12 @@
#include "jni.h"
#include "jni_util.h"
#include "jlong.h"
+#include "jvm.h"
+
#include "sun_nio_fs_UnixNativeDispatcher.h"
#if defined(_AIX)
#define DIR DIR64
#define dirent dirent64
@@ -446,10 +448,15 @@
void* bufp = jlong_to_ptr(address);
RESTARTABLE(read((int)fd, bufp, (size_t)nbytes), n);
if (n == -1) {
throwUnixException(env, errno);
}
+
+ if (n > 0) {
+ JVM_callFileReadBytes(env, (jint) n);
+ }
+
return (jint)n;
}
JNIEXPORT jint JNICALL
Java_sun_nio_fs_UnixNativeDispatcher_write(JNIEnv* env, jclass this, jint fd,
@@ -459,10 +466,15 @@
void* bufp = jlong_to_ptr(address);
RESTARTABLE(write((int)fd, bufp, (size_t)nbytes), n);
if (n == -1) {
throwUnixException(env, errno);
}
+
+ if (n > 0) {
+ JVM_callFileWriteBytes(env, (jint) n);
+ }
+
return (jint)n;
}
/**
* Copy stat64 members into sun.nio.fs.UnixFileAttributes
< prev index next >