diff --git a/src/onedb/onedb.rb b/src/onedb/onedb.rb index 3989d05cce..fdef7f41cb 100644 --- a/src/onedb/onedb.rb +++ b/src/onedb/onedb.rb @@ -16,6 +16,7 @@ require 'onedb_backend' +# If set to true, extra verbose time log will be printed for each migrator LOG_TIME = false class OneDB @@ -155,16 +156,12 @@ class OneDB time1 = Time.now - if LOG_TIME - puts " > Time for #{file}: #{time1 - time0}s" - end - if !result raise "Error while upgrading from #{version} to " << " #{@backend.db_version}" end - puts " > Done" if ops[:verbose] + puts " > Done in #{"%0.02f" % (time1 - time0).to_s}s" if ops[:verbose] puts "" if ops[:verbose] matches = Dir.glob( @@ -180,9 +177,7 @@ class OneDB timeb = Time.now - if LOG_TIME - puts " > Total time: #{timeb - timea}s" if ops[:verbose] - end + puts "Total time: #{"%0.02f" % (timeb - timea).to_s}s" if ops[:verbose] return 0 diff --git a/src/onedb/onedb_backend.rb b/src/onedb/onedb_backend.rb index ba9fdf5629..315251597e 100644 --- a/src/onedb/onedb_backend.rb +++ b/src/onedb/onedb_backend.rb @@ -138,7 +138,7 @@ class OneDBBacKEnd def log_time() if LOG_TIME @time1 = Time.now - puts " > #{db_version} Time for block #{@block_n}: #{@time1 - @time0}s" + puts " > #{db_version} Time for block #{@block_n}: #{"%0.02f" % (@time1 - @time0).to_s}s" @time0 = Time.now @block_n += 1 end