56 lines
1.1 KiB
Plaintext
56 lines
1.1 KiB
Plaintext
|
#!/usr/bin/perl
|
||
|
use warnings;
|
||
|
use strict;
|
||
|
use TimeSeries;
|
||
|
|
||
|
my $wanted_feed_id = shift;
|
||
|
|
||
|
my $current_feed_id = -1;
|
||
|
my @updates_in_interval;
|
||
|
|
||
|
my $ts = TimeSeries->new(style => 'impulses');
|
||
|
$ts->legend('old', 'new');
|
||
|
$ts->finalresolution(100);
|
||
|
|
||
|
my @files = glob("test.log*");
|
||
|
@files = sort { -M $b <=> -M $a } @files;
|
||
|
|
||
|
my $current;
|
||
|
my @updates;
|
||
|
for my $file (@files) {
|
||
|
open my $fh, '<', $file;
|
||
|
while (<$fh>) {
|
||
|
|
||
|
if (/ Rss2Html.FeedList feed: (\d+) .*/) {
|
||
|
$current_feed_id = $1;
|
||
|
}
|
||
|
|
||
|
next unless $current_feed_id == $wanted_feed_id;
|
||
|
|
||
|
if (/Rss2Html.FeedList [ ]
|
||
|
\d\d\d\d-\d\d-\d\d [ ] \w\w\w [ ] \d\d:\d\d:\d\d
|
||
|
[ ] \.\. [ ]
|
||
|
(\d\d\d\d-\d\d-\d\d) [ ] \w\w\w [ ] (\d\d:\d\d:\d\d)
|
||
|
: [ ]
|
||
|
(\d+) [ ] seconds
|
||
|
/x
|
||
|
) {
|
||
|
$current = { time => "$1T$2", interval => $3 };
|
||
|
}
|
||
|
if (/Rss2Html.FeedList need to update/) {
|
||
|
push @updates, $current;
|
||
|
}
|
||
|
if (/Rss2Html.Feed item .* new/) {
|
||
|
$current->{new}++;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
for (@updates) {
|
||
|
$ts->add_timestring($_->{time},
|
||
|
$_->{new} ? (0, $_->{interval})
|
||
|
: ($_->{interval}, 0 )
|
||
|
);
|
||
|
}
|
||
|
print $ts->plot;
|