harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Wenlong Li (JIRA)" <j...@apache.org>
Subject [jira] Created: (HARMONY-6061) [Harmony][VM] VM Destroy time is long
Date Thu, 25 Dec 2008 06:08:44 GMT
[Harmony][VM] VM Destroy time is long
-------------------------------------

                 Key: HARMONY-6061
                 URL: https://issues.apache.org/jira/browse/HARMONY-6061
             Project: Harmony
          Issue Type: Improvement
         Environment: On both Linux (Pentium D) and Windows system (Core 2 Quad-core).
            Reporter: Wenlong Li


The VM shutdown module in jni.cpp takes more than 1 second to complete. Besides, its execution
time is not stable.

I insert the time instrumentation code in DestroyJavaVM function in jni.cpp

   VMEXPORT jint JNICALL DestroyJavaVM(JavaVM * vm)
{
    const char* name = "destroy";
    jboolean daemon = JNI_FALSE;
    jthread java_thread;
    JavaVM_Internal * java_vm;
    JNIEnv * jni_env;
    jint status;
    apr_time_t start_time, end_time;
    start_time = apr_time_now();    
    TRACE("DestroyJavaVM  called");

    java_vm = (JavaVM_Internal *) vm;

    java_thread = jthread_self();
    if (java_thread == NULL) {
        // Attaches main thread to VM.
        status = vm_attach_internal(&jni_env, &java_thread, java_vm, NULL, name, daemon);
        if (status != JNI_OK) return status;

        IDATA jtstatus = jthread_attach(jni_env, java_thread, daemon);
        if (jtstatus != TM_ERROR_NONE) return JNI_ERR;
        // Now JVMTIThread keeps global reference. Discared temporary global reference.
        jni_env->DeleteGlobalRef(java_thread);

        java_thread = jthread_self();        
    }    
    assert(java_thread != NULL);

    status = vm_destroy(java_vm, java_thread);

    // Destroy VM environment.
    java_vm->vm_env->~Global_Env();
    java_vm->vm_env = NULL;
    
    CmReleaseComponent(OPEN_VM);
    CmRelease();

#ifdef _MEMMGR_REPORT
    report_leaked_malloc();
#endif
    end_time = apr_time_now();
    printf("VM Destroy Time: %d\n", (end_time - start_time)/1000);	
    return status;
}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message