使用awk处理sysbench采集的数据,转成gnuplot可以分析数据

 

1.使用sysbench生成测试数据

sysbench 0.5: multi-threaded system evaluation benchmark

Running the test with following options:
Number of threads: 10
Report intermediate results every 1 second(s)
Initializing random number generator from timer.

Random number generator seed is 0 and will be ignored


Initializing worker threads...

Threads started!

[ 1s] threads: 10, tps: 260.85, reads: 3780.82, writes: 1069.38, response time: 70.37ms (95%), errors: 0.00, reconnects: 0.00
[ 2s] threads: 10, tps: 112.02, reads: 1565.30, writes: 458.09, response time: 311.63ms (95%), errors: 0.00, reconnects: 0.00
[ 3s] threads: 10, tps: 116.93, reads: 1650.97, writes: 471.71, response time: 271.95ms (95%), errors: 0.00, reconnects: 0.00
[ 4s] threads: 10, tps: 187.16, reads: 2591.19, writes: 721.61, response time: 420.63ms (95%), errors: 0.00, reconnects: 0.00
[ 5s] threads: 10, tps: 18.98, reads: 287.75, writes: 98.91, response time: 117.69ms (95%), errors: 0.00, reconnects: 0.00
[ 6s] threads: 10, tps: 292.23, reads: 4094.17, writes: 1168.90, response time: 94.70ms (95%), errors: 0.00, reconnects: 0.00
[ 7s] threads: 10, tps: 137.01, reads: 1921.10, writes: 548.03, response time: 135.92ms (95%), errors: 0.00, reconnects: 0.00
[ 8s] threads: 10, tps: 141.87, reads: 1984.18, writes: 563.48, response time: 115.04ms (95%), errors: 0.00, reconnects: 0.00
[ 9s] threads: 10, tps: 65.06, reads: 860.84, writes: 236.23, response time: 1095.90ms (95%), errors: 0.00, reconnects: 0.00
[ 10s] threads: 10, tps: 212.81, reads: 3032.33, writes: 876.23, response time: 106.24ms (95%), errors: 0.00, reconnects: 0.00
...

[ 57s] threads: 10, tps: 145.16, reads: 2077.27, writes: 609.67, response time: 270.97ms (95%), errors: 0.00, reconnects: 0.00
[ 58s] threads: 10, tps: 92.98, reads: 1301.75, writes: 371.93, response time: 450.34ms (95%), errors: 0.00, reconnects: 0.00
[ 59s] threads: 10, tps: 32.00, reads: 447.96, writes: 127.99, response time: 80.98ms (95%), errors: 0.00, reconnects: 0.00
[ 60s] threads: 10, tps: 85.89, reads: 1202.43, writes: 339.56, response time: 933.17ms (95%), errors: 0.00, reconnects: 0.00
OLTP test statistics:
queries performed:
read: 104720
write: 29920
other: 14960
total: 149600
transactions: 7480 (124.61 per sec.)
read/write requests: 134640 (2242.95 per sec.)
other operations: 14960 (249.22 per sec.)
ignored errors: 0 (0.00 per sec.)
reconnects: 0 (0.00 per sec.)

General statistics:
total time: 60.0281s
total number of events: 7480
total time taken by event execution: 600.0788s
response time:
min: 2.24ms
avg: 80.22ms
max: 1536.70ms
approx. 95 percentile: 333.04ms

Threads fairness:
events (avg/stddev): 748.0000/18.14
execution time (avg/stddev): 60.0079/0.01

 

2.使用awk脚本处理数据

#!/bin/sh
awk '/1s]/,/60s]/{print $2,$6,$8,$10,$13}' $1 > $2
sed -i "s/s]//g" $2
sed -i "s/,//g" $2
sed -i "s/ms//g" $2

3.处理后的数据

1 260.85 3780.82 1069.38 70.37
2 112.02 1565.30 458.09 311.63
3 116.93 1650.97 471.71 271.95
4 187.16 2591.19 721.61 420.63
5 18.98 287.75 98.91 117.69
6 292.23 4094.17 1168.90 94.70
7 137.01 1921.10 548.03 135.92
8 141.87 1984.18 563.48 115.04
9 65.06 860.84 236.23 1095.90
10 212.81 3032.33 876.23 106.24
11 141.13 1975.81 571.52 132.54
12 144.90 2028.63 579.61 200.51
13 181.10 2535.45 724.41 300.99
14 96.96 1343.51 373.86 149.27
15 134.03 1874.43 542.13 601.52
16 63.93 911.02 263.72 414.50
17 151.18 2098.52 594.71 322.64
18 158.98 2243.71 645.92 191.59
19 41.99 558.89 134.97 719.21
20 151.02 2137.29 633.09 197.06
21 148.89 2090.40 599.54 267.19
22 95.08 1328.15 376.33 350.74
23 177.95 2483.29 711.80 224.47
24 97.00 1369.03 392.01 404.94
25 120.97 1693.61 483.89 173.57
26 164.08 2297.06 656.30 781.16
27 71.00 993.06 275.02 335.94
28 206.02 2880.27 821.08 93.38
29 50.95 703.26 202.79 710.02
30 113.04 1597.51 465.15 169.57
31 157.97 2211.64 631.90 596.67
32 125.00 1726.97 491.99 482.43
33 67.01 921.17 248.05 480.70
34 134.08 1853.09 533.31 554.48
35 73.95 1038.28 289.80 209.60
36 162.09 2305.28 648.36 272.60
37 134.02 1901.32 573.10 709.17
38 93.95 1219.37 335.83 181.38
39 165.02 2406.28 700.08 528.71
40 93.91 1273.78 335.68 157.34
41 157.12 2234.73 634.49 300.00
42 112.99 1582.92 477.97 641.12
43 66.02 915.22 260.06 673.78
44 126.98 1722.72 482.92 486.93
45 98.93 1453.98 432.70 516.35
46 157.15 2200.15 628.61 473.00
47 86.95 1217.25 347.79 353.90
48 167.10 2339.42 666.40 387.50
49 17.00 203.01 46.00 860.71
50 207.95 2944.31 851.80 115.84
51 159.02 2228.30 640.09 199.38
52 33.98 475.76 135.93 711.93
53 145.99 2043.84 583.95 187.23
54 241.25 3377.44 964.98 134.02
55 54.95 713.39 179.85 696.54
56 18.99 276.88 86.96 637.48
57 145.16 2077.27 609.67 270.97
58 92.98 1301.75 371.93 450.34
59 32.00 447.96 127.99 80.98
60 85.89 1202.43 339.56 933.17

4.执行gnuplot绘图脚本

#set term pdfcairo lw 2 font "Times_New_Roman,8"
set xlabel "时间(s)"
set ylabel "TPS"
set title "sysbench mysql 性能测试"
set xrange [0.5:60.5]
set xtics 1,2,60
#set output "oltp_tps.pdf"
plot "oltp.log" u 1:2 w lp pt 6 title "tps"
#set output
#set term wxt

 

5.gnuplot绘图结果

image2016-9-1%2017%3A0%3A15.png?version=1&modificationDate=1472720901000&api=v2

 

image2016-9-1%2017%3A23%3A1.png?version=1&modificationDate=1472722253518&api=v2

 

image2016-9-1%2017%3A23%3A16.png?version=1&modificationDate=1472722268668&api=v2

转载于:https://my.oschina.net/jumpLee/blog/741151

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值