Add stage and total run times to log page.
authorAndrew Dunstan <andrew@dunslane.net>
Thu, 17 Feb 2011 15:43:35 +0000 (07:43 -0800)
committerAndrew Dunstan <andrew@dunslane.net>
Thu, 17 Feb 2011 15:43:35 +0000 (07:43 -0800)
cgi-bin/show_log.pl
templates/log.tt

index 9173f5b6520d6c5ba9ec1be99786566d96fdfc23..75dd2e7c2dcfb4e6bb0243053b29d38ccb49e809 100755 (executable)
@@ -38,6 +38,7 @@ my $conf = "";
 my ($stage,$changed_this_run,$changed_since_success,$sysinfo,$branch,$scmurl);
 my $scm;
 my ($git_head_ref, $last_build_git_ref, $last_success_git_ref);
 my ($stage,$changed_this_run,$changed_since_success,$sysinfo,$branch,$scmurl);
 my $scm;
 my ($git_head_ref, $last_build_git_ref, $last_success_git_ref);
+my ($stage_times, $run_time);
 
 use vars qw($info_row);
 
 
 use vars qw($info_row);
 
@@ -111,7 +112,7 @@ if ($system && $logdate)
           select operating_system, os_version, 
                  compiler, compiler_version, 
                  architecture,
           select operating_system, os_version, 
                  compiler, compiler_version, 
                  architecture,
-                replace(owner_email,'\@',' [ a t ] ') as owner_email,
+                replace(owner_email,E'\@',' [ a t ] ') as owner_email,
                 sys_notes_ts::date AS sys_notes_date, sys_notes
           from buildsystems 
           where status = 'approved'
                 sys_notes_ts::date AS sys_notes_date, sys_notes
           from buildsystems 
           where status = 'approved'
@@ -135,6 +136,21 @@ if ($system && $logdate)
            $info_row->{compiler_version} = $latest_personality->[1];
        }
        $sth->finish;
            $info_row->{compiler_version} = $latest_personality->[1];
        }
        $sth->finish;
+       my $stage_times_query = q{
+           select log_stage, stage_duration
+           from build_status_log
+           where sysname = ? and snapshot = ?
+        };
+       $stage_times = 
+           $db->selectall_hashref($stage_times_query,'log_stage',undef,
+                                  $system,$logdate);
+       $stage_times_query = q{
+           select sum(stage_duration)
+           from build_status_log
+           where sysname = ? and snapshot = ?
+        };
+       ($run_time) = $db->selectrow_array($stage_times_query,undef,
+                                  $system,$logdate);
        $db->disconnect;
 }
 
        $db->disconnect;
 }
 
@@ -157,6 +173,8 @@ $template->process('log.tt',
                system => $system,
                branch => $branch,
                stage => $stage,
                system => $system,
                branch => $branch,
                stage => $stage,
+               stage_times => $stage_times,
+               run_time => $run_time,
                urldt => $logdate,
                log_file_names => \@log_file_names,
                conf => $conf,
                urldt => $logdate,
                log_file_names => \@log_file_names,
                conf => $conf,
index 43b89c413ce734394de7a2c3123916789b4d3fc6..c78ebaa704bf55619b5e8c416a9169eaeb23fa92 100644 (file)
@@ -7,7 +7,7 @@ See accompanying License file for license details
 -%]
 [% PERL %]
        use POSIX qw(ceil);
 -%]
 [% PERL %]
        use POSIX qw(ceil);
-        my $lrfactor = 6;
+        my $lrfactor = 4;
        $stash->set(lrfactor => $lrfactor);
         my $rows = $stash->get('log_file_names'); 
        my $logrows = ceil(scalar(@$rows)/$lrfactor);
        $stash->set(lrfactor => $lrfactor);
         my $rows = $stash->get('log_file_names'); 
        my $logrows = ceil(scalar(@$rows)/$lrfactor);
@@ -69,10 +69,10 @@ See accompanying License file for license details
 [% END %]
 [% cell = 0; FOREACH logstage  IN log_file_names ; striplog = logstage.replace('\.log$','') ; cell = loop.count %]
   [% IF loop.first %] 
 [% END %]
 [% cell = 0; FOREACH logstage  IN log_file_names ; striplog = logstage.replace('\.log$','') ; cell = loop.count %]
   [% IF loop.first %] 
-    <br /> <table><tr><th class='head' rowspan='[% logrows %]'>Stage Logs</th>
+    <br /> <table><tr><th class='head' rowspan='[% logrows %]'>Stage Logs<br /><br />Total run time<br />[% run_time %]</th>
   [% END %]
     [% IF loop.count > 1 and loop.count % lrfactor == 1 %]<tr>[% END %]
   [% END %]
     [% IF loop.count > 1 and loop.count % lrfactor == 1 %]<tr>[% END %]
-    <td><a href='show_stage_log.pl?nm=[% system %]&amp;dt=[% urldt | uri %]&amp;stg=[% striplog %]'>[% striplog %]</a></td>
+    <td><a href='show_stage_log.pl?nm=[% system %]&amp;dt=[% urldt | uri %]&amp;stg=[% striplog %]'>[% striplog %]</a> ([% stage_times.$logstage.stage_duration %])</td>
     [% IF loop.count % lrfactor == 0 %]</tr>[% END %]
 [% END %]
 
     [% IF loop.count % lrfactor == 0 %]</tr>[% END %]
 [% END %]