Skip to content

Commit

Permalink
add logs to debug
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangyi committed Aug 16, 2023
1 parent 6da8211 commit 34ea077
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/profiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1039,12 +1039,14 @@ Error Profiler::start(Arguments& args, bool reset) {
_alloc_engine = selectAllocEngine(args._alloc, args._live);
error = _alloc_engine->start(args);
if (error) {
Log::warn("unable to start alloc engine: %s", error.message());
goto error2;
}
}
if (_event_mask & EM_LOCK) {
error = lock_tracer.start(args);
if (error) {
Log::warn("unable to start lock tracer: %s", error.message());
goto error3;
}
}
Expand Down Expand Up @@ -1486,6 +1488,7 @@ void Profiler::timerLoop(void* timer_id) {
if (_timer_id != timer_id) return;

if ((current_micros = OS::micros()) >= stop_micros) {
Log::info("stop_micros reached, restart profiler now.");
VM::restartProfiler();
return;
}
Expand Down Expand Up @@ -1629,6 +1632,7 @@ Error Profiler::restart(Arguments& args) {

if (args._loop) {
if (_hung_time > 0 && OS::micros() >= (u64)_hung_time * 1000000ULL) {
Log::info("Time to live reached");
return Error::OK;
}
_in_first_loop = false;
Expand Down
7 changes: 6 additions & 1 deletion src/vmEntry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,12 @@ void VM::loadAllMethodIDs(jvmtiEnv* jvmti, JNIEnv* jni) {
}

void VM::restartProfiler() {
Profiler::instance()->restart(_agent_args);
Error err = Profiler::instance()->restart(_agent_args);
if (err) {
Log::error("VM::restartProfiler fail: %s", err.message() == NULL ? "" : err.message());
} else {
Log::info("VM::restartProfiler success.");
}
}

void JNICALL VM::VMInit(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) {
Expand Down

0 comments on commit 34ea077

Please sign in to comment.