2

I am using systrace/perfetto to capture traces. I am following below way to add custom events from my code - https://developer.android.com/topic/performance/tracing/custom-events

I can see custom events in debug build but cant see in release build.

Is there anyway by which i can see custom events in release build of my app

Rishi
  • 21
  • 4

3 Answers3

3

Starting in Android API 29 (Q), there's a new profileable flag in the manifest that enables some profiling data (e.g. systrace custom events) for non-debuggable builds.

Yi Yang
  • 421
  • 2
  • 6
0

I think making your release build debuggable will do the trick. add following in your app module build.gradle file

  buildTypes {
    release {
        debuggable true
    }
}
Dinkar Kumar
  • 2,175
  • 2
  • 12
  • 22
  • When i do `debuggable true` then leakcanary and strict mode is also enabled(which is wrapped like this - `if (BuildConfig.DEBUG) {}`) . Since i am doing perf testing i dont want these to affect app's performance – Rishi Mar 31 '21 at 07:09
  • any reason you want your release variant to be tested with custom event not debug variant? – Dinkar Kumar Mar 31 '21 at 07:14
  • In my Debug variant i have strict mode and leakcanary enabled . I want to avoid these 2 because it will affect the performance – Rishi Mar 31 '21 at 07:28
  • tracing is for performance testing, if you don't want strict mode and leakcanary to interfere while you do the testing using trace you can disable those when you are doing tracing. – Dinkar Kumar Mar 31 '21 at 07:33
0

Have you added the package name of your app, when you are capturing the trace. You can specify it by -a tag. Adding a package name is mandatory to see custom events in a release build.

for eg :

python systrace.py -o trace_file.html -a package_name sched freq idle am wm gfx view binder_driver hal dalvik camera input res
Mayuri Khinvasara
  • 1,437
  • 1
  • 16
  • 12