From: Ian Jackson Date: Wed, 5 Aug 2020 12:09:54 +0000 (+0100) Subject: history reporting: Cache stats reporting: Centralise and rework X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=b8264612d81d1bf264528e73f270092e1ab2caf9;p=osstest.git history reporting: Cache stats reporting: Centralise and rework This uses the new variables instead of the old ones. Signed-off-by: Ian Jackson --- diff --git a/sg-report-host-history b/sg-report-host-history index 32cc883..9c70b56 100755 --- a/sg-report-host-history +++ b/sg-report-host-history @@ -185,6 +185,17 @@ sub cache_write_entry ($$) { print $fh " -->\n"; } +sub cache_report_stats ($) { + my ($what) = @_; + print ::DEBUG "CACHE $what read=$rows_previous hits $rows_hit/$rows_today"; + for my $cachekey (sort keys %q_count) { + my $total = $q_count{$cachekey}; + my $hits = $total - ($q_misses{$cachekey} // 0); + print ::DEBUG " $cachekey=$hits/$total"; + } + print ::DEBUG "\n"; +} + cache_set_key_cols(qw(flight job status name)); sub computeflightsrange () { @@ -335,9 +346,6 @@ END push @rows, { %$jr, %$endedrow }; } - print DEBUG "CACHE $hostname $rows_hit / ".(scalar @rows) - ." of ".(scalar %cache)."\n"; - @rows = sort { $b->{finished} <=> $a->{finished} } @rows; print DEBUG "SORTED\n"; @@ -457,8 +465,7 @@ END rename "$html_file.new", "$html_file" or die "$html_file $!" if $doinstall; - print DEBUG "HOST CACHE RQ $runvarq_hits / ". - ($runvarq_hits+$runvarq_misses)."\n"; + cache_report_stats("$hostname"); } foreach my $host (@ARGV) { @@ -528,7 +535,6 @@ foreach my $host (sort keys %hosts) { mainquery($host); reporthost $host; }); - print DEBUG "JQ CACHE ".($jqtotal-$jqcachemisses)." / $jqtotal\n"; exit(0); } print DEBUG "SPAWNED [$pid] $host\n";