Skip to content

Commit

Permalink
Allow loading agent on startup
Browse files Browse the repository at this point in the history
  • Loading branch information
brancz committed Jan 4, 2022
1 parent d9843a0 commit b169e83
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/c/perf-map-agent.c
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,20 @@ jvmtiError set_callbacks(jvmtiEnv *jvmti) {
return (*jvmti)->SetEventCallbacks(jvmti, &callbacks, (jint)sizeof(callbacks));
}

JNIEXPORT jint JNICALL
Agent_OnLoad(JavaVM *vm, char *options, void *reserved)
{
open_map_file();

jvmtiEnv *jvmti;
(*vm)->GetEnv(vm, (void **)&jvmti, JVMTI_VERSION_1);
enable_capabilities(jvmti);
set_callbacks(jvmti);
set_notification_mode(jvmti, JVMTI_ENABLE);

return 0;
}

JNIEXPORT jint JNICALL
Agent_OnAttach(JavaVM *vm, char *options, void *reserved) {
open_map_file();
Expand Down

0 comments on commit b169e83

Please sign in to comment.