[LON-CAPA-cvs] cvs: loncom /xml lonxml.pm

albertel lon-capa-cvs@mail.lon-capa.org
Tue, 05 Oct 2004 18:54:49 -0000


albertel		Tue Oct  5 14:54:49 2004 EDT

  Modified files:              
    /loncom/xml	lonxml.pm 
  Log:
  - only do the gettimeofday calls when in debug mode
  
  
Index: loncom/xml/lonxml.pm
diff -u loncom/xml/lonxml.pm:1.339 loncom/xml/lonxml.pm:1.340
--- loncom/xml/lonxml.pm:1.339	Tue Oct  5 14:51:50 2004
+++ loncom/xml/lonxml.pm	Tue Oct  5 14:54:49 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # XML Parser Module 
 #
-# $Id: lonxml.pm,v 1.339 2004/10/05 18:51:50 albertel Exp $
+# $Id: lonxml.pm,v 1.340 2004/10/05 18:54:49 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -824,9 +824,12 @@
   if ($Apache::lonxml::depthcounter[$Apache::lonxml::depth]==1) {
     $Apache::lonxml::olddepth=$Apache::lonxml::depth;
   }
-  push(@timers,[&gettimeofday()]);
-  my $time=&tv_interval($lasttime);
-  $lasttime=[&gettimeofday()];
+  my $time;
+  if ($Apache::lonxml::debug eq "1") {
+      push(@timers,[&gettimeofday()]);
+      $time=&tv_interval($lasttime);
+      $lasttime=[&gettimeofday()];
+  }
   my $spacing='  'x($Apache::lonxml::depth-1);
   my $curdepth=join('_',@Apache::lonxml::depthcounter);
   &Apache::lonxml::debug("s$spacing$Apache::lonxml::depth : $Apache::lonxml::olddepth : $curdepth : $token->[1] : $time : \n");
@@ -844,9 +847,12 @@
     &Apache::lonxml::warning(&mt("Missing tags, unable to properly run file."));
     $Apache::lonxml::depth='-1';
   }
-  my $timer=pop(@timers);
-  my $time=&tv_interval($lasttime);
-  $lasttime=[&gettimeofday()];
+  my ($timer,$time);
+  if ($Apache::lonxml::debug eq "1") {
+      $timer=pop(@timers);
+      $time=&tv_interval($lasttime);
+      $lasttime=[&gettimeofday()];
+  }
   my $spacing='  'x$Apache::lonxml::depth;
   my $curdepth=join('_',@Apache::lonxml::depthcounter);
   &Apache::lonxml::debug("e$spacing$Apache::lonxml::depth : $Apache::lonxml::olddepth : $curdepth : $token->[1] : $time : ".&tv_interval($timer)."\n");