为了找出耗时的函数,需要用gprof之类的工具来分析性能/耗时,如果手动加代码测耗时部分过于繁锁。本文简述如何在linux下分析编解码器的性能。
首先修改makefile支持profiling。
修改build/linux/common/makefile.base:
##########
# do profiling : 1=yes, 0=no
##########
PROFILING?= 0
ifeq ($(PROFILING),1)
CPPFLAGS+=-pg
endif
##########
##########
# do profiling : 1=yes, 0=no
##########
PROFILING?= 0
ifeq ($(PROFILING),1)
ALL_LDFLAGS+=-pg
endif
##########
修改build/linux/makefile
### do profiling : 1=yes, 0=no
PROFILING?= 1
export PROFILING
重新make生成TAppEncoderStatic/TAppDecoderStatic。
接着开始测试编码:
./TAppEncoderStatic -c ../cfg/encoder_randomaccess.cfg -i ../video/RaceHorses_416x240_30.yuv -wdt 416 -hgt 240 -fr 30 --InputBitDepth=8 --OutputBitDepth=8 --InternalBitDepth