pt-pmp

   # pt-pmp 10230.info 

–binary

由此,计算其可用用法如下:

再不会报如下错误:

# pt-pmp --lines 2 1.txt 
   1928 poll(libc.so.6),vio_io_wait(viosocket.c:771)
   80 libaio::??(libaio.so.1),os_aio_linux_collect(os0file.cc:4977)
   69 poll(libc.so.6),vio_io_wait
short form: -s; type: int; default: 0
Number of seconds to sleep between --iterations.

–save-samples

 

   # ps -ef |grep mysqld

This will freeze the program for some period of time, ranging from a second or so to much longer on very busy systems with a lot of memory and many threads in the program.

In addition to freezing the server, there is also some risk of the server crashing or performing badly after GDB detaches from it.

–version

 

short form: -i; type: int; default: 1
How many traces to gather and aggregate.

pt-pmp有两地点的效果:一是赢得进度的酒店消息,二是对那么些仓库新闻举办聚集。

  1. 万风姿浪漫要同不常候保留汇总前的宾馆音讯,可钦点–save-samples参数

 

short form: -b; type: string; default: mysqld
Which binary to trace.

–lines

钦命打字与印刷汇中国人民解放军总后勤部每二个分类中的头多少个函数。

   # pstack 10230 > 10230.info

钦定进度的pid,该参数会覆盖–binary参数。

 –iterations

   # pt-pmp –binary sshd –save-samples sshd.txt

  1. 直接依照进度名汇总货仓消息

用合法的话说:

 

 

–interval

是还是不是将gdb获取的固有货仓新闻(注意,未有集中卡塔尔保存在文书中。

 

 

 

 

 

Show version and exit.

–pid

$OPT_ITERATIONS是下面–iterations参数,而$OPT_INTERVAL即sleep的时间。

若果钦命–line参数,则输出如下:

上面看看其实际参数

short form: -k; type: string
Keep the raw traces in this file after aggregation.
short form: -p; type: int
Process ID of the process to trace; overrides --binary.
[root@localhost ~]# pt-pmp --binary mysqld
Sat Oct 29 17:32:34 CST 2016
/usr/local/bin/pt-pmp: line 663: gdb: command not found
for x in $(_seq $OPT_ITERATIONS); do
         gdb -ex "set pagination 0"    \
             -ex "thread apply all bt" \
             -batch                    \
             -p $OPT_PID               \
             >> "$output_file"
         date +'TS %N.%s %F %T' >> "$output_file"
         sleep $OPT_INTERVAL
      done
# pt-pmp 1.txt 
   1928 poll(libc.so.6),vio_io_wait(viosocket.c:771),vio_socket_io_wait(viosocket.c:68),vio_read(viosocket.c:123),net_read_raw_loop(net_serv.cc:669),net_read_packet_header(net_serv.cc:751),net_read_packet(net_serv.cc:751),my_net_read(net_serv.cc:894),do_command(sql_parse.cc:969),do_handle_one_connection(sql_connect.cc:982),handle_one_connection(sql_connect.cc:898),pfs_spawn_thread(pfs.cc:1860),start_thread(libpthread.so.0),clone(libc.so.6)     
   80 libaio::??(libaio.so.1),os_aio_linux_collect(os0file.cc:4977),os_aio_linux_handle(os0file.cc:4977),fil_aio_wait(fil0fil.cc:5809),io_handler_thread(srv0start.cc:492),start_thread(libpthread.so.0),clone(libc.so.6)     
   69 poll(libc.so.6),vio_io_wait,vio_socket_io_wait,vio_read,net_read_raw_loop,net_read_packet,my_net_read,do_command,do_handle_one_connection,handle_one_connection,pfs_spawn_thread,start_thread(libpthread.so.0),clone(libc.so.6)
   ...

澳门金沙vip,   # pt-pmp –binary mysqld

  1. 汇总pstack获取的结果

迭代时光里面包车型客车间隔,从源代码也足以看出

–help

   

Show help and exit.

比方原始汇总新闻如下:

   # pt-pmp –binary mysqld –iterations 2 –interval 1

short form: -l; type: int; default: 0
Aggregate only first specified number of many functions; 0=infinity.

   

3.
上述命令只是一回迭代的结果,借使要迭代多次,且每一遍相隔1s,可钦赐如下:

pt-pmp脚本本身是用shell写的,用法也比较简单,唯大器晚成的渴求是服务器三春设置gdb包。

 

进程的客栈消息是运用gdb获取的,所以在获取的历程中,会对mysql服务端的品质有早晚的震慑。

钦点分析的历程名,假如不点名,则暗中同意是mysqld,从这些参数能够看看,pt-pmp不仅适用于mysqld。

从上面包车型大巴源代码能够看出,所谓的迭代其实便是推行gdb命令的次数