1 /* src/native/vm/openjdk/sun_misc_Perf.cpp - sun/misc/Perf
4 CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
5 Copyright (C) 2009 Theobroma Systems Ltd.
7 This file is part of CACAO.
9 This program is free software; you can redistribute it and/or
10 modify it under the terms of the GNU General Public License as
11 published by the Free Software Foundation; either version 2, or (at
12 your option) any later version.
14 This program is distributed in the hope that it will be useful, but
15 WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
29 #include "native/jni.hpp"
30 #include "native/native.hpp"
36 // Native functions are exported as C functions.
40 * Class: sun/misc/Perf
41 * Method: registerNatives
44 JNIEXPORT void JNICALL Java_sun_misc_Perf_registerNatives(JNIEnv *env, jclass clazz)
46 /* The native methods of this function are already registered in
47 _Jv_sun_misc_Perf_init() which is called during VM
53 * Class: sun/misc/Perf
55 * Signature: (Ljava/lang/String;II)Ljava/nio/ByteBuffer;
57 JNIEXPORT jobject JNICALL Java_sun_misc_Perf_attach(JNIEnv *env, jobject _this, jstring user, jint lvmid, jint mode)
59 log_println("Java_sun_misc_Perf_attach: Not supported!");
65 * Class: sun/misc/Perf
66 * Method: createByteArray
67 * Signature: (Ljava/lang/String;II[BI)Ljava/nio/ByteBuffer;
69 JNIEXPORT jobject JNICALL Java_sun_misc_Perf_createByteArray(JNIEnv *env, jobject _this, jstring name, jint variability, jint units, jbyteArray value, jint max_length)
71 log_println("Java_sun_misc_Perf_createByteArray: Not supported!");
75 static uint64_t dummy_perf;
78 * Class: sun/misc/Perf
80 * Signature: (Ljava/lang/String;IIJ)Ljava/nio/ByteBuffer;
82 JNIEXPORT jobject JNICALL Java_sun_misc_Perf_createLong(JNIEnv *env, jobject _this, jstring name, jint variability, jint units, jlong value)
84 return env->functions->NewDirectByteBuffer(env, &dummy_perf, sizeof(dummy_perf));
89 * Class: sun/misc/Perf
91 * Signature: (Ljava/nio/ByteBuffer;)V
93 JNIEXPORT void JNICALL Java_sun_misc_Perf_detach(JNIEnv *env, jobject _this, jobject bb)
95 log_println("Java_sun_misc_Perf_detach: Not supported!");
100 * Class: sun/misc/Perf
101 * Method: highResCounter
104 JNIEXPORT jlong JNICALL Java_sun_misc_Perf_highResCounter(JNIEnv *env, jobject _this)
106 log_println("Java_sun_misc_Perf_highResCounter: IMPLEMENT ME!");
112 * Class: sun/misc/Perf
113 * Method: highResFrequency
116 JNIEXPORT jlong JNICALL Java_sun_misc_Perf_highResFrequency(JNIEnv *env, jobject _this)
118 log_println("Java_sun_misc_Perf_highResFrequency: IMPLEMENT ME!");
125 /* native methods implemented by this file ************************************/
127 static JNINativeMethod methods[] = {
128 { (char*) "registerNatives", (char*) "()V", (void*) (uintptr_t) &Java_sun_misc_Perf_registerNatives },
129 { (char*) "attach", (char*) "(Ljava/lang/String;II)Ljava/nio/ByteBuffer;", (void*) (uintptr_t) &Java_sun_misc_Perf_attach },
130 { (char*) "createByteArray", (char*) "(Ljava/lang/String;II[BI)Ljava/nio/ByteBuffer;", (void*) (uintptr_t) &Java_sun_misc_Perf_createByteArray },
131 { (char*) "createLong", (char*) "(Ljava/lang/String;IIJ)Ljava/nio/ByteBuffer;", (void*) (uintptr_t) &Java_sun_misc_Perf_createLong },
132 { (char*) "detach", (char*) "(Ljava/nio/ByteBuffer;)V", (void*) (uintptr_t) &Java_sun_misc_Perf_detach },
133 { (char*) "highResCounter", (char*) "()J", (void*) (uintptr_t) &Java_sun_misc_Perf_highResCounter },
134 { (char*) "highResFrequency", (char*) "()J", (void*) (uintptr_t) &Java_sun_misc_Perf_highResFrequency },
138 /* _Jv_sun_misc_Perf_init ******************************************************
140 Register native functions.
142 *******************************************************************************/
144 void _Jv_sun_misc_Perf_init(void)
146 utf* u = utf_new_char("sun/misc/Perf");
148 NativeMethods& nm = VM::get_current()->get_nativemethods();
149 nm.register_methods(u, methods, NATIVE_METHODS_COUNT);
154 * These are local overrides for various environment variables in Emacs.
155 * Please do not remove this and leave it at the end of the file, where
156 * Emacs will automagically detect them.
157 * ---------------------------------------------------------------------
160 * indent-tabs-mode: t
164 * vim:noexpandtab:sw=4:ts=4: