-
Notifications
You must be signed in to change notification settings - Fork 202
/
mcperf
executable file
·34 lines (30 loc) · 992 Bytes
/
mcperf
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
#!/usr/bin/env ruby
LKP_SRC = ENV['LKP_SRC'] || File.dirname(File.dirname(File.realpath($PROGRAM_NAME)))
require "#{LKP_SRC}/lib/log"
require "#{LKP_SRC}/lib/string_ext"
# skip invalid line
while (line = STDIN.gets)
break if line =~ /Total/
end
while (line = STDIN.gets)
line = line.resolve_invalid_bytes
case line
# Connection rate: 991.1 conn/s (1.0 ms/conn <= 12 concurrent connections)
when /^(Connection|Request|Response) rate: (.*.) (.*\/s)/
type = $1.downcase
val = $2
unit = $3
puts "#{type}_rate_#{unit}: #{val}"
when /^(Connection|Connect|Response|Request|CPU) (time|size) \[(ms|B|s)\]:(( \w* \d*.\d*){2,})/
type = $1.downcase
object = $2
unit = $3
test_object = "#{type}_#{object}"
$4.gsub(/(\w+) (\d+.\d+)/) { puts "#{test_object}_#{$1}_#{unit}: #{$2}" }
when /^Net I\/O: bytes (\d+.\d+) (.*) (\d+.\d+)/
io_bytes = $1
io_rate = $3
puts "net_io_bytes: #{io_bytes}"
puts "net_io_rate_kb/s: #{io_rate}"
end
end