X-Git-Url: http://dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FWCY.pm;h=ef536ddb2fa8681c986766f67537f84d1cc7fefb;hb=a13f69ce9f26ea2b95be1e6de1f14f50ab7065d8;hp=504768860717204fc0f70814b6f1ca7e55c6ab8b;hpb=5835ca385fb719194163512276666aaf75e82484;p=spider.git diff --git a/perl/WCY.pm b/perl/WCY.pm index 50476886..ef536ddb 100644 --- a/perl/WCY.pm +++ b/perl/WCY.pm @@ -16,6 +16,7 @@ use Julian; use IO::File; use DXDebug; use Data::Dumper; +use Time::HiRes qw(gettimeofday tv_interval); use strict; @@ -64,9 +65,10 @@ sub init $fp = DXLog::new('wcy', 'dat', 'm'); do "$param" if -e "$param"; # read in existing data + my $t0 = [gettimeofday]; @cache = readfile($main::systime); shift @cache while @cache > $maxcache; - dbg(sprintf "WCY read in last %d records into cache", scalar @cache); + dbg(sprintf "WCY read in last %d records into cache %dmS", scalar @cache, _diffms($t0)); confess $@ if $@; } @@ -171,7 +173,7 @@ sub search my $count; my $i; - if ($t == $main::systime && ($to <= $maxcache)) { + if ($t == $main::systime && ($to && $to <= @cache)) { dbg("using wcy cache") if isdbg('wcy'); @out = reverse @cache; pop @out while @out > $to; @@ -229,7 +231,7 @@ sub print_item my $d = cldate($r->[0]); my $t = (gmtime($r->[0]))[2]; - return sprintf("$d %02d %5d %3d %3d %3d %3d %-5s %-5s %6s <%s>", + return sprintf("$d %02d %5d %3d %3d %3d %3d %-5s %-5s %6s <%s>", $t, @$r[1..9]); }