Skip to content
This repository has been archived by the owner on May 1, 2023. It is now read-only.

Commit

Permalink
Add flag for JIT frames unwind support
Browse files Browse the repository at this point in the history
Reviewed By: aandreyeu

Differential Revision: D37669404

fbshipit-source-id: 805483bd312eaf37a17cb79755457e2a90d9a5bb
  • Loading branch information
simpleton authored and facebook-github-bot committed Jul 13, 2022
1 parent 7a74e8a commit e055ce7
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cpp/profiler/jni.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ std::unordered_map<int32_t, std::shared_ptr<BaseTracer>> makeAvailableTracers(
MultiBufferLogger& logger,
uint32_t available_tracers,
bool native_tracer_unwind_dex_frames,
bool native_tracer_unwind_jit_frames,
int32_t native_tracer_unwind_thread_pri,
size_t native_tracer_unwind_queue_size,
bool native_tracer_log_partial_stacks) {
Expand All @@ -77,6 +78,7 @@ std::unordered_map<int32_t, std::shared_ptr<BaseTracer>> makeAvailableTracers(
tracers[tracers::NATIVE] = std::make_shared<NativeTracer>(
logger,
native_tracer_unwind_dex_frames,
native_tracer_unwind_jit_frames,
native_tracer_unwind_thread_pri,
native_tracer_unwind_queue_size,
native_tracer_log_partial_stacks);
Expand Down Expand Up @@ -143,6 +145,7 @@ static jboolean nativeInitialize(
JMultiBufferLogger* jlogger,
jint tracers,
jboolean native_tracer_unwind_dex_frames,
jboolean native_tracer_unwind_jit_frames,
jint native_tracer_unwind_thread_pri,
jint native_tracer_unwind_queue_size,
jboolean native_tracer_log_partial_stacks) {
Expand All @@ -155,6 +158,7 @@ static jboolean nativeInitialize(
logger,
available_tracers,
native_tracer_unwind_dex_frames,
native_tracer_unwind_jit_frames,
native_tracer_unwind_thread_pri,
static_cast<size_t>(native_tracer_unwind_queue_size),
native_tracer_log_partial_stacks));
Expand Down
2 changes: 2 additions & 0 deletions java/main/com/facebook/profilo/core/ProfiloConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ public static String abortReasonName(int abortReason) {
"provider.stack_trace.thread_detect_interval_ms";
public static final String PROVIDER_PARAM_NATIVE_STACK_TRACE_UNWIND_DEX_FRAMES =
"provider.native_stack_trace.unwind_dex_frames";
public static final String PROVIDER_PARAM_NATIVE_STACK_TRACE_UNWIND_JIT_FRAMES =
"provider.native_stack_trace.unwind_jit_frames";
public static final String PROVIDER_PARAM_NATIVE_STACK_TRACE_UNWINDER_THREAD_PRIORITY =
"provider.native_stack_trace.unwinder_thread_pri";
public static final String PROVIDER_PARAM_NATIVE_STACK_TRACE_UNWINDER_QUEUE_SIZE =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ public static synchronized boolean init(
Context context,
MultiBufferLogger logger,
boolean nativeTracerUnwindDexFrames,
boolean nativeTracerUnwindJitFrames,
int nativeTracerUnwinderThreadPriority,
int nativeTracerUnwinderQueueSize,
boolean nativeTracerLogPartialStacks)
Expand All @@ -125,6 +126,7 @@ public static synchronized boolean init(
logger,
sAvailableTracers,
nativeTracerUnwindDexFrames,
nativeTracerUnwindJitFrames,
nativeTracerUnwinderThreadPriority,
nativeTracerUnwinderQueueSize,
nativeTracerLogPartialStacks);
Expand Down Expand Up @@ -179,6 +181,7 @@ private static native boolean nativeInitialize(
MultiBufferLogger logger,
int availableTracers,
boolean nativeTracerUnwindDexFrames,
boolean nativeTracerUnwindJitFrames,
int nativeTracerUnwinderThreadPriority,
int nativeTracerUnwinderQueueSize,
boolean nativeTracerLogPartialStacks);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ private static int providersToTracers(int providers) {
*/
private synchronized boolean initProfiler(
boolean nativeTracerUnwindDexFrames,
boolean nativeTracerUnwindJitFrames,
int nativeTracerUnwinderThreadPriority,
int nativeTracerUnwinderQueueSize,
boolean nativeTracerLogPartialStacks) {
Expand All @@ -108,6 +109,7 @@ private synchronized boolean initProfiler(
mContext,
getLogger(),
nativeTracerUnwindDexFrames,
nativeTracerUnwindJitFrames,
nativeTracerUnwinderThreadPriority,
nativeTracerUnwinderQueueSize,
nativeTracerLogPartialStacks);
Expand All @@ -122,12 +124,14 @@ private synchronized boolean enableInternal(
int threadDetectIntervalMs,
int enabledProviders,
boolean nativeTracerUnwindDexFrames,
boolean nativeTracerUnwindJitFrames,
int nativeTracerUnwinderThreadPriority,
int nativeTracerUnwinderQueueSize,
TimeSource timeSource,
boolean nativeTracerLogPartialStacks) {
if (!initProfiler(
nativeTracerUnwindDexFrames,
nativeTracerUnwindJitFrames,
nativeTracerUnwinderThreadPriority,
nativeTracerUnwinderQueueSize,
nativeTracerLogPartialStacks)) {
Expand Down Expand Up @@ -233,6 +237,8 @@ protected void enable() {
context.enabledProviders,
context.mTraceConfigExtras.getBoolParam(
ProfiloConstants.PROVIDER_PARAM_NATIVE_STACK_TRACE_UNWIND_DEX_FRAMES, false),
context.mTraceConfigExtras.getBoolParam(
ProfiloConstants.PROVIDER_PARAM_NATIVE_STACK_TRACE_UNWIND_JIT_FRAMES, true),
context.mTraceConfigExtras.getIntParam(
ProfiloConstants.PROVIDER_PARAM_NATIVE_STACK_TRACE_UNWINDER_THREAD_PRIORITY,
ProfiloConstants.TRACE_CONFIG_PARAM_LOGGER_PRIORITY_DEFAULT),
Expand Down

0 comments on commit e055ce7

Please sign in to comment.