From 7e873770eb305acf656a6c70a80d65de14165609 Mon Sep 17 00:00:00 2001 From: Jan Eitzinger Date: Thu, 9 May 2019 15:48:18 +0200 Subject: [PATCH] Complete implementation of perf stat mode. --- acQuery.pl | 34 ++++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/acQuery.pl b/acQuery.pl index ed72850..c4118c9 100755 --- a/acQuery.pl +++ b/acQuery.pl @@ -160,16 +160,19 @@ sub buildCondition { sub printPerfStat { my $conditionstring = shift; - my $query = 'SELECT COUNT(id), SUM(duration)/3600, SUM(duration*num_nodes)/3600 FROM job '.$conditionstring; + my $query = 'SELECT COUNT(*), SUM(duration)/3600, SUM(duration*num_nodes)/3600 FROM job '.$conditionstring; my ($count, $walltime, $nodeHours) = $dbh->selectrow_array($query); if ( $count > 0 ) { + $query = 'SELECT COUNT(*) FROM job '.$conditionstring.' AND has_profile=1'; + my ($perfcount) = $dbh->selectrow_array($query); print "=================================\n"; print "Job count: $count\n"; + print "Jobs with performance profile: $perfcount\n"; print "Total walltime [h]: $walltime \n"; print "Total node hours [h]: $nodeHours \n"; - $query = 'SELECT ROUND(mem_used,-2), COUNT(*) FROM job '.$conditionstring.' AND has_profile=1 GROUP BY 1'; + $query = 'SELECT ROUND(mem_used), COUNT(*) FROM job '.$conditionstring.' AND has_profile=1 GROUP BY 1'; my @histo_mem_used = $dbh->selectall_array($query); print "\nHistogram: Mem used\n"; print "Mem\tcount\n"; @@ -180,8 +183,18 @@ sub printPerfStat { print "$bin->[0]\t$bin->[1]\t$str\n"; } + $query = 'SELECT ROUND(mem_bw), COUNT(*) FROM job '.$conditionstring.' AND has_profile=1 GROUP BY 1'; + my @histo_mem_bandwidth = $dbh->selectall_array($query); + print "\nHistogram: Memory bandwidth\n"; + print "BW\tcount\n"; - $query = 'SELECT ROUND(flops_any,-2), COUNT(*) FROM job '.$conditionstring.' AND has_profile=1 GROUP BY 1'; + foreach my $bin ( @histo_mem_bandwidth ) { + my $bar = log $bin->[1]; my $str = ''; + while (length($str)<$bar) { $str = $str.'*'; } + print "$bin->[0]\t$bin->[1]\t$str\n"; + } + + $query = 'SELECT ROUND(flops_any), COUNT(*) FROM job '.$conditionstring.' AND has_profile=1 GROUP BY 1'; my @histo_flops_any = $dbh->selectall_array($query); print "\nHistogram: Flops any\n"; print "flops\tcount\n"; @@ -191,8 +204,6 @@ sub printPerfStat { while (length($str)<$bar) { $str = $str.'*'; } print "$bin->[0]\t$bin->[1]\t$str\n"; } - - } else { print "No jobs\n"; } @@ -396,21 +407,24 @@ Specify output mode. Mode can be one of: =over 4 -=item B +=item B Print list of job ids matching conditions. One job id per line. -=item B +=item B Print the query string and then exit. -=item B +=item B Only output the number of jobs matching the conditions. (Default mode) -=item B +=item B Output a record of every job matching the conditions. -=item B +=item B Output job statistic for all jobs matching the conditions. +=item B +Output job performance footprint statistic for all jobs matching the conditions. + =back =item B<--user>