diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-07-19 13:44:11 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-07-19 13:44:11 -0700 |
commit | 202fb79e8686ee127fe49497c979cfc9c9d985d5 (patch) | |
tree | df2c9c0cc5c1107b3ea28684c559a945b4a31ca4 /activerecord | |
parent | c3c349ec3e9a3990cac4d256c308b18fd35d9606 (diff) | |
download | rails-202fb79e8686ee127fe49497c979cfc9c9d985d5.tar.gz rails-202fb79e8686ee127fe49497c979cfc9c9d985d5.tar.bz2 rails-202fb79e8686ee127fe49497c979cfc9c9d985d5.zip |
reusing the time instrumentation from the instrumenter rather than Benchmark. [#5098 state:open]
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/abstract_adapter.rb | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb b/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb index be8d1bd76b..6072481411 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb @@ -199,11 +199,14 @@ module ActiveRecord def log(sql, name) name ||= "SQL" - result = nil - ActiveSupport::Notifications.instrument("sql.active_record", - :sql => sql, :name => name, :connection_id => self.object_id) do - @runtime += Benchmark.ms { result = yield } + instrumenter = ActiveSupport::Notifications.instrumenter + + result = instrumenter.instrument("sql.active_record", + :sql => sql, :name => name, :connection_id => object_id) do + yield end + @runtime += instrumenter.elapsed + result rescue Exception => e message = "#{e.class.name}: #{e.message}: #{sql}" |