Greenplum或PostgreSQL的编译配置文件中有一个选项是 --enable-profiling,这个选项会打开GCC的-pg参数.产生可以被gprof用于分析进程的代码.诊断代码被放在$PGDATA/gprof目录中,每个进程都会产生一个子目录,里面会有一个gmon.out文件.
查看这个文件的信息:
#gprof -b /home/digoal/gpdb/bin/postgres gmon.out
Flat profile:
Each sample counts as 0.01 seconds.
% cumulative self self total
time seconds seconds calls ms/call ms/call name
80.00 0.04 0.04 91 0.44 0.44 FileRepVerify_ComputeFileHash
20.00 0.05 0.01 1 10.00 10.00 ChangeTracking_WriteBuffer
0.00 0.05 0.00 750562 0.00 0.00 ChangeTracking_GetRelationChangeInfoFromXlog
0.00 0.05 0.00 670756 0.00 0.00 cdbpullup_colIdx
0.00 0.05 0.00 253200 0.00 0.00 cdbpullup_isExprCoveredByTargetlist
0.00 0.05 0.00 239413 0.00 0.00 cdbpullup_targetlist
查看PostgreSQL编译参数:
[root@test01 ~]# su - postgres
-bash-4.2$ pg_config |grep -i configure
CONFIGURE = '--build=x86_64-redhat-linux-gnu' '--host=x86_64-redhat-linux-gnu' '--program-prefix=' '--disable-dependency-tracking' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib64' '--libexecdir=/usr/libexec' '--localstatedir=/var' '--sharedstatedir=/var/lib' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--disable-rpath' '--with-perl' '--with-tcl' '--with-tclconfig=/usr/lib64' '--with-python' '--with-ldap' '--with-openssl' '--with-pam' '--with-krb5' '--with-gssapi' '--with-ossp-uuid' '--with-libxml' '--with-libxslt' '--enable-nls' '--enable-dtrace' '--with-selinux' '--with-system-tzdata=/usr/share/zoneinfo' '--datadir=/usr/share/pgsql' 'build_alias=x86_64-redhat-linux-gnu' 'host_alias=x86_64-redhat-linux-gnu' 'CFLAGS=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -DLINUX_OOM_SCORE_ADJ=0' 'LDFLAGS=-Wl,-z,relro '
解决办法:
只能重新编译安装,去掉--enable-profiling这个参数.
Be First to Comment