log=$1
tps_array=`awk -F '[,:]' '{print $4}' ${log}`
zero=0

for tps in ${tps_array}
do
tps=`echo ${tps} |tr -d "."`
if [ ${tps} -eq 0 ]
then
zero=`expr ${zero} + 1`
fi
done

echo "tps 0 num: ${zero}"

文件内容:

[99080s] threads: 128, tps: 7565.93, reads: 105918.67, writes: 30243.15, response time: 41.23ms (95%), errors: 0.40, reconnects: 0.00
[99085s] threads: 128, tps: 7376.95, reads: 103291.67, writes: 29528.20, response time: 42.85ms (95%), errors: 0.40, reconnects: 0.00
[99090s] threads: 128, tps: 7816.97, reads: 109409.52, writes: 31259.06, response time: 41.00ms (95%), errors: 0.20, reconnects: 0.00
[99095s] threads: 128, tps: 6850.42, reads: 95919.01, writes: 27381.86, response time: 45.20ms (95%), errors: 0.80, reconnects: 0.00
[99100s] threads: 128, tps: 7360.14, reads: 103057.95, writes: 29448.55, response time: 43.25ms (95%), errors: 0.20, reconnects: 0.00
[99105s] threads: 128, tps: 7158.81, reads: 100239.21, writes: 28658.47, response time: 44.37ms (95%), errors: 0.20, reconnects: 0.00
[99110s] threads: 128, tps: 7284.31, reads: 101984.49, writes: 29135.42, response time: 43.92ms (95%), errors: 0.20, reconnects: 0.00
[99115s] threads: 128, tps: 7268.57, reads: 101723.54, writes: 29040.05, response time: 43.01ms (95%), errors: 0.80, reconnects: 0.00
[99120s] threads: 128, tps: 7079.80, reads: 99116.06, writes: 28319.02, response time: 44.86ms (95%), errors: 0.20, reconnects: 0.00
[99125s] threads: 128, tps: 7551.02, reads: 105736.69, writes: 30216.08, response time: 41.34ms (95%), errors: 0.60, reconnects: 0.00

执行结果:

shell.sh  file

tps 0 num: 4

最新文章

  1. CA签发工具
  2. Windows Azure Virtual Machine (32) 如何在Windows操作系统配置SFTP
  3. UIScrollview自动布局,UIScrollviewAutolayoutDemo
  4. ural 1437. Gasoline Station
  5. 第五篇 SQL Server安全架构和安全
  6. Hanoi T note
  7. 解决在 使用 AjaxFileUploder 插件时,不能获取返回的 json 结果数据
  8. 源码分析:静态分析 C 程序函数调用关系图
  9. 单独调用Ueditor的图片上传功能
  10. phpcms 源码分析一: common.inc.php
  11. [JIT_APP]Android SQLite简介
  12. ThinkPHP URL伪静态、路由规则、重写、生成
  13. xml解析之使用dom4j的api对xml文件进行CRUD(二)
  14. Django+Vue打造购物网站(四)
  15. numpy 库简单使用
  16. 应用程序与驱动程序通信 DeviceIoControl
  17. 解决webgl使用canvas.toDataURL()没有内容的问题
  18. CImageList
  19. layui实现复选框全选,反选
  20. 基于python的scrapy框架爬取豆瓣电影及其可视化

热门文章

  1. [译]Javascript中的数列
  2. 处理器适配器(handlerAdapter)执行源码分析(涉及到适配器模式)(九)
  3. .NET DataTable DataSet转json代码
  4. SQLServer存储引擎——03.日志
  5. ASP.NET网页之间传递参数与值
  6. CS基本网络中Agent使用双网卡进行流量划分
  7. 抽象类(abstract class)和接口(Interface)的区别
  8. 与HDFS交互- By web界面
  9. 大佬写的js生成玫瑰(来源网络)
  10. RxJS的基础