Module: Mysql2::Result::MiniProfiler

Included in:
Mysql2::Result
Defined in:
lib/patches/db/mysql2/prepend.rb

Instance Method Summary collapse

Instance Method Details

#each(*args, &blk) ⇒ Object



5
6
7
8
9
10
11
12
13
14
# File 'lib/patches/db/mysql2/prepend.rb', line 5

def each(*args, &blk)
  return super unless defined?(@miniprofiler_sql_id)

  start        = Process.clock_gettime(Process::CLOCK_MONOTONIC)
  result       = super
  elapsed_time = SqlPatches.elapsed_time(start)

  @miniprofiler_sql_id.report_reader_duration(elapsed_time)
  result
end