gnuplot生成MySQL QPS图形

1、建立MySQL QPS执行脚本

#!/bin/bash
mysqladmin -uroot -p'123123' extended-status -i1|awk \
'BEGIN{flag=0;
print "";
print "QPS   TPS    Threads_con Threads_run ";
print "------------------------------------- "}
$2 ~ /Queries$/            {q=$4-lq;lq=$4;}
$2 ~ /Com_commit$/         {c=$4-lc;lc=$4;}
$2 ~ /Com_rollback$/       {r=$4-lr;lr=$4;}
$2 ~ /Threads_connected$/  {tc=$4;}
$2 ~ /Threads_running$/    {tr=$4;

if(flag==0){
    flag=1; count=0
}else {
    printf "%-6d %-8d %-10d %d \n", q,c+r,tc,tr;
}

}'

 

2、执行脚本

nohup sh mysql_qps.sh > qps_per_5

 

 3、安装gnuplot

yum install gunplot 

4、生成gnuplot图形

[root@test1 ~]# gnuplot

    G N U P L O T
    Version 4.2 patchlevel 6 
    last modified Sep 2009
    System: Linux 2.6.32-431.el6.x86_64

    Copyright (C) 1986 - 1993, 1998, 2004, 2007 - 2009
    Thomas Williams, Colin Kelley and many others

    Type `help` to access the on-line reference manual.
    The gnuplot FAQ is available from http://www.gnuplot.info/faq/

    Send bug reports and suggestions to <http://sourceforge.net/projects/gnuplot>


Terminal type set to 'x11'
gnuplot> plot "qps_per_5" using 1 w lines title "QPS"

 

 

生成QPS和load的截图

gnuplot> plot "qps_per_5" using 1 w lines title "QPS","qps_per_5" using 2 w lines title "load" 

 

 

gnuplot的参数如下

【转】gnuplot分析多组数据绘图 - 剑帝的日志 - 网易博客
http://blog.163.com/heloyure@126/blog/static/64377576201181992822/

 

Tpcc-MySQL测试并使用gnuplot生成图表-鸟哥のlinux-ChinaUnix博客
http://blog.chinaunix.net/uid-25266990-id-4080103.html

使用gnuplot对tpcc-mysql压测结果生成图表 - lzfj - 博客园
http://www.cnblogs.com/lizhi221/p/6814025.html

gnuplot工具的安装与使用-陈舒婷-ChinaUnix博客
http://blog.chinaunix.net/uid-28412198-id-3763133.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值