Skip to content

Commit fa4e82a

Browse files
authored
Merge pull request #2 from prasun3/master
Allow perf-map-agent to be loaded at startup
2 parents 8dcc2eb + e64161d commit fa4e82a

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/c/perf-map-agent.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,21 @@ jvmtiError set_callbacks(jvmtiEnv *jvmti) {
337337
return (*jvmti)->SetEventCallbacks(jvmti, &callbacks, (jint)sizeof(callbacks));
338338
}
339339

340+
JNIEXPORT jint JNICALL
341+
Agent_OnLoad(JavaVM *vm, char *options, void *reserved)
342+
{
343+
open_map_file();
344+
345+
jvmtiEnv *jvmti;
346+
(*vm)->GetEnv(vm, (void **)&jvmti, JVMTI_VERSION_1);
347+
enable_capabilities(jvmti);
348+
set_callbacks(jvmti);
349+
set_notification_mode(jvmti, JVMTI_ENABLE);
350+
351+
return 0;
352+
}
353+
354+
340355
JNIEXPORT jint JNICALL
341356
Agent_OnAttach(JavaVM *vm, char *options, void *reserved) {
342357
open_map_file();

0 commit comments

Comments
 (0)