NDK에서 코딩된 소스의 속도 측정을 위하여, profile하는 방법이 되겠다.
다른 삽질하는 사람들을 위하여......ㅋㅋㅋ(나를포함 ㅡ.ㅡ)
1. http://code.google.com/p/android-ndk-profiler/
이 곳에서 android-ndk-profile.zip 을 받는다.(현재 버전 : android-ndk-propfiler-3.1.zip)
2. 해당 작업중인 프로젝트에 압출을푼다.(.../jni)
cd $HOME/path/to/my-project
unzip android-ndk-profiler.zip
3. 디렉토리안에 자신에 해당하는 타킷 디바이스용 static library(.a)를 복사하여 ndk-build될 디렉토리안에 넣는다.
("그 파일만" 복사해서 가져옴!!!)
ex) .../jni/library/libandprof.a
4. Android.mk 파일을 수정한다.
# include the profiler snippet
-include android-ndk-profiler.mk
# this is your shared library
include $(CLEAR_VARS)
# compile with profiling
LOCAL_CFLAGS := -pg
LOCAL_STATIC_LIBRARIES := andprof
# android logging library is required for the profiler
LOCAL_LDLIBS += -llog
# ... your build ...
include $(BUILD_SHARED_LIBRARY)
4-1 기존에 있던 android-ndk-profiler.mk의 내용을 그대로 자신이 빌드할 Android.mk파일에 복사
# This is android-ndk-profiler.mk source...
TARGET_thumb_release_CFLAGS := $(filter-out -ffunction-sections,$(TARGET_thumb_release_CFLAGS))
TARGET_thumb_release_CFLAGS := $(filter-out -fomit-frame-pointer,$(TARGET_thumb_release_CFLAGS))
TARGET_arm_release_CFLAGS := $(filter-out -ffunction-sections,$(TARGET_arm_release_CFLAGS))
TARGET_arm_release_CFLAGS := $(filter-out -fomit-frame-pointer,$(TARGET_arm_release_CFLAGS))
TARGET_CFLAGS := $(filter-out -ffunction-sections,$(TARGET_CFLAGS))
# include libandprof.a in the build
include $(CLEAR_VARS)
LOCAL_MODULE := andprof
LOCAL_SRC_FILES := $(TARGET_ARCH_ABI)/libandprof.a
include $(PREBUILT_STATIC_LIBRARY)
@ 원래 작성되어져있는 LOCAL_SRC_FILES := $(TARGET_ARCH_ABI)/libandprof.a 내용중
$(TARGET_ARCH_ABI)/ 부분을 삭제!!(절대경로나 상대경로를 사용할 수 없음!!)
4-2. Android.mk 파일 수정(추가)
LOCAL_STATIC_LIBRARIES := other librarys... andprof
/* in the start-up code */
monstartup("your_lib.so");
/* in the onPause or shutdown code */
moncleanup();
options...
'6. With IT > 6.2 NDK' 카테고리의 다른 글
extern사용 예(리눅스환경) (0) | 2012.10.10 |
---|---|
안드로이드 File Explorere에서 sdcard안에 디렉토리가 만들어지지 않을때... (0) | 2012.09.08 |
NDK_컴파일과정과 링크 (0) | 2012.06.19 |
(.data+0x0) multiple definition of 변수 에러 (0) | 2012.06.18 |
정적라이브러리 동적라이브러리 (0) | 2012.06.16 |