MCPcopy Create free account
hub / github.com/async-profiler/async-profiler / Agent_OnAttach

Function Agent_OnAttach

src/vmEntry.cpp:495–525  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

493}
494
495extern "C" DLLEXPORT jint JNICALL
496Agent_OnAttach(JavaVM* vm, char* options, void* reserved) {
497 Arguments args;
498 Error error = args.parse(options);
499
500 Log::open(args);
501
502 if (error) {
503 Log::error("%s", error.message());
504 return ARGUMENTS_ERROR;
505 }
506
507 if (!VM::init(vm, true)) {
508 Log::error("JVM does not support Tool Interface");
509 return COMMAND_ERROR;
510 }
511
512 error = Profiler::instance()->run(args);
513 if (error) {
514 Log::error("%s", error.message());
515 if (args.hasTemporaryLog()) Log::close();
516 return COMMAND_ERROR;
517 }
518
519 if (args._action == ACTION_STOP && args.hasTemporaryLog()) {
520 // The launcher immediately deletes logs after printing
521 Log::close();
522 }
523
524 return 0;
525}
526
527extern "C" DLLEXPORT jint JNICALL
528JNI_OnLoad(JavaVM* vm, void* reserved) {

Callers

nothing calls this directly

Calls 5

errorFunction · 0.85
messageMethod · 0.80
hasTemporaryLogMethod · 0.80
parseMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected