NAME
JSON::JSONFold::Stats - formatting statistics for JSON::JSONFold
SYNOPSIS
use JSON::JSONFold;
my $stats = write_json(
$data,
\*STDOUT,
100,
'default'
);
printf(
"Input bytes: %d\nOutput bytes: %d\nReduction: %.1f%%\n",
$stats->bytes_in,
$stats->bytes_out,
100 * (1 - $stats->bytes_out / $stats->bytes_in)
);
DESCRIPTION
JSON::JSONFold::Stats stores statistics collected during formatting.
Statistics are available from write_json, JSON::JSONFold::write, and JSON::JSONFold::Writer::stats.
METHODS
bytes_in
my $bytes = $stats->bytes_in;
Returns the number of input bytes processed.
bytes_out
my $bytes = $stats->bytes_out;
Returns the number of output bytes generated.
lines_in
my $lines = $stats->lines_in;
Returns the number of input lines processed.
lines_out
my $lines = $stats->lines_out;
Returns the number of output lines generated.
reset
$stats->reset;
Reset all counters to zero.
EXAMPLE
my $stats = write_json(
$data,
\*STDOUT,
100,
'default'
);
printf "Bytes: %d -> %d\n",
$stats->bytes_in,
$stats->bytes_out;
printf "Lines: %d -> %d\n",
$stats->lines_in,
$stats->lines_out;
SEE ALSO
JSON::JSONFold, JSON::JSONFold::Writer
AUTHOR
Yair Lenga
COPYRIGHT AND LICENSE
See the distribution license.