4

I am trying to optimise native code. I tried using Debug.startMethodTracing() and Debug.stopMethodTracing(). But its profiling only java functions, its not profiling the native code. The native call that we do from java code is just displayed for that time, the internal native calls are not being displayed. I built the native library in debug mode, even then i am not able to profile the native code.

In stackoverflow i got these links, but these are also not much useful for me, please help me in profiling native code. I am working on the release phone for app development on Android. So, i dont have access to the android source code. Please guide me.

Links:
1) dmtracedump doesn't work, HELP!
2) Android native code profiling
3) http://developer.android.com/guide/developing/debugging/debugging-tracing.html

D:\Profiling>dmtracedump -o D:\Profiling\EvrcEncoderProfiling.trace
ERROR: unable to read 42170 bytes from trace file
D:\Profiling>traceview D:\Profiling\EvrcEncoderProfiling.trace
D:\Profiling>

Traceview is working but dmtracedump is not working.

Thanks & Regards,
SSuman185

Community
  • 1
  • 1
Suman
  • 4,221
  • 7
  • 44
  • 64
  • Please consider this thread as continuation, as in the comment section i cant format the text much i have opened the new thread. If i updated the above thread then continuation will be missed witht he answer [Click here for continuation of the android-ndk-profiler](http://stackoverflow.com/questions/7316399/android-ndk-profiler-no-maps-found) – Suman Sep 06 '11 at 07:34

2 Answers2

4

But its profiling only java functions, its not profiling the native code.

Correct. That is all Traceview can do, since the trace files will only have Dalvik information.

Traceview is working but dmtracedump is not working.

While I do not know why it is not working for you (I have never used it), it will not have any more insight into your native code than will Traceview.

AFAIK, you will need to profile your native code the old-fashioned way: by collecting and logging times.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • I assume you've tried this other [old-fashioned way](http://stackoverflow.com/questions/375913/what-can-i-use-to-profile-c-code-in-linux/378024#378024). – Mike Dunlavey Sep 05 '11 at 13:54
  • Actually i got info on the web regarding the android-ndk-profiler but its not helping. Every time i am getting error No Maps found and not able to trace the native code. – Suman Sep 06 '11 at 07:15
0

Use simpleperf to profile native code on Android: https://android.googlesource.com/platform/system/extras/+/master/simpleperf/doc/README.md

mhansen
  • 1,102
  • 1
  • 12
  • 18