Add rate_limit to JSON output.

This commit is contained in:
Daniel Nichter
2013-11-27 18:42:20 -08:00
parent c178934ab1
commit 567c1f11e6
4 changed files with 733 additions and 0 deletions

View File

@@ -147,6 +147,25 @@ override query_report => sub {
$global_data->{queries_per_second} = $qps if $qps;
$global_data->{concurrency} = $conc if $conc;
if ( exists $results->{globals}->{rate_limit} ) {
my $rate_limit = $results->{globals}->{rate_limit}->{min} || '';
my ($type, $limit) = $rate_limit =~ m/^(\w+):(\d+)$/;
if ( $type && $limit ) {
$global_data->{rate_limit} = {
type => $type,
limit => int($limit),
};
}
else {
$global_data->{rate_limit}->{error} = "Invalid rate limit: $rate_limit";
}
if ( ($results->{globals}->{rate_limit}->{min} || '')
ne ($results->{globals}->{rate_limit}->{max} || '') ) {
$global_data->{rate_limit}->{diff} = 1;
}
}
my %hidden_attrib = (
arg => 1,
fingerprint => 1,