From: Maynard J. <may...@us...> - 2007-11-29 17:49:27
|
Update of /cvsroot/oprofile/oprofile/agents/jvmti In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv27913/agents/jvmti Modified Files: Tag: JIT_SUPPORT libjvmti_oprofile.c Log Message: Optionally dump code to JIT dumpfile Index: libjvmti_oprofile.c =================================================================== RCS file: /cvsroot/oprofile/oprofile/agents/jvmti/Attic/libjvmti_oprofile.c,v retrieving revision 1.1.2.7 retrieving revision 1.1.2.8 diff -u -p -d -r1.1.2.7 -r1.1.2.8 --- libjvmti_oprofile.c 27 Nov 2007 11:49:51 -0000 1.1.2.7 +++ libjvmti_oprofile.c 29 Nov 2007 17:49:14 -0000 1.1.2.8 @@ -248,14 +248,18 @@ Agent_OnLoad(JavaVM * jvm, char * option jvmtiJlocationFormat format; jvmtiError error; int err; + int include_code = 0; reserved = reserved; /* shut up compiler warning */ fprintf(stderr, "jvmti_oprofile: agent activated\n"); - if (options && !strcmp("debug", options)) + if (options && strstr(options, "debug")) debug = 1; - err = op_open_agent(); + if (options && strstr(options, "include-code")) + include_code = 1; + + err = op_open_agent(include_code); if (err) { fprintf(stderr, "Error: op_open_agent(), rc=%i\n", err); return -1; @@ -288,7 +292,9 @@ Agent_OnLoad(JavaVM * jvm, char * option memset(&callbacks, 0, sizeof(callbacks)); callbacks.CompiledMethodLoad = cb_compiled_method_load; callbacks.CompiledMethodUnload = cb_compiled_method_unload; - callbacks.DynamicCodeGenerated = cb_dynamic_code_generated; + if (include_code) + callbacks.DynamicCodeGenerated = cb_dynamic_code_generated; + error = (*jvmti)->SetEventCallbacks(jvmti, &callbacks, sizeof(callbacks)); if (handle_error(error, "SetEventCallbacks()", 1)) @@ -304,11 +310,14 @@ Agent_OnLoad(JavaVM * jvm, char * option if (handle_error(error, "SetEventNotificationMode() " "JVMTI_EVENT_COMPILED_METHOD_UNLOAD", 1)) return -1; - error = (*jvmti)->SetEventNotificationMode(jvmti, JVMTI_ENABLE, + if (include_code) { + error = (*jvmti)->SetEventNotificationMode( + jvmti, JVMTI_ENABLE, JVMTI_EVENT_DYNAMIC_CODE_GENERATED, NULL); - if (handle_error(error, "SetEventNotificationMode() " - "JVMTI_EVENT_DYNAMIC_CODE_GENERATED", 1)) - return -1; + if (handle_error(error, "SetEventNotificationMode() " + "JVMTI_EVENT_DYNAMIC_CODE_GENERATED", 1)) + return -1; + } return 0; } |