Diff for /loncom/debugging_tools/db_copy.pl between versions 1.4 and 1.5

version 1.4, 2006/10/13 18:34:07 version 1.5, 2006/10/13 21:00:06
Line 8  use GDBM_File; Line 8  use GDBM_File;
 use File::Find;  use File::Find;
 use LONCAPA;  use LONCAPA;
 use LONCAPA::Configuration;  use LONCAPA::Configuration;
 use Cwd;  use Fcntl qw(:flock);
   
 my $dump_db = '/home/httpd/perl/debug/dump_db_static_32';  my $dump_db = '/home/httpd/perl/debug/dump_db_static_32';
 my $create_db = '/home/httpd/perl/debug/create_db_dynamic';  my $create_db = '/home/httpd/perl/debug/create_db_dynamic_64';
 if (!-x $dump_db || !-x $create_db) {  if (!-x $dump_db || !-x $create_db) {
     print("Unable to run needed helper programs\n $dump_db\n $create_db\n.");      print("Unable to run needed helper programs\n $dump_db\n $create_db\n.");
     exit(-1);      exit(-1);
Line 46  sub count_db { Line 46  sub count_db {
 }  }
   
 my $done=0;  my $done=0;
   my $skip=0;
 my $starttime;  my $starttime;
 my $last_100_start_time;  my $last_100_start_time;
 sub process_db {  sub process_db {
Line 59  sub process_db { Line 60  sub process_db {
  rename($file,"$file.old");   rename($file,"$file.old");
  rename("$file.new","$file");   rename("$file.new","$file");
  &unlock_db($dbref);   &unlock_db($dbref);
       } else {
    #print("skip $_\n");
    $skip++;
     }      }
     $done++;      $done++;
     if (!($done %100)) {      if (!($done %100)) {
Line 66  sub process_db { Line 70  sub process_db {
         my $took = time()-$starttime;          my $took = time()-$starttime;
         my $togo = int(($took/$done) * ($count-$done));          my $togo = int(($took/$done) * ($count-$done));
         my $total = $togo+$took;          my $total = $togo+$took;
         my $per = $took/$done;   my $per = ($done-$skip)?$took/($done-$skip):0;
         my $last_per = (time()-$last_100_start_time)/100;          my $last_per = (time()-$last_100_start_time)/100;
         printf("%6d in %6d, togo %6d, overall %6d, %.4f (for one), %.4f)\n",          printf("%6d (%6d) in %6d, togo %6d, overall %6d, %.3f (each), %.3f\n",
        $done,$took,$togo,$total,$per,$last_per);         $done,$skip,$took,$togo,$total,$per,$last_per);
         $last_100_start_time = time();          $last_100_start_time = time();
     }      }
 }  }

Removed from v.1.4  
changed lines
  Added in v.1.5


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>