Diff
Not logged in

Differences From:

File tools/lib/import_statistics.tcl part of check-in [18251642f3] - Moved the handling of the import statistics into its own package. Untested. by aku on 2007-09-14 23:23:48. [view]

To:

File tools/lib/import_statistics.tcl part of check-in [b504674c5f] - Fixed problems with the untested statistics module. Moved cset <-> uuid map out of cvs to control layer, separate package. Currently not really useful, will be needed when handling cvs branches. Moved some user feedback around, and the import control too. by aku on 2007-09-15 03:18:31. [view]

@@ -24,15 +24,14 @@
 
 # -----------------------------------------------------------------------------
 # API Implementation - Functionality
 
-proc ::vc::fossil::import::stats::init {n m} {
+proc ::vc::fossil::import::stats::setup {n m} {
+    variable run_format    %[string length $n]s
+    variable max_format    %[string length $m]s
     variable total_csets   $n
     variable total_running 0
     variable total_seconds 0.0
-
-    variable ntfmt %[string length $n]s
-    variable nmfmt %[string length $m]s
     return
 }
 
 proc ::vc::fossil::import::stats::done {} {
@@ -40,16 +39,19 @@
     variable total_seconds
 
     write 0 stats "========= [string repeat = 61]"
     write 0 stats "Imported $total_csets [expr {($total_csets == 1) ? "changeset" : "changesets"}]"
-    write 0 stats "Within [F $tot] seconds (avg [F [Avg]] seconds/changeset)"
+    write 0 stats "Within [F $total_seconds] seconds (avg [F [Avg]] seconds/changeset)"
     return
 }
 
 proc ::vc::fossil::import::stats::csbegin {cset} {
-    variable nmfmt
-    variable ntfmt
-    write 0 stats "ChangeSet [format $nmfmt $cset] @ [format $ntfmt $total_running]/$total_csets ([F6 [expr {$total_running*100.0/$total_csets}]]%)"
+    variable max_format
+    variable run_format
+    variable total_running
+    variable total_csets
+
+    write 0 stats "ChangeSet [format $max_format $cset] @ [format $run_format $total_running]/$total_csets ([F6 [expr {$total_running*100.0/$total_csets}]]%)"
     return
 }
 
 proc ::vc::fossil::import::stats::csend {seconds} {
@@ -57,9 +59,9 @@
     variable total_seconds
     variable total_running
 
     incr total_running
-    set  total_seconds [expr {$total_seconds + $sec}]
+    set  total_seconds [expr {$total_seconds + $seconds}]
 
     set avg [Avg]
     set end [expr {$total_csets * $avg}]
     set rem [expr {$end - $total_seconds}]
@@ -96,12 +98,18 @@
 
 # -----------------------------------------------------------------------------
 
 namespace eval ::vc::fossil::import::stats {
-    namespace export setup done begin add
+    variable total_csets   0 ; # Number of changesets to expect to be imported
+    variable total_running 0 ; # Number of changesets which have been imported so far
+    variable total_seconds 0 ; # Current runtime in seconds
+    variable max_format   %s ; # Format to print changeset id, based on the largest id.
+    variable run_format   %s ; # Format to print the number of imported csets.
+
+    namespace export setup done csbegin csend
 }
 
 # -----------------------------------------------------------------------------
 # Ready
 
 package provide vc::fossil::import::stats 1.0
 return