Android NDK加载CPU

时间:2011-06-27 08:49:27

标签: android profiling cpu android-ndk

使用Android NDK编写程序。该程序使用了一些库。这一切都是非常重的CPU到90%。如何找出大多数加载CPU的库?是否有这种特殊的技术或工具?

编辑: 这就是我得到的:



[user@localhost HelloNDK]$ ./remotegdb.sh
Package name is org.divenvrsk.android.hellondk
Found running pid: 7726
Device CPU ABIs: armeabi-v7a armeabi
Using app_out directory: /home/user/Dropbox/HelloNDK/obj/local/armeabi-v7a
68 KB/s (5680 bytes in 0.080s)
Pulled /home/user/Dropbox/HelloNDK/obj/local/armeabi-v7a/app_process from device/emulator.
2206 KB/s (278276 bytes in 0.123s)
Pulled /home/user/Dropbox/HelloNDK/obj/local/armeabi-v7a/libc.so from device/emulator.
Running gdbserver :5039 --attach 7726
su: not found
/home/user/android-ndk-r5b/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-
/home/user/Dropbox/HelloNDK/libs/armeabi-v7a/gdb.setup
GNU gdb 6.6
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "--host=x86_64-linux-gnu --target=arm-elf-linux".
Warning: /home/user/Dropbox/HelloNDK/jni/sox/flac/src/share/include: No such file or directory.
Warning: /home/user/Dropbox/HelloNDK/jni/sox/flac/src/metaflac/include: No such file or directory.
Warning: /home/user/Dropbox/HelloNDK/jni/sox/src/../libpng-1.5.2/include: No such file or directory.
Warning: /home/user/Dropbox/HelloNDK/jni/sox/work/../libpng-1.5.2/include: No such file or directory.
/home/user/Dropbox/HelloNDK/obj/local/armeabi-v7a/gdb.setup:3: Error in sourced command file:
Remote communication error: Connection reset by peer.
(gdb) 

下一步要做什么来确定加载某些库?

2 个答案:

答案 0 :(得分:2)

ndk-gdb和android-ndk-profiler可以帮助您获取个人资料信息。

答案 1 :(得分:1)

我建议你使用英特尔VTune放大器。此分析器允许您在没有root或任何操作系统修改的 Android 设备上收集带有堆栈的热点。 这是一个简单的指南: http://software.intel.com/en-us/articles/using-intel-vtune-amplifier-on-non-rooted-android-devices