os: centos 7.6
db: postgresql 13
先占坑,后面持续补充。
版本
# cat /etc/centos-release
CentOS Linux release 7.6.1810 (Core)
#
# cd /opt/postgresql-13.3
# ./configure --help |grep -i dtrace
--enable-dtrace build with DTrace support
# which dtrace
/usr/bin/dtrace
# dtrace --help
Usage /usr/bin/dtrace [--help] [-h | -G] [-C [-I<Path>]] -s File.d [-o <File>]
Where -h builds a systemtap header file from the .d file
-C when used with -h, also run cpp preprocessor
-o specifies an explicit output file name,
the default for -G is file.o and -h is file.h
-I when running cpp pass through this -I include Path
-s specifies the name of the .d input file
-G builds a stub file.o from file.d,
which is required by some packages that use dtrace.
# ps -ef|grep -i postgres
postgres 3599 1 0 11:57 ? 00:00:00 /usr/pgsql-13/bin/postmaster -D /var/lib/pgsql/13/data/
postgres 3777 3599 0 11:57 ? 00:00:00 postgres: logger
postgres 4144 3599 0 11:57 ? 00:00:00 postgres: checkpointer
postgres 4145 3599 0 11:57 ? 00:00:00 postgres: background writer
postgres 4146 3599 0 11:57 ? 00:00:00 postgres: walwriter
postgres 4147 3599 0 11:57 ? 00:00:00 postgres: autovacuum launcher
postgres 4148 3599 0 11:57 ? 00:00:00 postgres: stats collector
postgres 4149 3599 0 11:57 ? 00:00:00 postgres: logical replication launcher
root 7649 7607 0 14:12 pts/2 00:00:00 su - postgres
postgres 7650 7649 0 14:12 pts/2 00:00:00 -bash
postgres 7712 7650 0 14:12 pts/2 00:00:00 psql
postgres 7713 3599 0 14:12 ? 00:00:00 postgres: postgres postgres [local] idle
root 7715 4552 0 14:12 pts/1 00:00:00 grep --color=auto -i postgres
看文档可以写个小脚本验证
# vi /tmp/txn_count.d
#!/usr/bin/dtrace -qs
postgresql$1:::transaction-start
{
@start["Start"] = count();
self->ts = timestamp;
}
postgresql$1:::transaction-abort
{
@abort["Abort"] = count();
}
postgresql$1:::transaction-commit
/self->ts/
{
@commit["Commit"] = count();
@time["Total time (ns)"] = sum(timestamp - self->ts);
self->ts=0;
}
# /tmp/txn_count.d 3599
('/usr/bin/dtrace', 'invalid option', '-qs')
Usage /usr/bin/dtrace [--help] [-h | -G] [-C [-I<Path>]] -s File.d [-o <File>]
运行出错
参考:
http://postgres.cn/docs/13/install-procedure.html
http://postgres.cn/docs/13/dynamic-trace.html
https://zhuanlan.zhihu.com/p/71437161
http://dtrace.org/blogs/about/
https://link.zhihu.com/?target=https%3A//openresty.org/posts/dynamic-tracing/
最后
以上就是善良乐曲最近收集整理的关于postgresql 参数 --enable-dtrace版本的全部内容,更多相关postgresql内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复