harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gshiman...@apache.org
Subject svn commit: r514861 - in /harmony/enhanced/drlvm/trunk/vm/vmcore: include/environment.h src/jit/compile.cpp src/jni/jni.cpp src/kernel_classes/native/org_apache_harmony_lang_management_CompilationMXBeanImpl.cpp
Date Mon, 05 Mar 2007 20:54:25 GMT
Author: gshimansky
Date: Mon Mar  5 12:54:24 2007
New Revision: 514861

URL: http://svn.apache.org/viewvc?view=rev&rev=514861
Log:
Applied HARMONY-3292 [drlvm][lang-management] CompilationMXBean native methods implementation


Modified:
    harmony/enhanced/drlvm/trunk/vm/vmcore/include/environment.h
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/jit/compile.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/jni/jni.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/native/org_apache_harmony_lang_management_CompilationMXBeanImpl.cpp

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/include/environment.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/include/environment.h?view=diff&rev=514861&r1=514860&r2=514861
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/include/environment.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/include/environment.h Mon Mar  5 12:54:24 2007
@@ -241,6 +241,11 @@
      * VM initialization timestamp
      */
     apr_time_t start_time;
+ 
+    /**
+     * Total method compilation time in msec
+     */
+    apr_time_t total_compilation_time;
 
     /**
      * The VM state. See <code>VM_STATE</code> enum above.

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/jit/compile.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jit/compile.cpp?view=diff&rev=514861&r1=514860&r2=514861
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/jit/compile.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/jit/compile.cpp Mon Mar  5 12:54:24 2007
@@ -615,6 +615,9 @@
 
 JIT_Result compile_do_compilation_jit(Method* method, JIT* jit)
 {
+    // Time stamp for counting the total compilation time
+    apr_time_t start;
+
     Global_Env * vm_env = VM_Global_State::loader_env;
 
     assert(method);
@@ -642,11 +645,16 @@
     ch.env = VM_Global_State::loader_env;
     ch.jit = jit;
 
+    start = apr_time_now();
+
     TRACE("compile_do_compilation_jit(): calling jit->compile_method_with_params() for
method " << method );
 
     JIT_Result res = jit->compile_method_with_params(&ch, method, flags);
 
     TRACE("compile_do_compilation_jit(): returned from jit->compile_method_with_params()
for method " << method );
+
+    // Convertion from microseconds to milliseconds
+    vm_env->total_compilation_time += ((apr_time_now() - start)/1000);
 
     if (JIT_SUCCESS != res) {
         if (!parallel_jit) {

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/jni/jni.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jni/jni.cpp?view=diff&rev=514861&r1=514860&r2=514861
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/jni/jni.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/jni/jni.cpp Mon Mar  5 12:54:24 2007
@@ -485,6 +485,7 @@
     }
 
     vm_env->start_time = apr_time_now()/1000;
+    vm_env->total_compilation_time = 0;
 
     java_vm->functions = &java_vm_vtable;
     java_vm->pool = vm_global_pool;

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/native/org_apache_harmony_lang_management_CompilationMXBeanImpl.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/native/org_apache_harmony_lang_management_CompilationMXBeanImpl.cpp?view=diff&rev=514861&r1=514860&r2=514861
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/native/org_apache_harmony_lang_management_CompilationMXBeanImpl.cpp
(original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/native/org_apache_harmony_lang_management_CompilationMXBeanImpl.cpp
Mon Mar  5 12:54:24 2007
@@ -28,6 +28,8 @@
  */
 
 #include <cxxlog.h>
+#include "interpreter.h"
+#include "environment.h"
 #include "org_apache_harmony_lang_management_CompilationMXBeanImpl.h"
 /*
  * Class:     org_apache_harmony_lang_management_CompilationMXBeanImpl
@@ -37,9 +39,8 @@
 JNIEXPORT jboolean JNICALL Java_org_apache_harmony_lang_management_CompilationMXBeanImpl_isJITEnabled
 (JNIEnv *, jclass)
 {
-    // TODO implement this method stub correctly
-    TRACE2("management","isJITEnabled stub invocation");
-    return JNI_TRUE;
+    TRACE2("management","CompilationMXBeanImpl_isJITEnabled called");
+    return interpreter_enabled() ? JNI_FALSE : JNI_TRUE;
 };
 
 /*
@@ -48,11 +49,12 @@
  * Signature: ()J
  */
 JNIEXPORT jlong JNICALL Java_org_apache_harmony_lang_management_CompilationMXBeanImpl_getTotalCompilationTimeImpl
-(JNIEnv *, jobject)
+(JNIEnv * env, jobject)
 {
-    // TODO implement this method stub correctly
-    TRACE2("management","getTotalCompilationTimeImpl stub invocation");
-    return 1L<<5;
+    TRACE2("management","CompilationMXBeanImpl_getTotalCompilationTimeImpl called");
+    JavaVM * vm = NULL;
+    env->GetJavaVM(&vm);
+    return ((JavaVM_Internal*)vm)->vm_env->total_compilation_time;
 };
 
 /*
@@ -63,8 +65,7 @@
 JNIEXPORT jboolean JNICALL Java_org_apache_harmony_lang_management_CompilationMXBeanImpl_isCompilationTimeMonitoringSupportedImpl
 (JNIEnv *, jobject)
 {
-    // TODO implement this method stub correctly
-    TRACE2("management","isCompilationTimeMonitoringSupportedImpl stub invocation");
+    TRACE2("management","CompilationMXBeanImpl_isCompilationTimeMonitoringSupportedImpl called");
     return JNI_TRUE;
 };
 



Mime
View raw message