centos7 安装jq并获取meanResTime和throughput
用jmeter性能测试之后会产生很多jtl,statistic文件,为了方便做excel表,需要自动读出吞吐率和平均响应时间。
1. 添加epel源
1 2 3 4 | yum install wget wget http: //dl .fedoraproject.org /pub/epel/epel-release-latest-7 .noarch.rpm rpm -ivh epel-release-latest-7.noarch.rpm yum repolist |
或者
1 2 3 | yum install epel-release -y yum list jq yum install jq -y |
2. 安装jq
1 | yum install jq |
3. 使用
使用命令如下
1 2 3 | jq '.query[0].meanResTime' statistics.json #如果多个query,不知道jmeter中是否允许 jq '.query.meanResTime' statistics.json jq '.query.throughput' statistics.json |
产生的json格式的结果文件如下
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | { "Total" : { "transaction" : "Total" , "sampleCount" : 360001, "errorCount" : 360000, "errorPct" : 99.999725, "meanResTime" : 0.22442993213907703, "medianResTime" : 0.0, "minResTime" : 0.0, "maxResTime" : 246.0, "pct1ResTime" : 1.0, "pct2ResTime" : 1.0, "pct3ResTime" : 1.0, "throughput" : 11237.389187164441, "receivedKBytesPerSec" : 460.9072605818454, "sentKBytesPerSec" : 0.0 }, "query" : { "transaction" : "prepare select statement with parameter" , "sampleCount" : 360000, "errorCount" : 360000, "errorPct" : 100.0, "meanResTime" : 0.22441111111111164, "medianResTime" : 0.0, "minResTime" : 0.0, "maxResTime" : 246.0, "pct1ResTime" : 1.0, "pct2ResTime" : 1.0, "pct3ResTime" : 1.0, "throughput" : 11288.451287197015, "receivedKBytesPerSec" : 463.0028848264401, "sentKBytesPerSec" : 0.0 }, "get current time" : { "transaction" : "get current time" , "sampleCount" : 1, "errorCount" : 0, "errorPct" : 0.0, "meanResTime" : 7.0, "medianResTime" : 7.0, "minResTime" : 7.0, "maxResTime" : 7.0, "pct1ResTime" : 7.0, "pct2ResTime" : 7.0, "pct3ResTime" : 7.0, "throughput" : 142.85714285714286, "receivedKBytesPerSec" : 0.0, "sentKBytesPerSec" : 0.0 } } |
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· .NET Core 中如何实现缓存的预热?
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 如何调用 DeepSeek 的自然语言处理 API 接口并集成到在线客服系统
· 【译】Visual Studio 中新的强大生产力特性