#!/usr/bin/perl use warnings; use strict; use Time::HiRes; my $hr_log; BEGIN { open($hr_log, ">", "/tmp/hrlog") or die "can't open hi-res log"; sub hr_logger { my ($secs, $msecs) = Time::HiRes::gettimeofday(); print $hr_log "$secs.$msecs: ", join("|", @_), "\n"; } hr_logger("BEGIN"); } # Obviously, you'll have all your modules here use CGI; # Put this just before you actually do any work in your code # i.e. after all your 'use' lines hr_logger("Ready to run"); # This bit would be your app print "Now get on with running the app\n"; # And put this before you exit, for completeness hr_logger("finished"); exit 0; #### 1178122211.615440: BEGIN 1178122211.646999: Ready to run 1178122211.647111: finished