设为首页 加入收藏

TOP

msyql TPS v1:计算指定时间内(三)
2015-07-24 11:53:35 来源: 作者: 【 】 浏览:9
Tags:msyql TPS v1: 计算 指定 时间
e051="tpsre051.`date +%Y%m%d%H%M%S`.txt" tps_re052="tpsre052.`date +%Y%m%d%H%M%S`.txt" tps_re053="tpsre053.`date +%Y%m%d%H%M%S`.txt" mysql -h${MYSQL_HOST} -u${MYSQL_USER} -p${MYSQL_PASS} -e"${tps_051}" |grep -v Variable_name \ |cut -f 2 >${tps_re051} mysql -h${MYSQL_HOST} -u${MYSQL_USER} -p${MYSQL_PASS} -e"${tps_052}" |grep -v Variable_name \ |cut -f 2 >${tps_re052} mysql -h${MYSQL_HOST} -u${MYSQL_USER} -p${MYSQL_PASS} -e"${tps_053}" |grep -v Variable_name \ |cut -f 2 >${tps_re053} tps_051_re=`cat ${tps_re051}` tps_052_re=`cat ${tps_re052}` tps_053_re=`cat ${tps_re053}` tps_sum_new=`awk 'BEGIN{print '${tps_051_re}' + '${tps_052_re}' + '${tps_053_re}' }'` #获取上一次的值(见TPS-JOB) tps_everydat_9="/root/tps_everydat_9.`date +%Y%m%d`.txt" tps_sum_old=`cat ${tps_everydat_9}` tps_sum_diff=`awk 'BEGIN{print '${tps_sum_new}' - '${tps_sum_old}' }' ` #获取时间差 last_exec_time="/root/tps_lastime.`date +%Y%m%d`.txt" t02=`cat ${last_exec_time}` start_time=`date +%s -d "$t02"` end_time=`date +%s ` #echo $(($end_time-$start_time)) tps_uptime_gf=`awk 'BEGIN{ print '$end_time'-'$start_time'}'` #计算早上9点到现在的TPS tps_avg=`awk 'BEGIN{print '${tps_sum_diff}' / '${tps_uptime_gf}'}'|awk '{printf("%.f\n",$1)}'` #shell默认不支持浮点运算 cechon "From $t02 to now ,TPS: ${tps_avg} " red echo " " tps_01_re=`cat ${tps_re051}` tps_02_re=`cat ${tps_re052}` tps_03_re=`cat ${tps_re053}` echo rm -rf ${tps_re051} rm -rf ${tps_re052} rm -rf ${tps_re053}

?

首页 上一页 1 2 3 下一页 尾页 3/3/3
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇Mysql使用profiling分析慢sql语句.. 下一篇mysql "group by"与&qu..

评论

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

·Announcing October (2025-12-24 15:18:16)
·MySQL有什么推荐的学 (2025-12-24 15:18:13)
·到底应该用MySQL还是 (2025-12-24 15:18:11)
·进入Linux世界大门的 (2025-12-24 14:51:47)
·Download Linux | Li (2025-12-24 14:51:44)