[Bio] / FigKernelPackages / Tracer.pm Repository:
ViewVC logotype

Diff of /FigKernelPackages/Tracer.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.128, Wed Dec 16 20:57:35 2009 UTC revision 1.131, Wed Nov 17 11:32:35 2010 UTC
# Line 23  Line 23 
23      use vars qw(@EXPORT @EXPORT_OK);      use vars qw(@EXPORT @EXPORT_OK);
24      @EXPORT = qw(Trace T TSetup QTrace Confess MemTrace Cluck Min Max Assert Open OpenDir TICK StandardSetup EmergencyKey ETracing Constrain Insure ChDir Emergency Warn TraceDump IDHASH);      @EXPORT = qw(Trace T TSetup QTrace Confess MemTrace Cluck Min Max Assert Open OpenDir TICK StandardSetup EmergencyKey ETracing Constrain Insure ChDir Emergency Warn TraceDump IDHASH);
25      @EXPORT_OK = qw(GetFile GetOptions Merge MergeOptions ParseCommand ParseRecord UnEscape Escape PrintLine PutLine);      @EXPORT_OK = qw(GetFile GetOptions Merge MergeOptions ParseCommand ParseRecord UnEscape Escape PrintLine PutLine);
26      use Carp qw(longmess croak carp);      use Carp qw(longmess croak carp confess);
27      use CGI;      use CGI;
28      use Cwd;      use Cwd;
29      use FIG_Config;      use FIG_Config;
# Line 501  Line 501 
501          }          }
502      } elsif ($Destination =~ m/^>>/) {      } elsif ($Destination =~ m/^>>/) {
503          # Write the trace message to an output file.          # Write the trace message to an output file.
504          open(TRACING, $Destination) || die "Tracing open for \"$Destination\" failed: $!";          open(TRACING, $Destination) || confess("Tracing open for \"$Destination\" failed: $!");
505          # Lock the file.          # Lock the file.
506          flock TRACING, LOCK_EX;          flock TRACING, LOCK_EX;
507          print TRACING "$formatted\n";          print TRACING "$formatted\n";
# Line 1104  Line 1104 
1104    
1105  =back  =back
1106    
1107    =back
1108    
1109  =cut  =cut
1110    
1111  sub ETracing {  sub ETracing {
# Line 1123  Line 1125 
1125      # Check for emergency tracing.      # Check for emergency tracing.
1126      my $tkey = EmergencyKey($parameter);      my $tkey = EmergencyKey($parameter);
1127      my $emergencyFile = EmergencyFileName($tkey);      my $emergencyFile = EmergencyFileName($tkey);
1128      if (-e $emergencyFile) {      if (-e $emergencyFile && (my $stat = stat($emergencyFile))) {
1129          # We have the file. Read in the data.          # We have the file. Read in the data.
1130          my @tracing = GetFile($emergencyFile);          my @tracing = GetFile($emergencyFile);
1131          # Pull off the time limit.          # Pull off the time limit.
# Line 1131  Line 1133 
1133          # Convert it to seconds.          # Convert it to seconds.
1134          $expire *= 3600;          $expire *= 3600;
1135          # Check the file data.          # Check the file data.
         my $stat = stat($emergencyFile);  
1136          my ($now) = gettimeofday;          my ($now) = gettimeofday;
1137          if ($now - $stat->mtime > $expire) {          if ($now - $stat->mtime <= $expire) {
             # Delete the expired file.  
             unlink $emergencyFile;  
         } else {  
1138              # Emergency tracing is on. Pull off the destination and              # Emergency tracing is on. Pull off the destination and
1139              # the trace level;              # the trace level;
1140              $dest = shift @tracing;              $dest = shift @tracing;

Legend:
Removed from v.1.128  
changed lines
  Added in v.1.131

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3