设为首页 加入收藏

TOP

mysql计算指定时间内TPS(二)
2015-11-21 02:01:32 来源: 作者: 【 】 浏览:1
Tags:mysql 计算 指定 时间 TPS
SQL_USER} -p${MYSQL_PASS} -e"${tps_03}" |grep -v Variable_name \ |cut -f 2 >${tps_re03} tps_01_re=`cat ${tps_re01}` tps_02_re=`cat ${tps_re02}` tps_03_re=`cat ${tps_re03}` tps_sum_now=`awk 'BEGIN{print '${tps_01_re}' + '${tps_02_re}' + '${tps_03_re}'}' ` #shell默认不支持浮点运算 rm -rf ${tps_re01} rm -rf ${tps_re02} rm -rf ${tps_re03} echo "正在获取TPS值:" sleep ${sleep_time} tps_021="show global status where Variable_name in('Com_insert'); " tps_022="show global status where Variable_name in('Com_update'); " tps_023="show global status where Variable_name in('Com_delete'); " tps_re021="tpsre021.`date +%Y%m%d%H%M%S`.txt" tps_re022="tpsre022.`date +%Y%m%d%H%M%S`.txt" tps_re023="tpsre023.`date +%Y%m%d%H%M%S`.txt" mysql -h${MYSQL_HOST} -u${MYSQL_USER} -p${MYSQL_PASS} -e"${tps_021}" |grep -v Variable_name \ |cut -f 2 >${tps_re021} mysql -h${MYSQL_HOST} -u${MYSQL_USER} -p${MYSQL_PASS} -e"${tps_022}" |grep -v Variable_name \ |cut -f 2 >${tps_re022} mysql -h${MYSQL_HOST} -u${MYSQL_USER} -p${MYSQL_PASS} -e"${tps_023}" |grep -v Variable_name \ |cut -f 2 >${tps_re023} tps_021_re=`cat ${tps_re021}` tps_022_re=`cat ${tps_re022}` tps_023_re=`cat ${tps_re023}` tps_sum_new=`awk 'BEGIN{print '${tps_021_re}' + '${tps_022_re}' + '${tps_023_re}' }'` tps_sum_diff=`awk 'BEGIN{print '${tps_sum_new}' - '${tps_sum_now}' }' ` tps_avg=`awk 'BEGIN{print '${tps_sum_diff}' / '${sleep_time}'}'` #shell默认不支持浮点运算 cechon "Within the last $sleep_time seconds,TPS is: ${tps_avg} " red echo " " echo " " rm -rf ${tps_re021} rm -rf ${tps_re022} rm -rf ${tps_re023} ############运行结果 正在获取TPS值: Within the last 10 seconds,TPS is: 0.9
 
首页 上一页 1 2 下一页 尾页 2/2/2
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇mysql中文乱码解决方案 下一篇mysql 5.5 升级到 mysql 5.6

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: