diff --git a/scripts/graph_free b/scripts/graph_free new file mode 100755 index 0000000..0c2647b --- /dev/null +++ b/scripts/graph_free @@ -0,0 +1,22 @@ +#!/usr/bin/perl +use v5.24; +use warnings; + +open my $tsfh, '>', "graph_free.tsv"; +for my $fn (glob("/var/log/simba/ca.*")) { + my $fh; + if ($fn =~ /\.gz$/) { + open($fh, '-|', "zcat", $fn); + } else { + open ($fh, '<', $fn); + } + while (<$fh>) { + if (m{(....-..-..T..:..:..[-+]....) .*: found base /backup/(.*) \(est. (\d+) bytes\)}) { + say $tsfh "$1\t$2\t$3" + } + } +} +close $tsfh; + +open STDOUT, '>', "graph_free.png"; +system "tsplotv", "--style", "points", "--legend-position", "below", "--yrange", "0:*", "graph_free.tsv"; diff --git a/scripts/graph_used b/scripts/graph_used new file mode 100755 index 0000000..f7cbb21 --- /dev/null +++ b/scripts/graph_used @@ -0,0 +1,20 @@ +#!/usr/bin/perl +use v5.24; +use warnings; + +open my $tsfh, '>', "graph_used.tsv"; +for my $fn (glob("/var/log/simba/ca.*")) { + open (my $fh, '<', $fn); + my %free; + while (<$fh>) { + if (m{(....-..-..T..:..:..[-+]....) .*: considering base /backup/(.*) \(est. (\d+) bytes\)}) { + $free{$2} = $3; + } elsif (m{(....-..-..T..:..:..[-+]....) .*: using base /backup/(.*)}) { + say $tsfh "$1\t$2\t$free{$2}" + } + } +} +close $tsfh; + +open STDOUT, '>', "graph_used.png"; +system "tsplotv", "--style", "points", "--legend-position", "below", "graph_used.tsv";