Skip to content Skip to sidebar Skip to footer

Atrace_isenabled() Return False

I created a console program and run it in my android phone(android 6.0 and API LEVEL is 23). And it has a function named net_test, show as below. void net_test() {

Solution 1:

Jason, by using those commands that you have written, ATrace_isEnabled is becoming true but once you give this command python systrace.py -t 4 -o mynewtrace.html perf sched gfx, as here you have specified t=4 sec, so after 4 secs, it will again become false. So, everytime you need to trace, you have to give following command.

adb shell "setprop debug.atrace.app_number 1" adb shell "setprop debug.atrace.app_0 appname"

Here, make sure you put correct app name which is visible in logcat, because sometime, appname is different. And now for tracing, you need to specify which app you want to trace, because by default that is disabled. So, here command will be

python systrace.py -t 4 -a appname -o mynewtrace.html perf sched gfx

Another easy way to trace is by using Android P's(or above) predefined systrace option which you can get in android's developers option. There you don't need to give any commands. Just push .so file of your custom events and trace directly by running your app.

Solution 2:

For ATrace_isEnabled() (reference), this function finally calls into atrace_is_cmdline_match() in platform/system/core/libcutils/trace-dev.c. (reference).

Since this API is hard-coded as application category (ATRACE_TAG_APP), you have to enable tracer of this category by following command.

adb shell "setprop debug.atrace.tags.enableflags 0x1000"

(You can also set other bits to 1 to enable other categories.)

For example, if your console program is "simapp", you can enter following commands to enable systrace.

adb shell "setprop debug.atrace.app_number 1"
adb shell "setprop debug.atrace.app_0 simapp"

Solution 3:

As far as I understand, when capturing traces, you have to explicitly specify your app to enable tracing for it. https://developer.android.com/topic/performance/tracing/command-line#command_options suggests it's -a app-name param. Alternatively, if you're still using the UI of monitor app on Windows, you have to select the app to trace in the dropdown list, taken it has android:debuggable set to true.

Post a Comment for "Atrace_isenabled() Return False"