HI. I haven't coded in C for some time, and no experience with JNI
I dabbled a bit in JNI and creating native functions.
I would like to know, how can I call Java VM os functions from my own libraries without much hassle? e.g. os::javaTimeMillis(), or os::active_processor_count() ?
#include "HelloWorld.h"
JNIEXPORT void JNICALL Java_HelloWorld_sayHi
(JNIEnv *env, jclass clazz) {
printf("Hello\n");
long x = os::javaTimeMillis(); // HOW TO DO THAT?
}
Including src/share/vm/runtime/os.hpp seems overkill with lot of dependencies?
http://hg.openjdk.java.net/jdk8/jdk8/hotspot/file/87ee5ee27509/src/share/vm/runtime/os.hpp
Could I create a custom header file copy-pasting parts from os.hpp to make some functions known?
And I don't want to java-call the native java methods that mapped to these os functions, but call C functions directly.