1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-21 14:50:08 +03:00

Feature #2586: Better onedb upgrade time log

This commit is contained in:
Carlos Martín 2014-02-18 17:21:38 +01:00
parent dfb052b9ed
commit 6b0971415b
2 changed files with 4 additions and 9 deletions

View File

@ -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

View File

@ -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