Skip to content

Commit 5074425

Browse files
committed
Merge pull request #110 from ndokos/wip-fio-postprocess
Ignore extra disk-stats array if present.
2 parents 1e1ded0 + 4eba91b commit 5074425

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

agent/bench-scripts/postprocess/fio-postprocess

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,23 @@ my $tool_group = $ARGV[2];
99
my $js_str;
1010

1111
open( JS, "<$dir/fio-result.txt" ) or die "Can't open $dir/fio-result.txt: $!";
12-
# skip past the non json stuff
12+
# there may be more than one json array, and we want only the last one
1313
while ( <JS> ) {
14+
# skip past the non json stuff
1415
if ( /{/ ) {
15-
last;
16+
$js_str = "{\n";
17+
while ( <JS> ) {
18+
$js_str = $js_str . $_;
19+
if ( /^}/ ) {
20+
last;
21+
}
22+
}
1623
}
1724
}
1825

19-
if ( eof JS ) {
20-
print "Could not read rest of json data\n";
21-
exit 1;
22-
} else {
23-
# read the rest of the file in to one string
24-
local $/=undef;
25-
binmode JS;
26-
$js_str = <JS>;
27-
$js_str = "{\n" . $js_str;
26+
if ( ! defined $js_str ) {
27+
print "Could not find any json data, exiting\n";
28+
exit 1
2829
}
2930

3031
# convert [json] string in to big hash

0 commit comments

Comments
 (0)