Android: is there any tool for profiling native code?

前端 未结 4 937
长情又很酷
长情又很酷 2021-02-04 02:25

I have only found one profiling tool - http://code.google.com/p/android-ndk-profiler/. Wasn\'t able to get it working so far, so I wonder if there are other tools available. I n

相关标签:
4条回答
  • 2021-02-04 03:09

    The Shiny profiler is platform independent, it runs anywhere and it does not have any dependencies besides a standard C++ compiler. In its more simple usage, all you need to do is add a macro at the beginning of all functions and methods (or at least those that you want to profile).

    0 讨论(0)
  • 2021-02-04 03:09

    Intel VTune Amplifier. This profiler allows you to collect hotspots with stacks on Android devices without root or any OS modification. Here is simple guide: http://software.intel.com/en-us/articles/using-intel-vtune-amplifier-on-non-rooted-android-devices

    0 讨论(0)
  • 2021-02-04 03:16

    In the NDK r13b there is a new tool called simpleperf

    0 讨论(0)
  • 2021-02-04 03:17

    It is not easy to make the Android-NDK profiler work. You need to follow the steps here thoroughly.

    Here are some tips that led me to success:

    • Make sure your android.mk is correct and that you export the NDK_MODULE_PATH.
    • Use correctly the following functions

      monstartup("your_lib.so");

      moncleanup();

    • If the gmon.out is generated now you need to pull it from the device, but not to anywhere in your PC. For me it only works if I go to the application's folder (where jni, obj, res and other folders are) and I do:

      console$ adb pull sdcard/gmon.out

    • Then run gprof. Try will all the versions in your NDK toolchains. For me only one worked, this one:

      console$ ~/Libraries/android-ndk-r9/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gprof obj/local/armeabi-v7a/libxxxx.so > profile.txt

    0 讨论(0)
提交回复
热议问题