]> xenbits.xensource.com Git - osstest.git/commitdiff
history reporting: Cache stats reporting: Centralise and rework
authorIan Jackson <ian.jackson@eu.citrix.com>
Wed, 5 Aug 2020 12:09:54 +0000 (13:09 +0100)
committerIan Jackson <ian.jackson@eu.citrix.com>
Wed, 19 Aug 2020 10:41:18 +0000 (11:41 +0100)
This uses the new variables instead of the old ones.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
sg-report-host-history

index 32cc883d7ce9d7d5c80a1fe58811cd66feafd27e..9c70b560dfa6aaacddecb1b9a2c20cb3c7ccad3b 100755 (executable)
@@ -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";