class Asciidoctor::Timings
Constants
- CLOCK_ID
Public Class Methods
Public Instance Methods
Source
# File lib/asciidoctor/timings.rb, line 50 def print_report to = $stdout, subject = nil to.puts %(Input file: #{subject}) if subject to.puts %( Time to read and parse source: #{sprintf '%05.5f', read_parse.to_f}) to.puts %( Time to convert document: #{sprintf '%05.5f', convert.to_f}) to.puts %( Total time (read, parse and convert): #{sprintf '%05.5f', read_parse_convert.to_f}) end
Source
# File lib/asciidoctor/timings.rb, line 30 def read_parse time :read, :parse end
Source
# File lib/asciidoctor/timings.rb, line 38 def read_parse_convert time :read, :parse, :convert end
Source
# File lib/asciidoctor/timings.rb, line 13 def record key @log[key] = (now - (@timers.delete key)) end
Source
# File lib/asciidoctor/timings.rb, line 17 def time *keys time = keys.reduce(0) {|sum, key| sum + (@log[key] || 0) } time > 0 ? time : nil end
Source
# File lib/asciidoctor/timings.rb, line 46 def total time :read, :parse, :convert, :write end
Private Instance Methods
Source
# File lib/asciidoctor/timings.rb, line 61 def now ::Process.clock_gettime CLOCK_ID end