forked from jayjanssen/sysbench-graphing-tests
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathparse_sysbench.pl
executable file
·36 lines (26 loc) · 945 Bytes
/
parse_sysbench.pl
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
#!/usr/bin/perl
my @files = `find . -name sysbench*`;
open( OUTFILE, "> out/all_res.data" ) or die "could not open all_res.data: $!";
print OUTFILE "run, time, tps\n";
while( my $file = shift @files ) {
next if $file =~ m/\.data$/;
chomp( $file );
$file =~ m'/(.*)/';
my $run = $1;
print "parsing file: $file\n";
open( FILE, "< $file" ) or die "could not open $file: $!";
while( my $line = <FILE> ) {
# print $line;
# The regular expression does not work as set up before, for me
# This is a workaround to make it work for me: Pick the required fields one by one; and remove unknown fields(response time)
my $l1, $l2;
if( $line =~ m/^\[\s(\d+)s\s\].+/) {
$l1 = $1;
if ( $line =~ m/\stps\:\s(\d+\.\d+).+/ ) {
print OUTFILE "$run, $l1, $1\n";
}
}
}
close( FILE );
}
close( OUTFILE );