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