Add tracing to JNI |
||
Issue descriptionI found it useful to have tracing in JNI functions generated by jni_generator. Oftentimes Java code doesn't have traces, and in such cases JNI traces can provide additional insight. I suggest we hide tracing behind enable_jni_tracing GN argument, similar to other tracing we have (enable_ipc_logging, enable_mojo_tracing).
,
May 18 2018
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/72e4521766dcfa34cef6500ff43ae33075978c6b commit 72e4521766dcfa34cef6500ff43ae33075978c6b Author: Dmitry Skiba <dskiba@chromium.org> Date: Fri May 18 19:11:34 2018 Trace generated JNI functions. This CL modifies jni_generator to add TRACE_EVENTs to generated functions when "enable_jni_tracing" GN flag is set to "true". Tracing events are added as TRACE_EVENT0("jni", <name>), where <name> is the fully qualified name of the function that is about to be called. I.e. <name> can be either Java or C++ function name, depending on the direction of the call. Example: package com.example; @JNINamespace("com_example") public class Foo { @CalledByNative Foo(); // TRACE_EVENT0("jni", "com.example.Foo.<init>") @CalledByNative void callbackFromNative(); // TRACE_EVENT0("jni", "com.example.Foo.callbackFromNative") native void nativeInstanceMethod(long nativeInstance); // TRACE_EVENT0("jni", "com_example::Foo::InstanceMethod") static native void nativeStaticMethod(); // TRACE_EVENT0("jni", "com_example::JNI_Foo_StaticMethod") } Bug: 842241 Change-Id: Ib110a7070e3d2de05c2090055fb4acc8a6b40e78 Reviewed-on: https://chromium-review.googlesource.com/1064705 Reviewed-by: agrieve <agrieve@chromium.org> Commit-Queue: Dmitry Skiba <dskiba@chromium.org> Cr-Commit-Position: refs/heads/master@{#559983} [modify] https://crrev.com/72e4521766dcfa34cef6500ff43ae33075978c6b/base/android/jni_generator/jni_generator.py [modify] https://crrev.com/72e4521766dcfa34cef6500ff43ae33075978c6b/base/android/jni_generator/jni_generator_helper.h [modify] https://crrev.com/72e4521766dcfa34cef6500ff43ae33075978c6b/base/android/jni_generator/jni_generator_tests.py [add] https://crrev.com/72e4521766dcfa34cef6500ff43ae33075978c6b/base/android/jni_generator/testTracing.golden [modify] https://crrev.com/72e4521766dcfa34cef6500ff43ae33075978c6b/build/config/android/rules.gni
,
May 22 2018
|
||
►
Sign in to add a comment |
||
Comment 1 by dskiba@chromium.org
, May 17 2018