学堂 学堂 学堂公众号手机端

2022-07-12 使用perf统计mysql执行的性能并生成火焰图

lewis 5年前 (2020-01-27) 阅读数 6 #技术


摘要:

记录使用perf统计mysql执行耗时


perf使用:

FlameGraph.tar.gz-C++文档类资源

tar -xzvf FlameGraph.tar.gz
cd FlameGraph

yum install perf -y

perf record -a -F 99 -g -p $(pgrep -x mysqld) -- /stonedb56/install/bin/mysql -D tpch -e "select
o_orderpriority,
count(*) as order_count
from
orders
where
o_orderdate >= date '1993-07-01'
and o_orderdate < date '1993-07-01' + interval '3' month
and exists (
select
*
from
lineitem
where
l_orderkey = o_orderkey
and l_commitdate < l_receiptdate
)
group by
o_orderpriority
order by
o_orderpriority ;"

perf script -i perf.data > out.perf
./stackcollapse-perf.pl out.perf > out.floded
./flamegraph.pl out.floded > mysql.svg

版权声明

本文仅代表作者观点,不代表博信信息网立场。

热门