Added a timer for every page.
authorSteinar H. Gunderson <sesse@samfundet.no>
Mon, 4 Apr 2005 00:31:01 +0000 (00:31 +0000)
committerSteinar H. Gunderson <sesse@samfundet.no>
Mon, 4 Apr 2005 00:31:01 +0000 (00:31 +0000)
html/ccbs.pm
html/templates/main.tmpl

index 8195543..61dadf8 100755 (executable)
@@ -3,9 +3,16 @@ use Template;
 use CGI;
 use DBI;
 use HTML::Entities;
+use Time::HiRes;
 use strict;
 use warnings;
 
+our $start_time;
+
+BEGIN {
+       $start_time = [Time::HiRes::gettimeofday()];
+}
+
 our $ccbs_dbdebug = 0;
 
 # Set this flag to disable any admin tasks -- it's quite crude, but hey :-)
@@ -64,6 +71,7 @@ sub process_template {
        $vars->{'page'} = $page;
        $vars->{'title'} = $title;
        $vars->{'public'} = $ccbs_noadmin;
+       $vars->{'timetogenerate'} = sprintf "%.3f", Time::HiRes::tv_interval($start_time);
        
        my $config = {
                INCLUDE_PATH => 'templates/',
index 46b0e5d..32ce8ce 100644 (file)
@@ -22,3 +22,4 @@
     </div>
   </body>
 </html>
+<!-- Data acquisition and processing took [% timetogenerate %] seconds. -->