Skip to content

Commit

Permalink
Dump profiler trace after flushing microtasks in CLI
Browse files Browse the repository at this point in the history
Reviewed By: avp

Differential Revision: D69146622

fbshipit-source-id: fe12d0ed792324961d82c2ff11b6903b0ef201d9
  • Loading branch information
neildhar authored and facebook-github-bot committed Feb 5, 2025
1 parent b92470c commit 8b30967
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions lib/ConsoleHost/ConsoleHost.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -465,21 +465,6 @@ bool executeHBCBytecodeImpl(
sourceURL,
vm::Runtime::makeNullHandle<vm::Environment>());

#if HERMESVM_SAMPLING_PROFILER_AVAILABLE
switch (options.sampleProfiling) {
case ExecuteOptions::SampleProfilingMode::None:
break;
case ExecuteOptions::SampleProfilingMode::Chrome:
vm::SamplingProfiler::disable();
runtime->samplingProfiler->dumpChromeTrace(llvh::errs());
break;
case ExecuteOptions::SampleProfilingMode::Tracery:
vm::SamplingProfiler::disable();
runtime->samplingProfiler->dumpTraceryTrace(llvh::errs());
break;
}
#endif // HERMESVM_SAMPLING_PROFILER_AVAILABLE

bool threwException = status == vm::ExecutionStatus::EXCEPTION;

if (threwException) {
Expand Down Expand Up @@ -513,6 +498,21 @@ bool executeHBCBytecodeImpl(
}
}

#if HERMESVM_SAMPLING_PROFILER_AVAILABLE
switch (options.sampleProfiling) {
case ExecuteOptions::SampleProfilingMode::None:
break;
case ExecuteOptions::SampleProfilingMode::Chrome:
vm::SamplingProfiler::disable();
runtime->samplingProfiler->dumpChromeTrace(llvh::errs());
break;
case ExecuteOptions::SampleProfilingMode::Tracery:
vm::SamplingProfiler::disable();
runtime->samplingProfiler->dumpTraceryTrace(llvh::errs());
break;
}
#endif // HERMESVM_SAMPLING_PROFILER_AVAILABLE

#ifdef HERMESVM_PROFILER_OPCODE
runtime->dumpOpcodeStats(llvh::outs());
#endif
Expand Down

0 comments on commit 8b30967

Please sign in to comment.